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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Note: @EXIT in SYS1 au<strong>to</strong>matically res<strong>to</strong>res BREAK <strong>to</strong> the system handler. This is<br />

not done for @CMNDR. Also, don't forget that if DEBUG is enabled, then entry <strong>to</strong><br />

DEBUG takes precedence over the BREAK (of course, even though DEBUG has been<br />

enabled, if you only have EXEC access, DEBUG is effectively disabled).<br />

Your break handling routine will need <strong>to</strong> debounce the BREAK key and obviously deal<br />

with the stack pointer (since the stack could be anywhere depending on when and<br />

where the break was detected). Something of the following is suitable:<br />

ENTRY LD (STKSAV),SP ;Save the stack pointer<br />

PUSH HL<br />

LD HL,MYBRK ;Point <strong>to</strong> your BREAK handler<br />

@@BREAK ;Set up "MYBRK" as break entry<br />

.<br />

.<br />

MYBRK DI ;Don't permit further BREAKs<br />

LD B,80H ;Wait for fingers <strong>to</strong> get off<br />

@@PAUSE ; of the BREAK key<br />

LD SP,$-$ ;P/u the orig stack pointer<br />

STKSAV EQU $-2<br />

EI ;Interrupts back on<br />

what ever you want<br />

RET ;To what invoked the program<br />

7.6.6 @CHNIO SVC-20<br />

This SVC is used <strong>to</strong> pass control <strong>to</strong> the next module in a device chain. Its use is<br />

restricted <strong>to</strong> device filters. Detailed information on the use of @CHNIO will be found in<br />

chapter 3, DEVICE INPUT/OUTPUT INTERFACING.<br />

Registers Affected: Depends on the filter modules chained.<br />

Entry:<br />

IX Contains a pointer <strong>to</strong> the Device Control Block assigned <strong>to</strong> the filter<br />

module. This is recovered from the MODDCB field located in the module<br />

header. Note: IX should be saved before loading and res<strong>to</strong>red upon return<br />

from @CHNIO.<br />

B Contains the I/O direction code (GET=1, PUT=2, CTL=4).<br />

C Contains the output character for PUT or GET.<br />

7.6.7 @CKBRKC SVC-106<br />

This SVC was installed effective release 6.2.0. It checks <strong>to</strong> see if the BREAK key has<br />

been pressed. It also clears the BREAK bit of the KFLAG$ if a break condition is<br />

detected.<br />

Registers Affected: AF.<br />

Exit:<br />

Z BREAK was not detected.<br />

NZ BREAK was detected. SVC returns only when BREAK is released.<br />

7-12

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

Saved successfully!

Ooh no, something went wrong!