From 82c5efad76161abd7d16042087696758371d45d5 Mon Sep 17 00:00:00 2001 From: mateoconlechuga Date: Sat, 8 Jun 2019 17:44:21 -0600 Subject: [PATCH] fix #113 --- src/edit.asm | 4 ++-- src/hooks.asm | 46 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/edit.asm b/src/edit.asm index 8ecac6e..bb1d6a2 100644 --- a/src/edit.asm +++ b/src/edit.asm @@ -154,7 +154,7 @@ error_offset := $-3 .goto_new_line: ld hl,(ti.editCursor) ld a,(hl) - cp a,$3f + cp a,ti.tEnter jr z,.goto_new_line_back .loop: ld a,(hl) @@ -170,7 +170,7 @@ error_offset := $-3 pop de jr z,.goto_new_line_back ld a,d - cp a,$3f + cp a,ti.tEnter jr z,.goto_new_line_next .goto_new_line_back: call ti.BufLeft diff --git a/src/hooks.asm b/src/hooks.asm index b944cbd..6e8f276 100644 --- a/src/hooks.asm +++ b/src/hooks.asm @@ -208,7 +208,7 @@ hook_show_labels: or a,a jr nz,.backup ld a,e - cp a,$3f + cp a,ti.tEnter jr nz,.backup call ti.BufRight .done: @@ -301,8 +301,8 @@ hook_show_labels: pop hl ret z ld a,d - cp a,ti.t2ByteTok - jr z,.parse_labels + or a,a + jr nz,.parse_labels ld a,e cp a,ti.tLbl jr nz,.parse_labels @@ -316,8 +316,14 @@ hook_show_labels: jr z,.added_label cp a,ti.tEnter jr z,.added_label + ld a,d + or a,a + jr z,.single ld (hl),a inc hl +.single: + ld (hl),e + inc hl jr .add_label .added_label: xor a,a @@ -330,14 +336,44 @@ hook_show_labels: call ti.PutC ld hl,label_name push hl - call ti.PutS +.displayline: + ld a,(hl) + or a,a + jr z,.leftedge + inc hl + call ti.Isa2ByteTok + ld d,0 + jr nz,.singlebyte +.multibyte: + ld d,a + ld e,(hl) + inc hl + jr .getstring +.singlebyte: + ld e,a +.getstring: + push hl + call ti.GetTokString + ld b,(hl) + inc hl +.loopdisplay: + ld a,(ti.curCol) + cp a,$19 + jr z,.leftedge + ld a,(hl) + inc hl + call ti.PutC + djnz .loopdisplay + pop hl + jr .displayline +.leftedge: ld a,(ti.curRow) inc a ld (ti.curRow),a cp a,10 pop hl ret z - jr .parse_labels + jp .parse_labels .computepageoffsethl: push bc