29.12.2012 Views

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

actual bank switching. As previously discussed, the contents of banks other than 0 are<br />

managed by the application - not the DOS. <strong>The</strong>refore, the application first needs a way of<br />

ascertaining the availability of any given bank. For instance, if an application wants <strong>to</strong><br />

reserve use of bank 1, it must first check if bank 1 is free <strong>to</strong> use. This is achieved by<br />

using function 2 as follows:<br />

LD C,1 ;Specify the bank #<br />

LD B,2 ;Ck BUR if bank-in-use<br />

LD A,@BANK ;Identify the SVC<br />

RST 40<br />

JR NZ,INUSE ;NZ if in use already<br />

Astute programmers will recognize that the first two instructions could be combined <strong>to</strong><br />

form one instruction as:<br />

LD BC,2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!