2023-09-17 02:45:42 +00:00
|
|
|
:asm textmode
|
2023-09-15 20:10:24 +00:00
|
|
|
MOV AX 0x03 #
|
|
|
|
INT 0x10 #
|
|
|
|
NEXT
|
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
0 var, textpageid
|
|
|
|
0 var, textpage
|
2023-09-15 20:10:24 +00:00
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
: page! dup textpageid ! 12 << textpage ! ;
|
|
|
|
|
|
|
|
:asm showpage
|
2023-09-15 20:10:24 +00:00
|
|
|
POP AX
|
|
|
|
MOV AH 0x05 #
|
|
|
|
INT 0x10 #
|
|
|
|
NEXT
|
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
:asm movecursor ( xy -- )
|
2023-09-15 20:10:24 +00:00
|
|
|
MOV BH textpageid @+
|
|
|
|
MOV AH 0x02 #
|
|
|
|
POP DX
|
|
|
|
INT 0x10 #
|
|
|
|
NEXT
|
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
:asm cursorshape! ( shape -- )
|
2023-09-15 20:10:24 +00:00
|
|
|
POP CX
|
|
|
|
MOV AH 0x01 #
|
|
|
|
INT 0x10 #
|
|
|
|
NEXT
|
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
: hidecursor 0x2607 cursorshape! ;
|
|
|
|
: showcursor 0x0607 cursorshape! ;
|
|
|
|
|
|
|
|
0x0f var, textpen
|
|
|
|
|
|
|
|
0 const black 1 const blue 2 const green 3 const cyan
|
|
|
|
4 const red 5 const magenta 6 const brown 7 const lgray
|
|
|
|
8 const gray 9 const lblue 10 const lgreen 11 const lcyan
|
|
|
|
12 const lred 13 const lmagenta 14 const yellow 15 const white
|
2023-09-15 20:10:24 +00:00
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
: fg! textpen @ 0xf0 & | textpen ! ;
|
|
|
|
: bg! 4 << textpen @ 0x0f & | textpen ! ;
|
2023-09-13 03:27:46 +00:00
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
80 const pagew
|
|
|
|
25 const pageh
|
2023-09-13 03:27:46 +00:00
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
0xb800 const TEXTMEM
|
|
|
|
|
|
|
|
} : PREP-TEXTCOPY
|
2023-09-13 03:27:46 +00:00
|
|
|
MOV ES t& TEXTMEM @+
|
|
|
|
MOV AH textpen @+
|
2023-09-17 02:45:42 +00:00
|
|
|
MOV DI textpage @+ ; {
|
2023-09-13 03:27:46 +00:00
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
:asm fill-page ( char -- )
|
2023-09-15 20:10:24 +00:00
|
|
|
INT 3 #
|
2023-09-13 03:27:46 +00:00
|
|
|
POP AX
|
|
|
|
PREP-TEXTCOPY
|
|
|
|
MOV CX pagew pageh * #
|
|
|
|
REPZ STOSW
|
|
|
|
NEXT
|
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
0 var, textpos
|
|
|
|
: textx textpos @ 1 >> pagew % ;
|
|
|
|
: texty textpos @ 1 >> pagew / ;
|
|
|
|
: textx! 1 << texty pagew 1 << * + textpos ! ;
|
|
|
|
: texty! pagew 1 << * textx 1 << + textpos ! ;
|
|
|
|
: nextline texty 1+ pagew 1 << * textpos ! ;
|
2023-09-13 03:27:46 +00:00
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
} : PREP-TEXTCOPY-XY
|
|
|
|
PREP-TEXTCOPY
|
|
|
|
ADD DI textpos @+ ; {
|
2023-09-13 03:27:46 +00:00
|
|
|
|
2023-09-17 02:45:42 +00:00
|
|
|
:asm draw-text ( s -- )
|
2023-09-13 03:27:46 +00:00
|
|
|
MOV BX SI
|
|
|
|
POP SI
|
|
|
|
PREP-TEXTCOPY-XY
|
2023-09-17 02:45:42 +00:00
|
|
|
0 :>
|
2023-09-13 03:27:46 +00:00
|
|
|
LODSB
|
|
|
|
OR AL AL
|
|
|
|
JZ 0 @>
|
|
|
|
STOSW
|
2023-09-17 02:45:42 +00:00
|
|
|
JMP 0 <@
|
2023-09-13 03:27:46 +00:00
|
|
|
0 <:
|
|
|
|
SUB DI textpage @+
|
|
|
|
MOV textpos @+ DI
|
|
|
|
MOV SI BX
|
|
|
|
NEXT
|
2023-09-17 02:45:42 +00:00
|
|
|
|