1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-30 20:08: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

@ -7,6 +7,8 @@ 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. 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 NOT f -- f Push the logical opposite of f

View File

@ -1,6 +1,6 @@
RAMSTART FUTURE USES +3c BLK(* RAMSTART FUTURE USES +3c BLK(*
+02 CURRENT +3e FUTURE USES +02 CURRENT +3e XYPOS
+04 HERE +04 HERE +40 FUTURE USES
+06 C<? +51 CURRENTPTR +06 C<? +51 CURRENTPTR
+08 C<* override +53 (emit) override +08 C<* override +53 (emit) override
+0a NLPTR +55 (key) 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 BOOT C< PTR is used when Forth boots from in-memory
source. See "Initialization sequence" below. 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+ ; : HERE 0x04 RAM+ ;
: CURRENT* 0x51 RAM+ ; : CURRENT* 0x51 RAM+ ;
: CURRENT CURRENT* @ ; : CURRENT CURRENT* @ ;
: XYPOS 0x40 RAM+ ;
( w -- a f ) ( w -- a f )
: (find) CURRENT @ SWAP _find ; : (find) CURRENT @ SWAP _find ;

17
blk/394
View File

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

18
blk/627
View File

@ -1,14 +1,6 @@
: _set ( row col tilenum -- ) : (emit)
ROT 5 LSHIFT ROT OR 0x7800 OR _ctl XYPOS @ 2 * 0x7800 OR _ctl
_data 1 _zero 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 ) 282 LOAD ( boot.z80 )
393 LOAD ( xcomp core low ) 393 LOAD ( xcomp core low )
CREATE ~FNT CPFNT7x7 CREATE ~FNT CPFNT7x7
623 627 LOADR ( VDP ) 623 628 LOADR ( VDP )
: (key) 0 ; : (emit) DROP ; : (key) 4 ;
420 LOAD ( xcomp core high ) 420 LOAD ( xcomp core high )
(entry) _ (entry) _
( Update LATEST ) ( Update LATEST )
PC ORG @ 8 + ! PC ORG @ 8 + !
," VDP$ BYE " ," VDP$ " EOT,
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC! ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!