Re: mode 18 text writing
I've figured the my text writing function for mode 18 out. Turns out it's
embarassingly easy: just write out a bunch of blocks (ASCII 219) to the
screen first, and then OR the text.
Here's the code, if anyone cares. The same call is used three times; I only
change the color used, and the OR flag:
-- CODE STARTS HERE
include graphics.e
include machine.e
include get.e
procedure display( integer row, integer col,
integer fColor, integer bColor, sequence text )
integer len
sequence inReg, outReg
object lowMem
len = length( text )
lowMem = allocate_low( len ) -- get memory
inReg = repeat( 0, 10 ) -- initialize register list
-- first, write a string of solid blocks.
-- this could just as well be done with a puts()
poke( lowMem, repeat( 219, len ) ) -- solid blocks
inReg[REG_AX] = #1301 -- tty string write
inReg[REG_BX] = fColor -- video page/color
inReg[REG_CX] = len -- number of characters to print
inReg[REG_DX] = row*#100+col -- position of cursor
inReg[REG_ES] = floor(lowMem / 16) -- segment of text string
inReg[REG_BP] = remainder(lowMem, 16) -- offset of text string
outReg = dos_interrupt( #10, inReg ) -- bios call
-- OR the string to the background color, leaving a black mask
poke( lowMem, text )
inReg[REG_BX] = #F0 + bColor -- video page/color
outReg = dos_interrupt( #10, inReg ) -- bios call
-- OR the string to the mask, leaving the foreground color
poke( lowMem, text )
inReg[REG_BX] = #F0 + fColor -- video page/color
outReg = dos_interrupt( #10, inReg ) -- bios call
free_low( lowMem ) -- free the memory
end procedure
integer result
result = graphics_mode( 18 )
display( 1, 1, WHITE, GREEN, "Hi there" )
display( 2, 1, BLUE, CYAN, "Hi there" )
result = wait_key()
result = graphics_mode( 1 )
-- CODE ENDS HERE
Thanks for thinking about it.
-- David Cuny
|
Not Categorized, Please Help
|
|