Difference between revisions of "OSWORD &06"

From BeebWiki
Jump to: navigation, search
(Added implementation details and single-byte code.)
m (.)
Line 1: Line 1:
[[Category:OSWORD]]
+
[[Category:OSWORD]][[Category:Second Processors]]__NOTOC__
OSWORD &06 (6) - Write I/O processor memory
+
==OSWORD &06 (6) - Write I/O processor memory (Acorn MOS 1.00 and later)==
Acorn MOS 1.00 and later
 
  
On entry:
+
  On entry:
  XY!0=address to write to
+
    XY!0=address to write to
  XY?4=byte to be written.
+
    XY?4=byte to be written.
  
Some systems recognise screen memory at &FFFExxxx and sideways ROMs
+
Some systems recognise screen memory at &FFFExxxx and sideways ROMs at
at &FFrr8000-&FFrrBFFF.
+
&FFrr8000-&FFrrBFFF.
  
 
==Coding==
 
==Coding==
Line 15: Line 14:
 
<code>X%</code>=>5-byte control block, <code>Y%=X%DIV256</code>.
 
<code>X%</code>=>5-byte control block, <code>Y%=X%DIV256</code>.
  
    DEFPROCmem_rd(io%,mem%,num%)
+
  DEFPROCmem_rd(io%,mem%,num%)
    A%=5:REPEAT
+
  A%=5:REPEAT
      !X%=io%:CALL&FFF1:?mem%=X%?4
+
    !X%=io%:CALL&FFF1:?mem%=X%?4
      io%=io%+1:mem%=mem%+1:num%=num%-1
+
    io%=io%+1:mem%=mem%+1:num%=num%-1
    UNTILnum%<1:ENDPROC
+
  UNTILnum%<1:ENDPROC
    :
+
  :
    DEFPROCmem_wr(io%,mem%,num%)
+
  DEFPROCmem_wr(io%,mem%,num%)
    A%=6:REPEAT
+
  A%=6:REPEAT
      !X%=io%:X%?4=?mem%:CALL&FFF1
+
    !X%=io%:X%?4=?mem%:CALL&FFF1
      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:
+
  REM To read a single byte:
    !X%=addr:A%=5:CALL&FFF1:byte=X%?4
+
  !X%=addr:A%=5:CALL&FFF1:byte=X%?4
    :
+
  :
    REM To write a single byte
+
  REM To write a single byte
    X%?4=byte:!X%=addr:A%=6:CALL&FFF1
+
  X%?4=byte:!X%=addr:A%=6:CALL&FFF1
  
 
==Implementations==
 
==Implementations==
All 8-bit Acorn systems write to whichever ROM/RAM is paged in. All except the
+
All 8-bit Acorn systems write to whichever ROM/RAM is paged in. All except
BBC B+ write to main memory. The B+ recognises &FFFExxxx to write to the
+
the BBC B+ write to main memory. The B+ recognises &FFFExxxx to write to the
shadow screen memory, otherwise it writes to main memory.
+
shadow screen memory, otherwise it writes to main memory. It is possible to
 +
write a modified Tube Host that intercepts OSWORD 5 and 6 to access extended
 +
memory, but most programs rely on adding an extra OSWORD call.
  
 
==See Also==
 
==See Also==
 
* [[OSWORD &05]]
 
* [[OSWORD &05]]
 +
* [[OSWORD &FA]]
 +
* [[OSWORD &FF]]
 
* http://mdfs.net/Docs/Comp/BBC/Oswords
 
* http://mdfs.net/Docs/Comp/BBC/Oswords
 
* MemIO library at http://mdfs.net/blib
 
* MemIO library at http://mdfs.net/blib
 
[[User:Jgharston|Jgharston]] 23:54, 30 October 2011 (UTC)
 
[[User:Jgharston|Jgharston]] 23:54, 30 October 2011 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 04:28, 29 March 2015 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 04:28, 29 March 2015 (UTC)
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 00:04, 31 January 2016 (UTC)

Revision as of 01:04, 31 January 2016

OSWORD &06 (6) - Write I/O processor memory (Acorn MOS 1.00 and later)

 On entry:
   XY!0=address to write to
   XY?4=byte to be written.

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 write to whichever ROM/RAM is paged in. All except the BBC B+ write to main memory. The B+ recognises &FFFExxxx to write to the shadow screen memory, otherwise it writes to main memory. It is possible to write a modified Tube Host that intercepts OSWORD 5 and 6 to access extended memory, but most programs rely on adding an extra OSWORD call.

See Also

Jgharston 23:54, 30 October 2011 (UTC) Jgharston (talk) 04:28, 29 March 2015 (UTC) Jgharston (talk) 00:04, 31 January 2016 (UTC)