X-Git-Url: https://git.danieliu.xyz/?p=sped.git;a=blobdiff_plain;f=repl.asm;h=6a1472f91902664cc3aca89f98427088989e5480;hp=738da942ffcbbcf086f17118d0abda22af7b0165;hb=0e7c787c5d6e31bd64fb9348c1cc4704d5b5928e;hpb=6cf67300c03d92a9cc0c5888b33cdb21a852eb69 diff --git a/repl.asm b/repl.asm index 738da94..6a1472f 100644 --- a/repl.asm +++ b/repl.asm @@ -201,12 +201,42 @@ repl: push DWORD [buffer_lines] push DWORD [cur_line] call shiftLeft + mov [buffer], eax sub DWORD [buffer_lines], 1 jmp _repl_continue _repl_cmd_delete_end: + ; o appends text after line =-=-=-=-=-=-=-=-= + mov eax, DWORD [ebp-CMDSTR] + cmp BYTE [eax], 'o' + jne _repl_cmd_appendup_end + + ; make room first + push DWORD [buffer] + push DWORD [buffer_lines] + push DWORD [cur_line] + call shiftRight + mov [buffer], eax + + ; input text + push 0 + call readLine + mov esi, eax + + ; insert new string + mov eax, [cur_line] + mov ecx, 4 + mul ecx + add eax, DWORD [buffer] + mov [eax], esi + + add DWORD [buffer_lines], 1 + + jmp _repl_continue + _repl_cmd_appendup_end: + ; w writes file =-=-=-=-=-=-=-=-=-=-=-=-= mov eax, DWORD [ebp-CMDSTR] cmp BYTE [eax], 'w'