1. SCREEN
- Posted by Jean Hendrickx <jean.hendrickx at EURONET.BE> Aug 20, 1997
- 651 views
Hi all, Sorry for the precedent post it was a bit upseted. 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 : because a to long text it's attached file. The call of bios seems to clear the screen and nothing is found. am I missed something ? Any help should be hearty appreciated. Regards, -- Jean.Hendrickx. j.hendrickx at infoboard.be -- 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 -------------| outReg=dos_interrupt(#10,inReg)-- outReg={0,0,0,0,773,0,48,12870,0,0,0} -- | -- R=773:256=3 C=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 -- 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) -- | ? atrib -- " " -- END CODE ----
2. Re: SCREEN
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Aug 20, 1997
- 652 views
- Last edited Aug 21, 1997
Why don't you just read the video memory... it's either at at #B0000 or at #B800... Use the library function video_config to determine the current video mode (text or graphic) in qbasic it will equal the euphoria funtion get_pixel in graphics mode. Also you will then know its color mode (b&w or color) color modes are at #B800 and have two bytes (one with the color and one with character there). The black & white modes use #B0000 and only have one byte for each character. PS Hercules graphics mode isn't black & white, it's internally CGA (however this is not to the subject, it might avoid confusion) Ralf -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ~~~~>> Ralf Nieuwenhuijsen <<~~~~ ~~~>> nieuwen at xs4all.nl <<~~~~
3. Re: SCREEN
- Posted by Jacques Deschenes <desja at GLOBETROTTER.QC.CA> Aug 20, 1997
- 669 views
- Last edited Aug 21, 1997
At 18:40 20-08-97 +0100, you wrote: >---------------------- Information from the mail header ----------------------- >Sender: Euphoria Programming for MS-DOS <EUPHORIA at >MIAMIU.ACS.MUOHIO.EDU> >Poster: Jean Hendrickx <jean.hendrickx at EURONET.BE> >Organization: Infoboard Belgium >Subject: SCREEN >------------------------------------------------------------------------------- > >Hi all, >Sorry for the precedent post it was a bit upseted. >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 : because a to long text it's attached file. > The call of bios seems to clear the screen and nothing is found. >am I missed something ? Any help should be hearty appreciated. >Regards, >-- Jean.Hendrickx. j.hendrickx at infoboard.be >-- 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 -------------| >outReg=dos_interrupt(#10,inReg)-- outReg={0,0,0,0,773,0,48,12870,0,0,0} > -- | > -- R=773:256=3 C=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 >-- >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) -- | >? atrib -- " " >-- END CODE ---- > Hi Jean, the problem is that you're placing function code in AL instead of AH It should be: r[REG_AX] = #0200 -- function 2 AH = 2 r[REG_AX] = #0800 -- function 8 AH = 8 try this code ------ cut here ----------- include machine.e include image.e function screen(integer row, integer col, integer OptionFlag) sequence r, pos pos = get_position() position(row,col) r = repeat(0,10) r[REG_AX] = 8*#100 -- AH = 8 get character and attribute at cursor pos. r = dos_interrupt(#10,r) position(pos[1],pos[2]) if OptionFlag then return remainder(r[REG_AX],256) -- return AL = character else return floor(r[REG_AX]/256) -- return AH = attribute end if end function constant CHARACTER = 1, ATTRIBUTE = 0 text_color(BLUE) bk_color(YELLOW) puts(1,"Hello world\n") ? screen(1,1,CHARACTER) ? screen(1,1,ATTRIBUTE) --- code end ------------- Jacques Deschenes Baie-Comeau, Quebec Canada desja at globetrotter.qc.ca
4. Re: SCREEN
- Posted by Rod Damon <RodDamon at AOL.COM> Aug 22, 1997
- 655 views
I read the listserver everyday and have been noticing a lot of talk about QBASIC'S screen function. I'm a commercial programer using QBASIC and a few other languages and am now converted to EUPHORIA. The way I got around the SCREEN() function was thus screen_char is a single sequence containing the ASCI value in 1 and the ATTRIB in 2 Thus: if screen_char[1][1]='A' then do something end if Nothing much but I thought I"d comment. ROD DAMON
5. SCREEN
- Posted by Jean Hendrickx <jean.hendrickx at EURONET.BE> Aug 25, 1997
- 643 views
The 23 Aug 97 Jacques Deschenes wrote: . > Hi Jean, > the problem is that you're placing function code in AL instead of AH > It should be: > r[REG_AX] = #0200 -- function 2 AH = 2 > r[REG_AX] = #0800 -- function 8 AH = 8 > try this code --Snipped---- Hi Jacques, Thank's for your correcting of my code and for the improvement. Now i'll know where stands AL and AH in REG'S. -- Jean.Hendrickx. j.hendrickx at euronet.be
6. SCREEN
- Posted by Jean Hendrickx <jean.hendrickx at EURONET.BE> Aug 26, 1997
- 666 views
Hi All, Thanks for the help. I conclude that they are several ways to get a character and his attribute on a defined place of the screen. To sum up : -- 1x using peek in the video memory e.g. pos=(((row-1)*80)+col-1)*2 s=peek({#B8000+pos,2}) Cfr Reference Manual ----------- 2x using dos_interrupt rom bios service 08H See function screen from Jacques Deschenes (23 Aug 1997) ----------- 3x using save_text_image (Cfr Reference Manual) puts(1,"ASCII character: "& screen_char[1][1]&"\n") printf(1,"ATTRIBUTE: %d", screen_char[1][2]&"\n") ----------- Which one to prefer ? A matter of taste ? Regards, -- Jean Hendrickx. j.hendrickx at euronet.be
7. Re: SCREEN
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Aug 27, 1997
- 654 views
> 1x using peek in the video memory e.g. > pos=(((row-1)*80)+col-1)*2 > s=peek({#B8000+pos,2}) Cfr Reference Manual - > 2x using dos_interrupt rom bios service 08H > See function screen from Jacques Deschenes (23 Aug 1997) > 3x using save_text_image (Cfr Reference Manual) > screen_char=save_text_image({row,column},{row,column}) > Which one to prefer ? A matter of taste ? Certainly not! text_image is the most save method (i believe) and peek it from the memory is the fastest method There is reason for using interrupts... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ~~~~>> Ralf Nieuwenhuijsen <<~~~~ ~~~>> nieuwen at xs4all.nl <<~~~~