88 lines
1.6 KiB
Plaintext
Executable file
88 lines
1.6 KiB
Plaintext
Executable file
:asm textmode
|
|
MOV AX 0x03 #
|
|
INT 0x10 #
|
|
NEXT
|
|
|
|
0 var, textpageid
|
|
0 var, textpage
|
|
|
|
: page! dup textpageid ! 12 << textpage ! ;
|
|
|
|
:asm showpage
|
|
POP AX
|
|
MOV AH 0x05 #
|
|
INT 0x10 #
|
|
NEXT
|
|
|
|
:asm movecursor ( xy -- )
|
|
MOV BH textpageid @+
|
|
MOV AH 0x02 #
|
|
POP DX
|
|
INT 0x10 #
|
|
NEXT
|
|
|
|
:asm cursorshape! ( shape -- )
|
|
POP CX
|
|
MOV AH 0x01 #
|
|
INT 0x10 #
|
|
NEXT
|
|
|
|
: 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
|
|
|
|
: fg! textpen @ 0xf0 & | textpen ! ;
|
|
: bg! 4 << textpen @ 0x0f & | textpen ! ;
|
|
|
|
80 const pagew
|
|
25 const pageh
|
|
|
|
0xb800 const TEXTMEM
|
|
|
|
} : PREP-TEXTCOPY
|
|
MOV ES t& TEXTMEM @+
|
|
MOV AH textpen @+
|
|
MOV DI textpage @+ ; {
|
|
|
|
:asm fill-page ( char -- )
|
|
INT 3 #
|
|
POP AX
|
|
PREP-TEXTCOPY
|
|
MOV CX pagew pageh * #
|
|
REPZ STOSW
|
|
NEXT
|
|
|
|
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 ! ;
|
|
|
|
} : PREP-TEXTCOPY-XY
|
|
PREP-TEXTCOPY
|
|
ADD DI textpos @+ ; {
|
|
|
|
:asm draw-text ( s -- )
|
|
MOV BX SI
|
|
POP SI
|
|
PREP-TEXTCOPY-XY
|
|
0 :>
|
|
LODSB
|
|
OR AL AL
|
|
JZ 0 @>
|
|
STOSW
|
|
JMP 0 <@
|
|
0 <:
|
|
SUB DI textpage @+
|
|
MOV textpos @+ DI
|
|
MOV SI BX
|
|
NEXT
|
|
|