Atari ST series Technical Reference Manual page 113

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

GEMDOS Device I/O and Process Control
*** Program equates
conterm
* * $484
scr_dump = $502
*** Program starts here
.text
*** Branch to install code at end of program
start:
bra.w
init
*** The ID here lets us check to see if the resident program was
*** already installed once, so you don't try to do it again if the
*** program is run more than once.
ID:
.dc.b 'TOGGLE'
*** This code is executed only when Alternate-Help is pressed.
*** you're in supervisor mode here.
toggle:
d0-d7/a0-a7,-(a7)
movem.1
sr,-(a7)
move
ori.w
#$700,sr
|l,conterm
eori.b
keyclr:
-(37)
clr.w
#$B,-(a7)
move.w
#$D
trap
#4,a7
a d d g . 1
(a7)+,sr
move
movem.1
(a7)+,d0-d7/a0-a7
rts
**** Initialize and install routine— this is only done once
**** and then this code is thrown away
init:
*** Print sign-on message
pea
msgl
move.w
#$9,-(a7)
trap
#$1
addg.l
#6,a7
*** Switch to Supervisor mode to read protected memory
clr.l
-(a7)
move.w'
#$20,-(a7)
trap
#$1
addg.l
#6,a7
move.l
dO,oldstack
*** Check to see if this program has been installed once.
*** If it hasn't, install it.
move a .1
scr_dump,aO
subg.1
#6,a0
lea
ID,al
do
m o v e .w
#$5,
checkid:
cmpm.b
(a0)+,(al)+
bne.b
install
dbf
do,checkid
move.l
oldstack,-(a7)
move.w
#$20,~(a7)
trap
#$1
addg.1
#6,a7
* save registers
*
and status register
* bump the Interrupt Priority Level
* to 7 (so you don't get interrupted)
* bit 0 of conterm controls key click
* clear keyboard so you don't repeat
* clear all keyboard shift bits
* shift bits function
* call BIOS
*
clean stack
* restore status register
* restore rest of registers
* and end toggle routine
* push address of sign-on string
* Cconws
* call GEMDOS
* pop args from stack
* switch to super mode, same stack
* Super function
* call GEMDOS
* clean up stack
* save old stack address
If it has, end
* get screen dump vector
* move back 6 characters
* check to see if you're already installed
* 6 letters in ID
* compare ID to resident program
* if ID doesn't match, install toggle
* if it does match,
* push old stack address
* out of super mode
* call GEMDOS
* clean stack
...
105

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents