1. EMUL SCREEN

ards,
-- Jean.Hendrickx. j.hendrickx at infoboard.be
Hi all,
I have a try at emulating the Qbasic _function_ SCREEN()
This function determines what character, if any, is at any given
screen location and also determines the character's color
attributes.
    SCREEN(row, column [,optionflag])
where row is the screen row from 1-25, column position 1-80, and
optionflag is a numeric expression specifying which information
to return. When you omit optionflag, the function returns the
ASCII value corresponding to the character at the specified screen
position. If no character found, returns 32 (blank space). If
optionflag is present and evaluate a non zero value, SCREEN returns
the attribute (color) of the referenced character (integer
from 0-255). To decipher this information :
foreground color= attribute MOD 16
background color= (attribute AND &H70) \16
.
I used the bios service 10,8 to do that. but it don't work.
Here is the try :
--BEGIN CODE ----
-- SCREEN.EX simulation fonction SCREEN from Qbasic JCH 17/8/97
include machine.e
include graphics.e
include get.e
constant SCREEN=1
integer row, col, dum
atom key
sequence coord
object atrib
coord={} atrib={} key=-1
--
function Screen(integer row, integer col)
sequence inReg, outReg
inReg= repeat(0,10)
-- cursor at desired location (bios service 10,2)
inReg[REG_AX]=#0002    -- service 2
inReg[REG_DX]=row*#100 + col
inReg[REG_BX]=#0000  -- video page -------------
=remaind=5
-- get ASCII character code in AL and attribute byte in AH
-- bios service 10,8
inReg[REG_AX]=#0008    -- service 8
inReg[REG_BX]=#0000    -- video page
outReg=dos_interrupt(#10,inReg)
  return outReg --[REG_AX]
end function -- Screen
--
row=1 col=1
-- coord= Screen(row,col)    -- Control of service 10,2
--nrow= floor(coord[5]/256)
--ncol= remainder(coord[5],256)
--? nrow
--? ncol   -- OK
position(row, col) text_color(7) bk_color(1)
puts(SCREEN,"AAAAAAAAAAA")
while key=-1 do key=get_key()  end while
atrib=Screen(row,col)  -- return :  {0,0,0,0,257,0,32,12870,0,0}
dum=graphics_mode(-1)  --

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu