Difference between revisions of "OSBYTE &87"

From BeebWiki
Jump to: navigation, search
m (1 revision)
(Added code to read full shadow MODE number.)
Line 4: Line 4:
 
     On exit X=character at current cursor position (or 0 if unreadable)
 
     On exit X=character at current cursor position (or 0 if unreadable)
 
             Y=current mode number (shadow modes DO NOT return with bit 7 set)
 
             Y=current mode number (shadow modes DO NOT return with bit 7 set)
 +
 +
The returned value does not give the shadow MODE bit. The following code will
 +
return the full MODE number that can be used with the MODE command to re-select
 +
the same mode:
 +
 +
    mode%=(FNfx(&87,0)DIV256) OR ((FNfx(&75,0)AND&10)DIV32)
 +
    ...
 +
    DEFFNfx(A%,X%):LOCAL Y%:Y%=X%DIV256:=((USR&FFF4)AND&FFFF00)DIV256
 +
 +
    LDA #&75:JSR OSBYTE  :\ Read VDU status
 +
    TXA:AND #&10:CMP #&10 :\ Test shadow flag in bit 4
 +
    PHP                  :\ Save shadow flag in Carry
 +
    LDA #&87:JSR OSBYTE  :\ Read current MODE
 +
    TYA:ASL A:PLP:ROR A  :\ Move shadow flag into bit 7
  
 
==See Also==
 
==See Also==
Line 9: Line 23:
  
 
[[User:Jgharston|Jgharston]] 22:01, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] 22:01, 26 May 2009 (UTC)
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 08:08, 28 December 2016 (UTC)

Revision as of 09:08, 28 December 2016

OSBYTE &87 (135) - Character at text cursor and screen MODE. Called by BASIC's =MODE function.

   On exit X=character at current cursor position (or 0 if unreadable)
           Y=current mode number (shadow modes DO NOT return with bit 7 set)

The returned value does not give the shadow MODE bit. The following code will return the full MODE number that can be used with the MODE command to re-select the same mode:

   mode%=(FNfx(&87,0)DIV256) OR ((FNfx(&75,0)AND&10)DIV32)
   ...
   DEFFNfx(A%,X%):LOCAL Y%:Y%=X%DIV256:=((USR&FFF4)AND&FFFF00)DIV256
   LDA #&75:JSR OSBYTE   :\ Read VDU status
   TXA:AND #&10:CMP #&10 :\ Test shadow flag in bit 4
   PHP                   :\ Save shadow flag in Carry
   LDA #&87:JSR OSBYTE   :\ Read current MODE
   TYA:ASL A:PLP:ROR A   :\ Move shadow flag into bit 7

See Also

Jgharston 22:01, 26 May 2009 (UTC) Jgharston (talk) 08:08, 28 December 2016 (UTC)