-
Notifications
You must be signed in to change notification settings - Fork 1
/
booter.asm
88 lines (71 loc) · 1.44 KB
/
booter.asm
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
MODULE booter
PUBLIC PATCH
PUBLIC PATCH2
PUBLIC PATCH3
PUBLIC PATCH4
PUBLIC PATCH5
ORG $8000
DI
LD BC,$7FFD
LD A,($5B5C) ; BANKM
; AND $FF
OR $07
LD ($5B5C),A ; BANKM
OUT (C),A
LD HL,ENDMOV
LD DE,$C000
LD BC,6912 ; LONGEST IT CAN BE
LDIR
LD BC,$1FFD
LD A,($5B67) ; BANK678
RES 2,A
OUT (C),A
LD HL,($0009)
SET 2,A
OUT (C),A
LD BC,$2ADA ; PRESENT IN FIRST +3 ROM
AND A
PUSH HL
SBC HL,BC
POP HL
JR Z,PLUS3A ; JR IF FIRST +3 ROM DETECTED
LD BC,$2C4C ; PRESENT IN +3B ROM ENGLISH VERSION
AND A
PUSH HL
SBC HL,BC
POP HL
JR Z,PLUS3B ; JR IF +3B ROM ENGLISH VERSION DETECTED
LD BC,$2C88 ; PRESENT IN +3B ROM SPANISH VERSION
AND A
SBC HL,BC
JR Z,PLUS3S ; JR IF +3B ROM SPANISH VERSION DETECTED
; IF NEITHER VERSION DUNNO WHAT TO DO
; BORDER RED AND LET THE CODE UNMODIFIED
LD A,$0A
OUT ($FE),A
JR PLUS3A
; +3B ROM ENGLISH VERSION ASSUMED
PLUS3B: LD BC,$104D ; FOR +3B ROM ENGLISH VERSION
LD DE,$10D4 ; FOR +3B ROM ENGLISH VERSION
LD HL,$26A7 ; FOR +3B ROM ENGLISH VERSION
JR PATCH
; +3B ROM SPANISH VERSION ASSUMED
PLUS3S: LD BC,$1059 ; FOR +3B ROM SPANISH VERSION
LD DE,$10E0 ; FOR +3B ROM SPANISH VERSION
LD HL,$26B5 ; FOR +3B ROM SPANISH VERSION
PATCH:
LD (0+1),BC ; runexe
PATCH2: LD (0+1),DE ; synexe
PATCH3: LD (0+1),HL ; sfail0
PATCH4: LD (0+1),HL ; sfail1
PATCH5: LD (0+1),HL ; sfail2
PLUS3A: CALL 49152
LD BC,$7FFD
LD A,($5B5C) ; BANKM
AND $F8
; OR $00
LD ($5B5C),A ; BANKM
OUT (C),A
EI
RET
ENDMOV: