duskos

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

commit 24bc3d3f761641688374ef4d1457784be4c95021
parent fb6c5301406ddb47d940d85e9afee8f0fce84227
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun,  5 Jun 2022 07:35:53 -0400

Make boot< native and move in> to sys/rdln.fs

Diffstat:
Maliases.txt | 1-
Mdusk.asm | 14+++++++++++---
Mfs/sys/rdln.fs | 1+
Mxcomp.txt | 2--
4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/aliases.txt b/aliases.txt @@ -13,7 +13,6 @@ r>A rs2A rot> rotr >A Aset A> Aget -in> inptr 'curword curwordaddr 1+ inc 1- dec diff --git a/dusk.asm b/dusk.asm @@ -101,11 +101,11 @@ SECTION .bss areg: resd 1 ; A register toflag: resb 1 ; to flag exitonabort: resb 1 ; if set, abort will exit(1) +bootptr: resd 1 current: resd 1 here: resd 1 compiling: resd 1 curword: resb 0x20 ; 1b len, then contents -inptr: resd 1 ; in> iinrd: resd 1 ; iin< inrd: resd 1 ; in< stype: resd 1 @@ -123,9 +123,9 @@ SECTION .text GLOBAL _start _start: mov byte [exitonabort], 0 + mov dword [bootptr], bootsrc mov dword [here], herestart mov dword [current], word_lastxcomp - mov dword [inptr], bootsrc mov dword [iinrd], word_bootrd mov dword [inrd], word_iinrd mov eax, SYSCALL_CHDIR @@ -224,7 +224,15 @@ defword '(next)', 6, word_nextroutine, word_condbrroutine add eax, 4 jmp eax -defword 'emit', 4, word_emit, word_nextroutine +defword 'boot<', 5, word_bootrd, word_nextroutine + mov esi, [bootptr] + xor eax,eax + mov al, [esi] + inc dword [bootptr] + pspush eax + ret + +defword 'emit', 4, word_emit, word_bootrd mov eax, SYSCALL_WRITE mov ebx, 1 ; stdout mov ecx, ebp ; buffer: top of PS, little endian diff --git a/fs/sys/rdln.fs b/fs/sys/rdln.fs @@ -2,6 +2,7 @@ 64 value LNSZ create in( LNSZ allot : in) in( 64 + ; +in) value in> : bs? BS over = swap $7f = or ; \ only emit c if it's within the visible ascii range : emitv ( c -- ) dup SPC - $5f < if emit else drop then ; diff --git a/xcomp.txt b/xcomp.txt @@ -3,7 +3,6 @@ sysval here sysval compiling const SPC $20 const CR $0d const LF $0a const BS $08 const EOF $04 -sysval in> syscell 'curword curword : 2drop drop drop ; @@ -29,7 +28,6 @@ syscell 'curword curword A>r >r >A begin ( src ) c@+ Ac!+ next drop r>A then ; : move, ( a u -- ) here over allot swap move ; : ws? SPC <= ; -: boot< in> c@+ swap to in> ; alias iin< \ interactive in< alias in< \ where "word" feeds itself : curword ( -- sa sl ) 'curword 1+ 'curword c@ ;