grid: change the meaning of CELL!
Replace the "g" arg (glyph) with "c" (character). The reason why "g" was used was to save a "0x20 -" operation at all CELL! implementations, but this came with too big a drawback: it made CELL! hardly usable outside of the Grid subsystem, mostly because the user of CELL! would often have to do "0x20 -". For example, I want the SMS's Pad driver to use CELL! directly instead of having to do EMIT+XYPOS-messing-around. I would have had to do a "0x20 -" there.
This commit is contained in:
parent
7bfec5d9e9
commit
b1e162b8a3
@ -15,7 +15,7 @@ $(SMSROM):
|
|||||||
$(BLKPACK):
|
$(BLKPACK):
|
||||||
$(MAKE) -C ../tools
|
$(MAKE) -C ../tools
|
||||||
|
|
||||||
blkfs: $(BLKPACK)
|
blkfs: $(BLKPACK) $(BASE)/blk.fs blk.fs
|
||||||
cat $(BASE)/blk.fs blk.fs | $(BLKPACK) > $@
|
cat $(BASE)/blk.fs blk.fs | $(BLKPACK) > $@
|
||||||
|
|
||||||
$(STAGE):
|
$(STAGE):
|
||||||
|
@ -27,9 +27,9 @@ always stay zero. )
|
|||||||
: _sfont ( a -- Send font to VDP )
|
: _sfont ( a -- Send font to VDP )
|
||||||
7 0 DO C@+ _data 3 _zero LOOP DROP
|
7 0 DO C@+ _data 3 _zero LOOP DROP
|
||||||
( blank row ) 4 _zero ;
|
( blank row ) 4 _zero ;
|
||||||
: CELL! ( tilenum pos )
|
: CELL! ( c pos )
|
||||||
2 * 0x7800 OR _ctl ( tilenum )
|
2 * 0x7800 OR _ctl ( c )
|
||||||
0x5e MOD _data 1 _zero ;
|
0x20 - ( glyph ) 0x5e MOD _data 0 _data ;
|
||||||
( ----- 604 )
|
( ----- 604 )
|
||||||
: VDP$
|
: VDP$
|
||||||
9 0 DO _idat I 2 * + @ _ctl LOOP _blank
|
9 0 DO _idat I 2 * + @ _ctl LOOP _blank
|
||||||
|
@ -15,7 +15,7 @@ $(TARGET): xcomp.fs $(STAGE) blkfs
|
|||||||
$(BLKPACK):
|
$(BLKPACK):
|
||||||
$(MAKE) -C ../tools
|
$(MAKE) -C ../tools
|
||||||
|
|
||||||
blkfs: $(BLKPACK)
|
blkfs: $(BLKPACK) $(BASE)/blk.fs blk.fs
|
||||||
cat $(BASE)/blk.fs blk.fs | $(BLKPACK) > $@
|
cat $(BASE)/blk.fs blk.fs | $(BLKPACK) > $@
|
||||||
|
|
||||||
$(STAGE):
|
$(STAGE):
|
||||||
|
@ -110,9 +110,9 @@ CODE _wait
|
|||||||
( ----- 609 )
|
( ----- 609 )
|
||||||
: _atrow! ( pos -- ) COLS / FNTH 1+ * _row! ;
|
: _atrow! ( pos -- ) COLS / FNTH 1+ * _row! ;
|
||||||
: _tocol ( pos -- col off ) COLS MOD FNTW 1+ * 8 /MOD ;
|
: _tocol ( pos -- col off ) COLS MOD FNTW 1+ * 8 /MOD ;
|
||||||
: CELL! ( g pos -- )
|
: CELL! ( c pos -- )
|
||||||
DUP _atrow! DUP _tocol _col! ROT ( pos coff g )
|
DUP _atrow! DUP _tocol _col! ROT ( pos coff c )
|
||||||
FNTH * ~FNT + ( pos coff a )
|
0x20 - FNTH * ~FNT + ( pos coff a )
|
||||||
_xinc _data@ DROP
|
_xinc _data@ DROP
|
||||||
FNTH 0 DO ( pos coff a )
|
FNTH 0 DO ( pos coff a )
|
||||||
C@+ 2 PICK 8 -^ LSHIFT
|
C@+ 2 PICK 8 -^ LSHIFT
|
||||||
|
10
blk.fs
10
blk.fs
@ -2218,7 +2218,7 @@ Load range: B402-B403
|
|||||||
: XYPOS! COLS LINES * MOD DUP CURSOR! XYPOS ! ;
|
: XYPOS! COLS LINES * MOD DUP CURSOR! XYPOS ! ;
|
||||||
: AT-XY ( x y -- ) COLS * + XYPOS! ;
|
: AT-XY ( x y -- ) COLS * + XYPOS! ;
|
||||||
'? NEWLN NIP NOT [IF]
|
'? NEWLN NIP NOT [IF]
|
||||||
: NEWLN ( ln -- ) COLS * DUP COLS + SWAP DO 0 I CELL! LOOP ;
|
: NEWLN ( ln -- ) COLS * DUP COLS + SWAP DO 0x20 I CELL! LOOP ;
|
||||||
[THEN]
|
[THEN]
|
||||||
: _lf XYMODE C@ IF EXIT THEN
|
: _lf XYMODE C@ IF EXIT THEN
|
||||||
XYPOS @ COLS / 1+ LINES MOD DUP NEWLN
|
XYPOS @ COLS / 1+ LINES MOD DUP NEWLN
|
||||||
@ -2228,7 +2228,7 @@ Load range: B402-B403
|
|||||||
: (emit)
|
: (emit)
|
||||||
DUP 0x08 = IF DROP _bs EXIT THEN
|
DUP 0x08 = IF DROP _bs EXIT THEN
|
||||||
DUP 0x0d = IF DROP _lf EXIT THEN
|
DUP 0x0d = IF DROP _lf EXIT THEN
|
||||||
0x20 - DUP 0< IF DROP EXIT THEN
|
DUP 0x20 < IF DROP EXIT THEN
|
||||||
XYPOS @ CELL!
|
XYPOS @ CELL!
|
||||||
XYPOS @ 1+ DUP COLS MOD IF XYPOS! ELSE _lf THEN ;
|
XYPOS @ 1+ DUP COLS MOD IF XYPOS! ELSE _lf THEN ;
|
||||||
: GRID$ 0 XYPOS! 0 XYMODE C! ;
|
: GRID$ 0 XYPOS! 0 XYMODE C! ;
|
||||||
@ -2795,15 +2795,15 @@ them. We insert a blank one at the end of those 7. )
|
|||||||
: _sfont ( a -- Send font to TMS )
|
: _sfont ( a -- Send font to TMS )
|
||||||
7 0 DO C@+ _data LOOP DROP
|
7 0 DO C@+ _data LOOP DROP
|
||||||
( blank row ) 0 _data ;
|
( blank row ) 0 _data ;
|
||||||
: CELL! ( tilenum pos )
|
: CELL! ( c pos )
|
||||||
0x7800 OR _ctl ( tilenum )
|
0x7800 OR _ctl ( tilenum )
|
||||||
0x5e MOD _data ;
|
0x20 - ( glyph ) 0x5e MOD _data ;
|
||||||
: COLS 40 ; : LINES 24 ;
|
: COLS 40 ; : LINES 24 ;
|
||||||
: TMS$
|
: TMS$
|
||||||
0x8100 _ctl ( blank screen ) _blank
|
0x8100 _ctl ( blank screen ) _blank
|
||||||
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
|
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
|
||||||
0x820e _ctl ( name table 0x3800 )
|
0x820e _ctl ( name table 0x3800 )
|
||||||
0x8400 _ctl ( patter table 0x0000 )
|
0x8400 _ctl ( pattern table 0x0000 )
|
||||||
0x87f0 _ctl ( colors 0 and 1 )
|
0x87f0 _ctl ( colors 0 and 1 )
|
||||||
0x8000 _ctl 0x81d0 _ctl ( text mode, display on ) ;
|
0x8000 _ctl 0x81d0 _ctl ( text mode, display on ) ;
|
||||||
( ----- 520 )
|
( ----- 520 )
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
: COLS 80 ; : LINES 32 ;
|
: COLS 80 ; : LINES 32 ;
|
||||||
: CURSOR! ( pos -- ) COLS /MOD 6 PC! ( y ) 5 PC! ( x ) ;
|
: CURSOR! ( pos -- ) COLS /MOD 6 PC! ( y ) 5 PC! ( x ) ;
|
||||||
: CELL! ( g pos -- ) CURSOR! 0x20 + 0 PC! ;
|
: CELL! ( c pos -- ) CURSOR! 0 PC! ;
|
||||||
: NEWLN ( ln -- ) DROP 0xa 0 PC! ;
|
: NEWLN ( ln -- ) DROP 0xa 0 PC! ;
|
||||||
|
|
||||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||||
|
@ -44,7 +44,7 @@ allows random access to it.
|
|||||||
|
|
||||||
COLS -- n Number of columns in the device
|
COLS -- n Number of columns in the device
|
||||||
LINES -- n Number of lines in the device
|
LINES -- n Number of lines in the device
|
||||||
CELL! g pos -- Set glyph at pos
|
CELL! c pos -- Set character at pos
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
NEWLN ln -- "Enter" line ln
|
NEWLN ln -- "Enter" line ln
|
||||||
@ -53,10 +53,10 @@ CURSOR! pos -- Set cursor's position
|
|||||||
"pos" is a simple number (y * cols) + x. For example, if we
|
"pos" is a simple number (y * cols) + x. For example, if we
|
||||||
have 40 columns per line, the position (x, y) (12, 10) is 412.
|
have 40 columns per line, the position (x, y) (12, 10) is 412.
|
||||||
|
|
||||||
A glyph is ASCII-0x20. If the resulting glyph number exceeds the
|
CELL! is not expected to be called with an out-of-range char-
|
||||||
number of glyphs in the font, it's up to CELL! to ignore it.
|
acter. For example, glyphs are often mapped starting at 0x20
|
||||||
|
(space). On most systems, CELL! should not be called with c <
|
||||||
Glyph 0 is always blank.
|
0x20.If it is, CELL! should do nothing.
|
||||||
|
|
||||||
NEWLN is called when we "enter" a new line, that is, when we
|
NEWLN is called when we "enter" a new line, that is, when we
|
||||||
overflow from previous line or when 0x0d ( ASCII CR ) is emit-
|
overflow from previous line or when 0x0d ( ASCII CR ) is emit-
|
||||||
|
Loading…
Reference in New Issue
Block a user