2019-02-20 13:48:29 +01:00
|
|
|
# VGA Text Display
|
|
|
|
|
|
|
|
~~~
|
|
|
|
0xB8000 'VGA-BASE const
|
|
|
|
#80 'COLUMNS const
|
|
|
|
#25 'ROWS const
|
|
|
|
|
|
|
|
'vga:Row var
|
|
|
|
'vga:Column var
|
|
|
|
|
|
|
|
:vga:position (-a)
|
|
|
|
@vga:Row COLUMNS * #2 *
|
|
|
|
@vga:Column #2 * +
|
|
|
|
VGA-BASE + ;
|
|
|
|
|
2019-02-20 15:53:50 +01:00
|
|
|
:vga:update-cursor
|
2019-02-20 15:14:40 +01:00
|
|
|
@vga:Row COLUMNS * @vga:Column + dup
|
|
|
|
0x0F 0x3D4 pio:out-byte
|
|
|
|
0xFF and 0x3D5 pio:out-byte
|
|
|
|
0x0E 0x3D4 pio:out-byte
|
|
|
|
#8 shift 0xFF and 0x3D5 pio:out-byte ;
|
|
|
|
|
2019-02-20 15:53:50 +01:00
|
|
|
:vga:move-cursor (rc-)
|
|
|
|
!vga:Column !vga:Row vga:update-cursor ;
|
|
|
|
|
|
|
|
:wrap
|
|
|
|
@vga:Row ROWS gt? [ #0 !vga:Column #0 !vga:Row ] if vga:update-cursor ;
|
2019-02-20 14:34:18 +01:00
|
|
|
|
2019-02-20 13:48:29 +01:00
|
|
|
:vga:next
|
|
|
|
&vga:Column v:inc
|
|
|
|
@vga:Column COLUMNS gt? [ &vga:Row v:inc #0 !vga:Column ] if
|
2019-02-20 15:53:50 +01:00
|
|
|
@vga:Row ROWS gteq? [ #0 !vga:Row ] if vga:update-cursor ;
|
2019-02-20 13:48:29 +01:00
|
|
|
|
2019-02-20 14:34:18 +01:00
|
|
|
:putc (c-)
|
2019-02-20 15:53:50 +01:00
|
|
|
#10 [ #0 !vga:Column &vga:Row v:inc wrap ] case
|
|
|
|
#13 [ #0 !vga:Column &vga:Row v:inc wrap ] case
|
|
|
|
#8 [ &vga:Column v:dec #32 putc &vga:Column v:dec vga:update-cursor ] case
|
2019-02-20 14:34:18 +01:00
|
|
|
vga:position ram:store-byte vga:next ;
|
2019-02-20 15:14:40 +01:00
|
|
|
|
|
|
|
:clear (-)
|
|
|
|
VGA-BASE COLUMNS ROWS * [ ASCII:SPACE over ram:store-byte #2 + ] times drop
|
2019-02-20 15:53:50 +01:00
|
|
|
#0 !vga:Row #0 !vga:Column vga:update-cursor ;
|
2019-02-20 14:34:18 +01:00
|
|
|
|
2019-02-20 16:29:10 +01:00
|
|
|
:test #1793 &c:put #2 + store &putc &c:put #3 + store ;
|
2019-02-20 13:48:29 +01:00
|
|
|
~~~
|