Difference between revisions of "OSWORD &05"

From BeebWiki
Jump to: navigation, search
m (1 revision)
(Added implementation details and single-byte code.)
Line 1: Line 1:
 
[[Category:OSWORD]]
 
[[Category:OSWORD]]
 
OSWORD &05 (5) - Read I/O processor memory
 
OSWORD &05 (5) - Read I/O processor memory
Acorn MOS 1.20 and later
+
Acorn MOS 1.00 and later
  
 
  On entry:
 
  On entry:
Line 8: Line 8:
 
   XY?4=the byte read
 
   XY?4=the byte read
  
Some systems recognise screen memory at &FFFExxxx and sideways ROMs
+
Some systems recognise screen memory at &FFFExxxx and sideways ROMs at &FFrr8000-&FFrrBFFF.
at &FFFr8000-&FFFrBFFF.
 
  
 
==Coding==
 
==Coding==
Line 27: Line 26:
 
       io%=io%+1:mem%=mem%+1:num%=num%-1
 
       io%=io%+1:mem%=mem%+1:num%=num%-1
 
     UNTILnum%<1:ENDPROC
 
     UNTILnum%<1:ENDPROC
 +
 +
    REM To read a single byte:
 +
    !X%=addr:A%=5:CALL&FFF1:byte=X%?4
 +
    :
 +
    REM To write a single byte
 +
    X%?4=byte:!X%=addr:A%=6:CALL&FFF1
 +
 +
==Implementations==
 +
All 8-bit Acorn systems read from whichever ROM is paged in. All except the
 +
BBC B+ read from main memory. The B+ recognises &FFFExxxx to read from the
 +
shadow screen memory, otherwise it reads from main memory.
  
 
==See Also==
 
==See Also==
Line 34: Line 44:
  
 
[[User:Jgharston|Jgharston]] 23:56, 30 October 2011 (UTC)
 
[[User:Jgharston|Jgharston]] 23:56, 30 October 2011 (UTC)
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 04:27, 29 March 2015 (UTC)

Revision as of 05:27, 29 March 2015

OSWORD &05 (5) - Read I/O processor memory Acorn MOS 1.00 and later

On entry:
 XY!0=address to read from
On exit:
 XY?4=the byte read

Some systems recognise screen memory at &FFFExxxx and sideways ROMs at &FFrr8000-&FFrrBFFF.

Coding

The following routines can be used to copy data to and from I/O memory regardless of the location of the calling program. It requires X%=>5-byte control block, Y%=X%DIV256.

    DEFPROCmem_rd(io%,mem%,num%)
    A%=5:REPEAT
      !X%=io%:CALL&FFF1:?mem%=X%?4
      io%=io%+1:mem%=mem%+1:num%=num%-1
    UNTILnum%<1:ENDPROC
    :
    DEFPROCmem_wr(io%,mem%,num%)
    A%=6:REPEAT
      !X%=io%:X%?4=?mem%:CALL&FFF1
      io%=io%+1:mem%=mem%+1:num%=num%-1
    UNTILnum%<1:ENDPROC
    REM To read a single byte:
    !X%=addr:A%=5:CALL&FFF1:byte=X%?4
    :
    REM To write a single byte
    X%?4=byte:!X%=addr:A%=6:CALL&FFF1

Implementations

All 8-bit Acorn systems read from whichever ROM is paged in. All except the BBC B+ read from main memory. The B+ recognises &FFFExxxx to read from the shadow screen memory, otherwise it reads from main memory.

See Also

Jgharston 23:56, 30 October 2011 (UTC) Jgharston (talk) 04:27, 29 March 2015 (UTC)