home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
LOBE.src.sit
/
LOBE.src
/
resident.a
< prev
next >
Wrap
Text File
|
1994-12-13
|
3KB
|
149 lines
; Variables:
;
; Locked:
; 0 => not locked, we can execute the VBL
; !0 => we are locked, the cdev is messing with the variables, do nothing.
;
; Behavior:
; 0 => Do nothing
; 1 => Beep
; 2 => DebugStr
;
; Do4
; 0 => ignore 4
; !0 => manage 4 just like 0
;
; Snd
; Handle to locked sound resource.
;
include 'ToolEqu.a'
include 'SysEqu.a'
include 'QuickEqu.a'
include 'Traps.a'
DangerStr equ $50FF8001
a_BusDriver PROC EXPORT
EXPORT BusTask
EXPORT BusVars
EXPORT MyTag
; This is the real entry point. It jumps over the variables.
; It also has the 'CR91' tag so the cdev can find the vars by
; scanning all VBLS. Skanky, but it works.
bra.s VarSkip
STRING ASIS
MyTag dc.b 'CR91' ; tag so cdev can find me
BusVars
bv_Locked dc.w 0 ; default: not locked (running)
bv_Behavior dc.w $FFFF ; what to do when a write to 0/4 is detected
bv_Do4 dc.w $FFFF ; also do 4
bv_Snd dc.l $0 ; inited by InitToPrefs, not read from PREF resource
BusTask
ds.b 14 ; size of vbl task, block is inited by installer.
; a VBL task may trash a0-a3 and d0-d3
VarSkip
lea bv_Locked,a0 ; first, grasshopper, you must find thyself
tst.w (a0)
bne.s bvExit ; we're locked, do nothing
Chk0
move.l $0, d0 ; Get 0 value
lsl.l #1,d0 ; clear high bit to avoid ROM bug (faster than ANDI #$7FFFFFFF)
cmp.l #(DangerStr<<1),d0
beq.s Replace0 ; we're clear, go check 4 (replace 0 in case ROM bug set hi bit)
; At this point, we know 0 is screwed up. But what to do?
; Check the behavior variable, of course.
lea bv_Behavior, a0
move.w (a0), d0 ; Should set Z flag
beq.s Replace0 ; If zero, just restore bus error value
subq.w #1, d0 ; Should also set Z flag
beq.s bv_DebugStrGo0 ; behavior 1 == go
bv_DebugStrStop0
clr.l d0 ; point to 0
bsr.s WriteFailure
bra.s Replace0
bv_DebugStrGo0
bsr.s WriteFailureGo
Replace0
move.l #DangerStr, d0 ; restore danger value
move.l d0, $0
;
; Now check 4
;
Chk4
lea bv_Do4, a0 ; Check to see if we should bother
tst.w (a0)
beq.s bvExit ; Nope, just exit
move.l $4, d0 ; Get 4 value
lsl.l #1,d0 ; clear high bit to avoid ROM bug (faster than ANDI #$7FFFFFFF)
cmp.l #(DangerStr<<1),d0
beq.s Replace4 ; we're clear, get out
; At this point, we know 4 is screwed up. But what to do?
; Check the behavior variable, of course.
lea bv_Behavior, a0
move.w (a0), d0 ; Should set Z flag
beq.s Replace4 ; If zero, just restore bus error value
subq.w #1, d0 ; Should also set Z flag
beq.s bv_DebugStrGo4
bv_DebugStrStop4
moveq.l #4, d0 ; point to 0
bsr.s WriteFailure
bra.s Replace4
bv_DebugStrGo4
bsr.s WriteFailureGo
Replace4
move.l #DangerStr, d0 ; restore danger value
move.l d0, $4
bvExit
lea BusTask,a0 ; make sure we get called again later.
add.w #1,vblCount(a0)
rts
WriteFailure
pea FailString
_DebugStr
rts
WriteFailureGo
pea FailStringGo
_DebugStr
rts
FailString
align 2
STRING PASCAL
dc.b 'Write to 0 or 4 (d0 shows which)'
align 2
FailStringGo
align 2
STRING PASCAL
dc.b 'Write to 0 or 4; dm 0; g'
align 2
ENDP
a_BusDriverEnd PROC EXPORT ; dummy marker for install code
ENDP
END