diff --git a/arch/z80/sms/blk.fs b/arch/z80/sms/blk.fs index b1412a5..cf902f6 100644 --- a/arch/z80/sms/blk.fs +++ b/arch/z80/sms/blk.fs @@ -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 diff --git a/arch/z80/sms/xcomptextmode.fs b/arch/z80/sms/xcomptextmode.fs index 46230fe..ecbacd3 100644 --- a/arch/z80/sms/xcomptextmode.fs +++ b/arch/z80/sms/xcomptextmode.fs @@ -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 diff --git a/blk.fs b/blk.fs index 5fb8f97..da50eba 100644 --- a/blk.fs +++ b/blk.fs @@ -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 )