diff --git a/Makefile b/Makefile index 48e1b9a..2d5aa98 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ ASMFLAGS=-case on -l LDFLAGS= -all : host.driver boot.driver host.fst boot.sys +all : host.driver boot.driver host.fst boot.sys atinit host.fst : host.fst.o $(LD) -t \$$BD -at \$$0000 $< -o $@ @@ -34,12 +34,23 @@ boot: boot.o $(LD) $< -o $@ boot.sys: boot - mpw makebiniigs -p $< -o $@ -t \$$FF + mpw makebiniigs -p -s -t \$$FF $< -o $@ + + +atinit: atinit.omf + mpw makebiniigs -p -s -t \$$e2 $< -o $@ + + +atinit.omf: atinit.o + $(LD) -x $^ -o $@ + .PHONY : clean clean : - $(RM) -- host.fst host.driver boot.driver boot.sys boot *.o + $(RM) -- host.fst host.driver boot.driver boot.sys boot atinit atinit.omf *.o %.o : %.aii $(ASM) $(ASMFLAGS) $< -o $@ + + diff --git a/atinit.aii b/atinit.aii new file mode 100644 index 0000000..006a59c --- /dev/null +++ b/atinit.aii @@ -0,0 +1,106 @@ + + +CheckMach equ $fe1f ;Monitor Routine to check machine type +mli equ $bf00 +KVersion equ $bfff + +head_call equ $fb +tail_call equ $fc + +;code equ $d7a9 ; end of IIgs clock driver. +code equ $c0f0 ; slot 7 devsel. + + + 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 #>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 + +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)>22 then + aerror 'stub code overflow' + endif + + endp + + + end