Skip to content

Commit e9f00fa

Browse files
committed
add atinit code.
1 parent 524fa1a commit e9f00fa

File tree

2 files changed

+120
-3
lines changed

2 files changed

+120
-3
lines changed

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ASMFLAGS=-case on -l
66
LDFLAGS=
77

88

9-
all : host.driver boot.driver host.fst boot.sys
9+
all : host.driver boot.driver host.fst boot.sys atinit
1010

1111
host.fst : host.fst.o
1212
$(LD) -t \$$BD -at \$$0000 $< -o $@
@@ -34,12 +34,23 @@ boot: boot.o
3434
$(LD) $< -o $@
3535

3636
boot.sys: boot
37-
mpw makebiniigs -p $< -o $@ -t \$$FF
37+
mpw makebiniigs -p -s -t \$$FF $< -o $@
38+
39+
40+
atinit: atinit.omf
41+
mpw makebiniigs -p -s -t \$$e2 $< -o $@
42+
43+
44+
atinit.omf: atinit.o
45+
$(LD) -x $^ -o $@
46+
3847

3948
.PHONY : clean
4049
clean :
41-
$(RM) -- host.fst host.driver boot.driver boot.sys boot *.o
50+
$(RM) -- host.fst host.driver boot.driver boot.sys boot atinit atinit.omf *.o
4251

4352
%.o : %.aii
4453
$(ASM) $(ASMFLAGS) $< -o $@
4554

55+
56+

atinit.aii

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

0 commit comments

Comments
 (0)