1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 17:58:07 +11:00

sms: add cursor indicator to text mode

I do this by adding an inverted version of all glyphs in the upper
range of the pattern memory. This is a big waste of the pattern
space (only one inverted character is needed at once), but it's the
simplest way to proceed. I'll change this if I ever need more
pattern space.

Also, remove _blank. It was wastefully blanking the whole memory.
Only the name table needs to be blanked on initialization.
This commit is contained in:
Virgil Dupras 2020-11-16 11:11:30 -05:00
parent cf79ceefea
commit c8be290b88
3 changed files with 17 additions and 15 deletions

View File

@ -16,8 +16,6 @@ CREATE _idat
0b00000000 C, 0x89 C, ( BG Y scroll )
0b11111111 C, 0x8a C, ( Line counter (why have this?) )
( ----- 603 )
: _zero ( x -- send 0 _data x times )
( x ) 0 DO 0 _data LOOP ;
( Each row in ~FNT is a row of the glyph and there is 7 of
them. We insert a blank one at the end of those 7. For each
row we set, we need to send 3 zero-bytes because each pixel in
@ -37,7 +35,8 @@ always stay zero. )
( set palette bit for at specified pos )
2 * 1+ 0x7800 OR _ctl 0x8 _data ;
: VDP$
9 0 DO _idat I 2 * + @ _ctl LOOP _blank
9 0 DO _idat I 2 * + @ _ctl LOOP
( blank screen ) 0x7800 _ctl COLS LINES * 2 * _zero
( palettes )
0xc000 _ctl
( BG ) 1 _zero 0x3f _data 14 _zero

View File

@ -29,7 +29,7 @@ CURRENT @ XCURRENT !
283 335 LOADR ( boot.z80 )
353 LOAD ( xcomp core low )
CREATE ~FNT CPFNT5x7
470 472 LOADR ( VDP )
470 472 LOADR ( TMS9918 )
402 404 LOADR ( Grid )
625 626 LOADR ( SMS ports )
620 LOAD ( PAD ) : (ps2kc) (ps2kcA) ; 411 414 LOADR

25
blk.fs
View File

@ -2780,28 +2780,31 @@ CODE _data
A L LDrr, TMS_DATAPORT OUTiA,
;CODE
( ----- 471 )
CODE _blank ( this is way too slow in Forth )
A XORr, TMS_CTLPORT OUTiA,
A 0x40 LDri, TMS_CTLPORT OUTiA,
HL 0x4000 LDdi,
BEGIN,
A XORr, TMS_DATAPORT OUTiA,
HL DECd, HLZ,
JRNZ, AGAIN,
;CODE
( ----- 472 )
: _zero ( x -- send 0 _data x times )
( x ) 0 DO 0 _data LOOP ;
( Each row in ~FNT is a row of the glyph and there is 7 of
them. We insert a blank one at the end of those 7. )
: _sfont ( a -- Send font to TMS )
7 0 DO C@+ _data LOOP DROP
( blank row ) 0 _data ;
: _sfont^ ( a -- Send inverted font to TMS )
7 0 DO C@+ 0xff XOR _data LOOP DROP
( blank row ) 0xff _data ;
: CELL! ( c pos )
0x7800 OR _ctl ( tilenum )
0x20 - ( glyph ) 0x5e MOD _data ;
( ----- 472 )
: CURSOR! ( new old -- )
0x7800 OR DUP _ctl [ TMS_DATAPORT LITN ] PC@
0x7f AND ( new cmd glyph ) SWAP _ctl _data
0x7800 OR DUP _ctl [ TMS_DATAPORT LITN ] PC@
0x80 OR ( cmd glyph ) SWAP _ctl _data ;
: COLS 40 ; : LINES 24 ;
: TMS$
0x8100 _ctl ( blank screen ) _blank
0x8100 _ctl ( blank screen )
0x7800 _ctl COLS LINES * _zero
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
0x4400 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont^ LOOP
0x820e _ctl ( name table 0x3800 )
0x8400 _ctl ( pattern table 0x0000 )
0x87f0 _ctl ( colors 0 and 1 )