-
Notifications
You must be signed in to change notification settings - Fork 2
/
atinit.aii
110 lines (84 loc) · 1.43 KB
/
atinit.aii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
CheckMach equ $fe1f ;Monitor Routine to check machine type
mli equ $bf00
KVersion equ $bfff
head_call equ $fc
tail_call equ $fd
;code equ $d7a9 ; end of IIgs clock driver.
code equ $c0f0 ; slot 7 devsel.
;
; n.b. - IIgs clock driver is in the language card RAM so it can't be
; used for
;
macro
&lab wdm &arg
&lab dc.b $42, &arg
endm
Macro
_ON_LINE ¶ms
jsr $BF00
dc.b $C5
dc.w ¶ms
MEnd
MACHINE M65C02
LONGA OFF
LONGI OFF
main proc ORG $2000
lda $c061 ; check open apple button
bmi exit
lda KVersion
cmp #24 ; check for ProDOS 2.4+
blt exit
sec
jsr CheckMach
bcs exit
sei
lda mli+1
sta pro_ent+1
sta mli_address
lda mli+2
sta pro_ent+2
sta mli_address+1
jsr fakemli
dc.b $99
dc.w dcb
ldx #stub_end-stub_begin
@loop
lda stub_begin,x
sta code,x
dex
bpl @loop
lda #<code
sta mli+1
lda #code>>8
sta mli+2
exit
cli
clc
rts
dcb dc.b 4 ; pcount
dc.b 1 ; version
mli_address dc.w $0000 ; mli address
dc.w code+dcb_ent-stub_begin ; patch address
mli_slot dc.b $80 ; ProDOS slot to use.
fakemli
sec
wdm head_call
; if this drops through, no gs+ support.
pla
bra exit
;
; this code is relocated to $d7a9, after the IIgs clock driver.
;
stub_begin
wdm head_call
pro_ent jsr $0000
dcb_ent dc.b $0
dc.w $0000
wdm tail_call
rts
stub_end
if (stub_end-stub_begin)>16 then
aerror 'stub code overflow'
endif
endp
end