-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdehrust_ix_231b.asm
176 lines (149 loc) · 2.7 KB
/
dehrust_ix_231b.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
; Z80 HRUST depacker.
;
; in: HL - from
; DE - to
; kills: AF, BC,DE,HL, BC',DE',HL', IX
; does not move anything before depacking, unlike dehrust_*_hdr.asm
;
; Uses IX to get packed stream, so somewhat slower than *_stk_* versions, but
; it could be freely interrupted.
;
; you must USE -hst switch and must NOT USE -zxh switch to mhmt in order to get
; correct packed stream for this depacker!
; length is 231 bytes, non-relocatable
DEHRUST
PUSH HL
POP IX
LD B,0
EXX
LD DE,#BF10
CALL LL4115
LL4036 LD A,(IX+#00)
EXX
LL403C INC IX
LD (DE),A
INC DE
LL403E EXX
LL403F ADD HL,HL
DJNZ LL4045
CALL LL4115
LL4045 JR C,LL4036
LD C,#01
LL4049 LD A,#80
LL404B ADD HL,HL
DJNZ LL4051
CALL LL4115
LL4051 RLA
JR C,LL404B
CP #03
JR C,LL405D
ADD A,C
LD C,A
XOR E
JR NZ,LL4049
LL405D ADD A,C
CP #04
JR Z,LL40C4
ADC A,#FF
CP #02
EXX
LL4067 LD C,A
LL4068 EXX
LD A,#BF
JR C,LL4082
LL406D ADD HL,HL
DJNZ LL4073
CALL LL4115
LL4073 RLA
JR C,LL406D
JR Z,LL407D
INC A
ADD A,D
JR NC,LL4084
SUB D
LL407D INC A
JR NZ,LL408D
LD A,#EF
LL4082 RRCA
CP A
LL4084 ADD HL,HL
DJNZ LL408A
CALL LL4115
LL408A RLA
JR C,LL4084
LL408D EXX
LD H,#FF
JR Z,LL409B
LD H,A
INC A
LD A,(IX+#00)
INC IX
JR Z,LL40A6
LL409B LD L,A
ADD HL,DE
LDIR
JP LL403E
LL40A1 EXX
RRC D
JR LL403F
LL40A6 CP #E0
JR C,LL409B
RLCA
XOR C
INC A
JR Z,LL40A1
SUB #10
LL40B1 LD L,A
LD C,A
LD H,#FF
ADD HL,DE
LDI
LD A,(IX+#00)
LD (DE),A
INC HL
INC DE
LD A,(HL)
JP LL403C
LL40DE CP #0F
RET Z
JR NC,LL4067
LL40D5 LD B,A
LD C,(IX+#00)
INC IX
CCF
JR LL4068
LL4115 LD B,E
LD L,(IX+#00)
INC IX
LD H,(IX+#00)
INC IX
RET
LL40C4 LD A,#80
LL40C6 ADD HL,HL
DJNZ LL40CC
CALL LL4115
LL40CC ADC A,A
JR NZ,LL40F3
LL40CF JR C,LL40C6
LL40D1 LD A,#FC
JR LL40F6
LL40F3 SBC A,A
LD A,#EF
LL40F6 ADD HL,HL
DJNZ LL40FC
CALL LL4115
LL40FC RLA
JR C,LL40F6
EXX
JR NZ,LL40B1
OR A
JP P,LL40DE
SUB #EA
ADD A,A
LD B,A
LL410A LD A,(IX+#00)
INC IX
LD (DE),A
INC DE
DJNZ LL410A
JP LL403E