EasyManua.ls Logo

Atari ST series - Page 113

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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:
movem.1
move
ori.w
eori.b
keyclr:
clr.w
move.w
trap
addg. 1
move
movem.1
rts
d0-d7/a0-a7,-(a7)
sr,-(a7)
#$700,sr
* save registers
* and status register
* bump the Interrupt Priority Level
* to 7 (so you don't get interrupted)
|l,conterm * 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
-(37)
#$B,-(a7)
#$D
#4,a7
(a7)+,sr
(a7)+,d0-d7/a0-a7
* restore status register
* restore rest of registers
* and end toggle routine
**** 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
* push address of sign-on string
* Cconws
* call GEMDOS
* pop args from stack
*** 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
* switch to super mode, same stack
* Super function
* call GEMDOS
* clean up stack
* save old stack address
*** Check to see if this program has been installed once.
*** If it hasn't, install it. If it has, end
movea.1
subg.1
lea
move.w
checkid:
cmpm.b
bne.b
dbf
move.l
move.w
trap
addg.1
scr_dump,aO * get screen dump vector
#6,a0 * move back 6 characters
ID,al * check to see if you're already installed
#$5,do * 6 letters in ID
(a0)+,(al)+ * compare ID to resident program
install * if ID doesn't match, install toggle
do,checkid * if it does match, ...
oldstack,-(a7) * push old stack address
#$20,~(a7) * out of super mode
#$1 * call GEMDOS
#6,a7 * clean stack
105

Related product manuals