From: Robert Pengelly Date: Fri, 23 Aug 2024 13:35:20 +0000 (+0100) Subject: Bug fixes and start of left and right arrow key logic X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=347a945e29b540f439d85467db44cb2705ba9af4;p=chimaera.git Bug fixes and start of left and right arrow key logic --- diff --git a/build/chimaera.img b/build/chimaera.img index 8c637b6..ca1e7c2 100644 Binary files a/build/chimaera.img and b/build/chimaera.img differ diff --git a/build/chimaera.vhd b/build/chimaera.vhd index 0507a76..14c5bb5 100644 Binary files a/build/chimaera.vhd and b/build/chimaera.vhd differ diff --git a/src/apps/pcomm/pcomm.asm b/src/apps/pcomm/pcomm.asm index ced250f..81272c8 100644 --- a/src/apps/pcomm/pcomm.asm +++ b/src/apps/pcomm/pcomm.asm @@ -102,6 +102,9 @@ _main: cmp al, HEX (4B) je .L4 + ;cmp al, HEX (4D) + ;je .L58 + cmp al, HEX (50) je .L2 @@ -112,6 +115,28 @@ _main: cmp al, HEX (09) jne .L14 + push ax + push bx + push cx + push dx + + mov bx, offset _scratch + + mov ax, di + sub ax, bx + + mov cl, ch + xor ch, ch + + cmp ax, cx + + pop dx + pop cx + pop bx + pop ax + + jne .L11 + push ax push bx push dx @@ -536,10 +561,105 @@ _main: jmp .L11 +.L58: + + push bx + push cx + push dx + + mov bx, offset _scratch + + mov ax, di + sub ax, bx + + mov cl, ch + xor ch, ch + + cmp ax, cx + je .L63 + + mov ax, HEX (0300) + xor bx, bx + int HEX (10) + + cmp dl, HEX (4F) + jb .L64 + + xor dl, dl + inc dh + + jmp .L65 + +.L64: + + inc dl + +.L65: + + mov ax, HEX (0200) + xor bx, bx + int HEX (10) + + inc di + +.L63: + + pop dx + pop cx + pop bx + + jmp .L11 + +.L57: + + push bx + push cx + push dx + + mov ax, HEX (0300) + xor bx, bx + int HEX (10) + + cmp dh, cs:[_curr_row] + jne .L62 + + cmp dl, cs:[_curr_col] + je .L60 + +.L62: + + and dl, dl + jnz .L59 + + mov dl, HEX (4F) + dec dh + + jmp .L61 + +.L59: + + dec dl + +.L61: + + mov ax, HEX (0200) + xor bx, bx + int HEX (10) + + dec di + +.L60: + + pop dx + pop cx + pop bx + + jmp .L11 + .L4: - call _handle_backspace - jmp .L11 + call _handle_backspace + jmp .L11 .L3: @@ -849,11 +969,87 @@ _main: .L1: + and ch, ch + jz .L67 + + push ax + push bx + push cx + push dx + + xor ah, ah + mov al, cs:[_curr_col] + + xor dx, dx + + mov cl, ch + xor ch, ch + + add ax, cx + + mov di, offset _scratch + add di, cx + + mov cx, 80 + div cx + + mov dh, cs:[_curr_row] + add dh, al + + mov ax, HEX (0200) + xor bx, bx + int HEX (10) + + pop dx + pop cx + pop bx + pop ax + +.L67: + call _history_up jmp .L11 .L2: + and ch, ch + jz .L66 + + push ax + push bx + push cx + push dx + + xor ah, ah + mov al, cs:[_curr_col] + + xor dx, dx + + mov cl, ch + xor ch, ch + + add ax, cx + + mov di, offset _scratch + add di, cx + + mov cx, 80 + div cx + + mov dh, cs:[_curr_row] + add dh, al + + mov ax, HEX (0200) + xor bx, bx + int HEX (10) + + pop dx + pop cx + pop bx + pop ax + +.L66: + call _history_down jmp .L11 @@ -1015,20 +1211,24 @@ _handle_backspace: xor ah, ah mov al, cs:[_curr_col] + push bx push cx push dx + xor dx, dx mov cl, ch xor ch, ch + add ax, cx - mov cx, HEX (50) + mov cx, 80 div cx xchg ax, dx pop dx pop cx + pop bx and ax, ax jnz .L13 @@ -1200,15 +1400,6 @@ _prompt: mov ax, cs mov ds, ax -.L19: - - mov ax, HEX (0300) - xor bx, bx - int HEX (10) - - mov cs:[_curr_row], dh ; byte ptr [bp - 2] - mov cs:[_curr_col], dl ; byte ptr [bp - 1] - .L17: mov di, offset _scratch @@ -1256,6 +1447,15 @@ _prompt: mov dl, ' ' int HEX (21) +.L19: + + mov ax, HEX (0300) + xor bx, bx + int HEX (10) + + mov cs:[_curr_row], dh ; byte ptr [bp - 2] + mov cs:[_curr_col], dl ; byte ptr [bp - 1] + .L18: pop ds