duskos

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

commit 205e4175d5559015356d3f67e9ac6cdd5968c346
parent ceda352b1839d22be66d6099b4cd8fc2b08e53a8
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Tue, 26 Jul 2022 12:19:54 -0400

pc: rudimentary grid system gives us a usable prompt

Diffstat:
Afs/drv/pc/vid8025.fs | 7+++++++
Afs/sys/grid.fs | 15+++++++++++++++
Mfs/xcomp/i386.fs | 8++++----
Mfs/xcomp/pc/glue1.fs | 6------
Mfs/xcomp/pc/init.fs | 6+++++-
5 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/fs/drv/pc/vid8025.fs b/fs/drv/pc/vid8025.fs @@ -0,0 +1,7 @@ +\ Video driver for PC's 80x25 mode + +$b8000 const _membase +80 const COLS +25 const LINES + +: cell! ( c pos -- ) << _membase + swap $700 or swap w! ; diff --git a/fs/sys/grid.fs b/fs/sys/grid.fs @@ -0,0 +1,15 @@ +\ Grid subsystem + +0 value gridpos \ linear pos. if there's 80, pos 84 is 4th char of 2nd line. + +: pcell! ( c -- ) gridpos cell! ; + +: linefeed ( -- ) + gridpos COLS / 1+ LINES mod COLS * to gridpos ; + +: (emit) ( c -- ) case + 8 ( BS ) of = SPC pcell! -1 to+ gridpos endof + CR of = SPC pcell! linefeed endof + SPC of > endof + r@ pcell! gridpos 1+ dup COLS mod if to gridpos else linefeed then + endcase ; diff --git a/fs/xcomp/i386.fs b/fs/xcomp/i386.fs @@ -20,11 +20,11 @@ 22 values L1 L2 lblmainalias lbltoptr lbltoexec lblbootptr lblin< lblcurword lblret lblcurrent lblemit lblparsec lblparseh lblparseud lblerrmsg lblrtype lblhere lblmovewrite lblwrite lblcwrite lblcompiling lblareg -$500 const HERESTART \ TODO: find a better place -$8000 const HEREMAX +$a000 const HERESTART \ TODO: find a better place +$80000 const HEREMAX $8000 to binstart \ This code lives at $8000. $6000 const RSTOP -$8000 const PSTOP +$7c00 const PSTOP here to org forward16 jmp, to L1 @@ -117,7 +117,7 @@ xcode heremax ret, xcode here - wcall, (val) pc to lblhere HERESTART , + wcall, (val) pc to lblhere $500 , xcode current wcall, (val) pc to lblcurrent 0 , diff --git a/fs/xcomp/pc/glue1.fs b/fs/xcomp/pc/glue1.fs @@ -1,8 +1,2 @@ BIOSSECSZ const drvblksz alias biossec@ (drv@) -\ this below is temporary. it's really useful for debugging... -create _ ," 0123456789abcdef" -: .xh $f and _ + c@ emit ; -: .x1 dup 4 rshift .xh .xh ; -: .x2 dup 8 rshift .x1 .x1 ; -: .x ( n -- ) dup 16 rshift .x2 .x2 ; diff --git a/fs/xcomp/pc/init.fs b/fs/xcomp/pc/init.fs @@ -1,4 +1,8 @@ \ Initialization for PC +herestart to here 0 S" sys" fchild S" file.fs" fchild fload \ We now have f<< -f<< sys/doc.fs +f<< /sys/doc.fs +f<< /drv/pc/vid8025.fs +f<< /sys/grid.fs +' (emit) to emit