duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 14a9f6fd2e6919d523effc10a148a73cd2fcbb58
parent 7e8b1879427fe1803f3faed39532c383d065dd54
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Mon,  6 Jun 2022 21:38:56 -0400

Consolidate dusk.asm a little bit

Diffstat:
Mdusk.asm | 40++++++++++++++++------------------------
1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/dusk.asm b/dusk.asm @@ -479,8 +479,7 @@ defword 'litn', 4, word_litn, word_rshift pspush litncode ; src pspush litncode_end-litncode-4 ; len_of_code-len-of-imm call word_movewrite - call word_write - ret + jmp word_write defword 'call,', 5, word_callwrite, word_litn pspush 0xe8 ; call opcode @@ -489,16 +488,11 @@ defword 'call,', 5, word_callwrite, word_litn sub eax, [here] ; displacement sub eax, 4 ; ... from *after* call/jmp op mov [ebp], eax - call word_write - ret + jmp word_write defword 'exit,', 5, word_exitwrite, word_callwrite pspush 0xc3 ; ret opcode - call word_cwrite - ret - -; The part below used to be written in a pseudo cross-compilable forth, but -; the tooling around it was too complex for its worth. Assembly all the way. + jmp word_cwrite defword 'current', 7, word_current, word_exitwrite sysval current @@ -519,8 +513,7 @@ defword 'in<', 3, word_inrd, word_iinrd defword 'allot', 5, word_allot, word_inrd pspop eax - add eax, [here] - mov [here], eax + add dword [here], eax ret ; : move ( src dst u -- ) ?dup if @@ -537,13 +530,14 @@ _ret: ; ( a u -- ) defword 'move,', 5, word_movewrite, word_move - mov eax, [ebp] ; u - mov ebx, [here] - mov [ebp], ebx - add ebx, eax - mov [here], ebx - pspush eax - jmp word_move + pspop ecx + pspop esi + test ecx, ecx + jz _ret + mov edi, [here] + add dword [here], ecx + rep movsb + ret ; ( -- sa sl ) defword 'stype', 5, word_stype, word_movewrite @@ -591,7 +585,7 @@ defword 'curword', 7, word_curword, word_stackcond ; ( -- sa sl ) defword 'word', 4, word_word, word_curword _word_loop1: - call word_inrd ; ( -- c ) + call [inrd] ; ( -- c ) pspop eax cmp eax, 0x21 ; is ws? jc _word_loop1 @@ -600,7 +594,7 @@ _word_loop2: mov [ebx], al inc ebx push ebx - call word_inrd ; ( -- c ) + call [inrd] ; ( -- c ) pop ebx pspop eax cmp eax, 0x21 ; is ws? @@ -795,14 +789,12 @@ _xtcomp_imm: call word_execute test dword [compiling], -1 jnz _xtcomp_loop - call word_exitwrite - ret + jmp word_exitwrite defword ':', 1, word_docol, word_xtcomp call word_word call word_entry - call word_xtcomp - ret + jmp word_xtcomp defword ';', 0x81, word_compstop, word_docol mov dword [compiling], 0