1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-04 04:48:06 +11:00

sms: CollapseOS prompt!

This commit is contained in:
Virgil Dupras 2020-05-15 12:14:27 -04:00
parent ca60685067
commit 175b4bc497
9 changed files with 32 additions and 31 deletions

View File

@ -6,7 +6,9 @@ Logic
>< n l h -- f Push true if l < n < h
=><= n l h -- f Push true if l <= n <= h
CMP n1 n2 -- n Compare n1 and n2 and set n to -1, 0, or 1.
n=0: a1=a2. n=1: a1>a2. n=-1: a1<a2.
n=0: a1=a2. n=1: a1>a2. n=-1: a1<a2.
MIN a b -- n Returns the lowest of a and b
MAX a b -- n Returns the highest of a and b
NOT f -- f Push the logical opposite of f

View File

@ -1,6 +1,6 @@
RAMSTART FUTURE USES +3c BLK(*
+02 CURRENT +3e FUTURE USES
+04 HERE
+02 CURRENT +3e XYPOS
+04 HERE +40 FUTURE USES
+06 C<? +51 CURRENTPTR
+08 C<* override +53 (emit) override
+0a NLPTR +55 (key) override

View File

@ -7,8 +7,8 @@ WORDBUF is the buffer used by WORD
BOOT C< PTR is used when Forth boots from in-memory
source. See "Initialization sequence" below.
XYPOS Current position of the cursor on screen. The meaning of
the pos in terms of row and cols is driver-dependent.

View File

@ -3,6 +3,7 @@
: HERE 0x04 RAM+ ;
: CURRENT* 0x51 RAM+ ;
: CURRENT CURRENT* @ ;
: XYPOS 0x40 RAM+ ;
( w -- a f )
: (find) CURRENT @ SWAP _find ;

17
blk/394
View File

@ -2,14 +2,11 @@
: ERR LIT< (print) (find) IF EXECUTE THEN ABORT ;
: = CMP NOT ; : < CMP -1 = ; : > CMP 1 = ;
: 0< 32767 > ; : >= < NOT ; : <= > NOT ; : 0>= 0< NOT ;
( n l h -- f )
: >< 2 PICK > ( n l f ) ROT ROT > AND ;
: >< ( n l h -- f ) 2 PICK > ( n l f ) ROT ROT > AND ;
: =><= 2 PICK >= ( n l f ) ROT ROT >= AND ;
( a -- a+1 c )
: C@+ DUP C@ SWAP 1+ SWAP ;
( c a -- a+1 )
: C!+ SWAP OVER C! 1+ ;
( a -- a-1 c )
: C@- DUP C@ SWAP 1- SWAP ;
( c a -- a-1 )
: C!- SWAP OVER C! 1- ;
: MIN ( n n - n ) 2DUP > IF SWAP THEN DROP ;
: MAX ( n n - n ) 2DUP < IF SWAP THEN DROP ;
: C@+ ( a -- a+1 c ) DUP C@ SWAP 1+ SWAP ;
: C!+ ( c a -- a+1 ) SWAP OVER C! 1+ ;
: C@- ( a -- a-1 c ) DUP C@ SWAP 1- SWAP ;
: C!- ( c a -- a-1 ) SWAP OVER C! 1- ;

18
blk/627
View File

@ -1,14 +1,6 @@
: _set ( row col tilenum -- )
ROT 5 LSHIFT ROT OR 0x7800 OR _ctl
_data 1 _zero
: (emit)
XYPOS @ 2 * 0x7800 OR _ctl
0x20 - 0x5e MIN ( tilenum ) _data 1 _zero
XYPOS @ 1+ DUP [ VDP_COLS VDP_ROWS * LITN ]
= IF DROP 0 THEN XYPOS !
;
: VDP$
9 0 DO _idat I 2 * + @ _ctl LOOP _blank
( palettes )
0xc000 _ctl
( BG ) 1 _zero 0x3f _data 14 _zero
( sprite, inverted colors ) 0x3f _data 15 _zero
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
0 0 1 _set
;

9
blk/628 Normal file
View File

@ -0,0 +1,9 @@
: VDP$
9 0 DO _idat I 2 * + @ _ctl LOOP _blank
( palettes )
0xc000 _ctl
( BG ) 1 _zero 0x3f _data 14 _zero
( sprite, inverted colors ) 0x3f _data 15 _zero
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
0 XYPOS !
;

Binary file not shown.

View File

@ -21,12 +21,12 @@ CURRENT @ XCURRENT !
282 LOAD ( boot.z80 )
393 LOAD ( xcomp core low )
CREATE ~FNT CPFNT7x7
623 627 LOADR ( VDP )
: (key) 0 ; : (emit) DROP ;
623 628 LOADR ( VDP )
: (key) 4 ;
420 LOAD ( xcomp core high )
(entry) _
( Update LATEST )
PC ORG @ 8 + !
," VDP$ BYE "
," VDP$ " EOT,
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!