Commit 5082da8

Nick committed on
Reformatting code
commit 5082da8f6933ef6ed2d956b9f555fa1b7f650782 parent 2d7772d
15 changed files +9669−8941
ModifiedCpu/machine.pas +558−436
@@ -9,113 +9,145 @@ unit machine;
9 9
10 {$MODE Delphi} 10 {$MODE Delphi}
11 11
12 interface uses windows; 12 interface
13
14 uses Windows;
13 15
14 const 16 const
15 MaxCompanies=74; 17 MaxCompanies = 74;
16 18
17 Companies:Array[0..maxCompanies] of record Code:Word;Name:String end= 19 Companies: array[0..maxCompanies] of record
18 ( 20 Code: word;
19 ( code:$3301;Name:'Nintendo' ),( code:$7901;Name:'Accolade' ),( code:$A400;Name:'Konami' ), 21 Name: string
20 ( code:$6701;Name:'Ocean' ),( code:$5601;Name:'LJN' ),( code:$9900;Name:'ARC?' ), 22 end
21 ( code:$0101;Name:'Nintendo' ),( code:$0801;Name:'Capcom' ),( code:$0100;Name:'Nintendo' ), 23 =
22 ( code:$BB01;Name:'SunSoft' ),( code:$A401;Name:'Konami' ),( code:$AF01;Name:'Namcot?' ), 24 (
23 ( code:$4901;Name:'Irem' ),( code:$9C01;Name:'Imagineer' ),( code:$A600;Name:'Kawada?' ), 25 (code: $3301; Name: 'Nintendo'), (code: $7901; Name: 'Accolade'), (code: $A400;
24 ( code:$B101;Name:'Nexoft' ),( code:$5101;Name:'Acclaim' ),( code:$6001;Name:'Titus' ), 26 Name: 'Konami'),
25 ( code:$B601;Name:'HAL' ),( code:$3300;Name:'Nintendo' ),( code:$0B00;Name:'Coconuts?' ), 27 (code: $6701; Name: 'Ocean'), (code: $5601; Name: 'LJN'), (code: $9900;
26 ( code:$5401;Name:'Gametek' ),( code:$7F01;Name:'Kemco?' ),( code:$C001;Name:'Taito' ), 28 Name: 'ARC?'),
27 ( code:$EB01;Name:'Atlus' ),( code:$E800;Name:'Asmik?' ),( code:$DA00;Name:'Tomy?' ), 29 (code: $0101; Name: 'Nintendo'), (code: $0801; Name: 'Capcom'), (code: $0100;
28 ( code:$B100;Name:'ASCII?' ),( code:$EB00;Name:'Atlus' ),( code:$C000;Name:'Taito' ), 30 Name: 'Nintendo'),
29 ( code:$9C00;Name:'Imagineer' ),( code:$C201;Name:'Kemco?' ),( code:$D101;Name:'Sofel?' ), 31 (code: $BB01; Name: 'SunSoft'), (code: $A401; Name: 'Konami'), (code: $AF01;
30 ( code:$6101;Name:'Virgin' ),( code:$BB00;Name:'SunSoft' ),( code:$CE01;Name:'FCI?' ), 32 Name: 'Namcot?'),
31 ( code:$B400;Name:'Enix?' ),( code:$BD01;Name:'Imagesoft' ),( code:$0A01;Name:'Jaleco?' ), 33 (code: $4901; Name: 'Irem'), (code: $9C01; Name: 'Imagineer'), (code: $A600;
32 ( code:$DF00;Name:'Altron?' ),( code:$A700;Name:'Takara?' ),( code:$EE00;Name:'IGS?' ), 34 Name: 'Kawada?'),
33 ( code:$8300;Name:'Lozc?' ),( code:$5001;Name:'Absolute?' ),( code:$DD00;Name:'NCS?' ), 35 (code: $B101; Name: 'Nexoft'), (code: $5101; Name: 'Acclaim'), (code: $6001;
34 ( code:$E500;Name:'Epoch?' ),( code:$CB00;Name:'VAP?' ),( code:$8C00;Name:'Vic Tokai' ), 36 Name: 'Titus'),
35 ( code:$C200;Name:'Kemco?' ),( code:$BF00;Name:'Sammy?' ), 37 (code: $B601; Name: 'HAL'), (code: $3300; Name: 'Nintendo'), (code: $0B00;
36 ( code:$1800;Name:'Hudson Soft' ),( code:$CA01;Name:'Palcom/Ultra' ), 38 Name: 'Coconuts?'),
37 ( code:$CA00;Name:'Palcom/Ultra' ),( code:$C500;Name:'Data East?' ), 39 (code: $5401; Name: 'Gametek'), (code: $7F01; Name: 'Kemco?'), (code: $C001;
38 ( code:$A900;Name:'Technos Japan?' ),( code:$D900;Name:'Banpresto?' ), 40 Name: 'Taito'),
39 ( code:$7201;Name:'Broderbund?' ),( code:$7A01;Name:'Triffix Entertainment?' ), 41 (code: $EB01; Name: 'Atlus'), (code: $E800; Name: 'Asmik?'), (code: $DA00;
40 ( code:$E100;Name:'Towachiki?' ),( code:$9300;Name:'Tsuburava?' ), 42 Name: 'Tomy?'),
41 ( code:$C600;Name:'Tonkin House?' ),( code:$CE00;Name:'Pony Canyon' ), 43 (code: $B100; Name: 'ASCII?'), (code: $EB00; Name: 'Atlus'), (code: $C000;
42 ( code:$7001;Name:'Infogrames?' ),( code:$8B01;Name:'Bullet-Proof Software?' ), 44 Name: 'Taito'),
43 ( code:$5501;Name:'Park Place?' ),( code:$EA00;Name:'King Records?' ), 45 (code: $9C00; Name: 'Imagineer'), (code: $C201; Name: 'Kemco?'), (code: $D101;
44 ( code:$5D01;Name:'Tradewest?' ),( code:$6F01;Name:'ElectroBrain?' ), 46 Name: 'Sofel?'),
45 ( code:$AA01;Name:'Broderbund?' ),( code:$C301;Name:'SquareSoft' ), 47 (code: $6101; Name: 'Virgin'), (code: $BB00; Name: 'SunSoft'), (code: $CE01;
46 ( code:$5201;Name:'Activision?' ),( code:$5A01;Name:'Bitmap Brothers/Mindscape' ), 48 Name: 'FCI?'),
47 ( code:$5301;Name:'American Sammy' ),( code:$4701;Name:'Spectrum Holobyte' ), 49 (code: $B400; Name: 'Enix?'), (code: $BD01; Name: 'Imagesoft'), (code: $0A01;
48 ( code:$1801;Name:'Hudson Soft')); 50 Name: 'Jaleco?'),
51 (code: $DF00; Name: 'Altron?'), (code: $A700; Name: 'Takara?'), (code: $EE00;
52 Name: 'IGS?'),
53 (code: $8300; Name: 'Lozc?'), (code: $5001; Name: 'Absolute?'), (code: $DD00;
54 Name: 'NCS?'),
55 (code: $E500; Name: 'Epoch?'), (code: $CB00; Name: 'VAP?'), (code: $8C00;
56 Name: 'Vic Tokai'),
57 (code: $C200; Name: 'Kemco?'), (code: $BF00; Name: 'Sammy?'),
58 (code: $1800; Name: 'Hudson Soft'), (code: $CA01; Name: 'Palcom/Ultra'),
59 (code: $CA00; Name: 'Palcom/Ultra'), (code: $C500; Name: 'Data East?'),
60 (code: $A900; Name: 'Technos Japan?'), (code: $D900; Name: 'Banpresto?'),
61 (code: $7201; Name: 'Broderbund?'), (code: $7A01; Name: 'Triffix Entertainment?'),
62 (code: $E100; Name: 'Towachiki?'), (code: $9300; Name: 'Tsuburava?'),
63 (code: $C600; Name: 'Tonkin House?'), (code: $CE00; Name: 'Pony Canyon'),
64 (code: $7001; Name: 'Infogrames?'), (code: $8B01; Name: 'Bullet-Proof Software?'),
65 (code: $5501; Name: 'Park Place?'), (code: $EA00; Name: 'King Records?'),
66 (code: $5D01; Name: 'Tradewest?'), (code: $6F01; Name: 'ElectroBrain?'),
67 (code: $AA01; Name: 'Broderbund?'), (code: $C301; Name: 'SquareSoft'),
68 (code: $5201; Name: 'Activision?'), (code: $5A01; Name: 'Bitmap Brothers/Mindscape'),
69 (code: $5301; Name: 'American Sammy'), (code: $4701; Name: 'Spectrum Holobyte'),
70 (code: $1801; Name: 'Hudson Soft'));
49 71
50 72
51 {+ Wichtig !! die beiden Speicherfunktionen müssen 73 {+ Wichtig !! die beiden Speicherfunktionen müssen
52 unbedingt CDECL deklariert sein !!! +} 74 unbedingt CDECL deklariert sein !!! +}
53 75
54 function speekb(address:Word):Byte;cdecl; 76 function speekb(address: word): byte; cdecl;
55 procedure spokeb(address:WORD;data:byte);cdecl; 77 procedure spokeb(address: word; Data: byte); cdecl;
56 78
57 function wordpeek(Addr:Word):Word; 79 function wordpeek(Addr: word): word;
58 procedure wordpoke(addr:Word;val:Word); 80 procedure wordpoke(addr: word; val: word);
59 procedure push_pc; 81 procedure push_pc;
60 82
61 procedure set_bank(number:DWORD); 83 procedure set_bank(number: DWORD);
62 procedure set_bank_mbc1_hi(data:DWORD); 84 procedure set_bank_mbc1_hi(Data: DWORD);
63 procedure set_bank_mbc1_lo(data:DWORD); 85 procedure set_bank_mbc1_lo(Data: DWORD);
64 procedure set_bank_mbc5_lo(data:DWORD); 86 procedure set_bank_mbc5_lo(Data: DWORD);
65 procedure set_bank_mbc5_hi(data:DWORD); 87 procedure set_bank_mbc5_hi(Data: DWORD);
66 procedure set_ff0f(number:Byte); 88 procedure set_ff0f(number: byte);
67 function getcompany:String; 89 function getcompany: string;
68 implementation uses vars,sound; 90
69 91 implementation
70 function getCompany:String; 92
71 var j:word; 93 uses vars, sound;
72 i:integer; 94
95 function getCompany: string;
96 var
97 j: word;
98 i: integer;
73 begin 99 begin
74 if cart=nil then exit; 100 if cart = nil then
75 J:=byte(pchar(cart)[$014B]) shl 8+byte(pchar(cart)[$014A]); 101 exit;
76 for I:=low(companies) to high(companies) do 102 J := byte(PChar(cart)[$014B]) shl 8 + byte(PChar(cart)[$014A]);
77 if Companies[I].Code=J then 103 for I := low(companies) to high(companies) do
78 begin 104 if Companies[I].Code = J then
79 result:=Companies[I].Name;exit; 105 begin
80 end; 106 Result := Companies[I].Name;
81 result:=''; 107 exit;
108 end;
109 Result := '';
82 end; 110 end;
83 procedure set_bank(number:DWORD); 111
112 procedure set_bank(number: DWORD);
84 begin 113 begin
85 if number=0 then number:=1; 114 if number = 0 then
86 number:=number mod srom; 115 number := 1;
87 if number=0 then number:=1; 116 number := number mod srom;
88 addr_bank:=number*$4000-$4000; 117 if number = 0 then
118 number := 1;
119 addr_bank := number * $4000 - $4000;
89 end; 120 end;
90 121
91 procedure set_bank_mbc1_hi(data:DWord); 122 procedure set_bank_mbc1_hi(Data: DWord);
92 begin 123 begin
93 data:=(data and 3) shl 5; 124 Data := (Data and 3) shl 5;
94 rom_priv:=(rom_priv and 31) or Data; 125 rom_priv := (rom_priv and 31) or Data;
95 set_bank(rom_priv); 126 set_bank(rom_priv);
96 end; 127 end;
97 128
98 procedure set_bank_mbc1_lo(data:Dword); 129 procedure set_bank_mbc1_lo(Data: Dword);
99 begin 130 begin
100 rom_priv:=(rom_priv and 96) or data; 131 rom_priv := (rom_priv and 96) or Data;
101 set_bank(rom_priv); 132 set_bank(rom_priv);
102 end; 133 end;
103 134
104 procedure set_bank_mbc5_lo(data:DWORD); 135 procedure set_bank_mbc5_lo(Data: DWORD);
105 begin 136 begin
106 rom_priv:=(rom_priv and 256) or data; 137 rom_priv := (rom_priv and 256) or Data;
107 set_bank(rom_priv); 138 set_bank(rom_priv);
108 end; 139 end;
109 140
110 procedure set_bank_mbc5_hi(data:Dword); 141 procedure set_bank_mbc5_hi(Data: Dword);
111 begin 142 begin
112 if(data and 1>0) then rom_priv:=rom_priv or 256 143 if (Data and 1 > 0) then
144 rom_priv := rom_priv or 256
113 else 145 else
114 rom_priv:=rom_priv and 255; 146 rom_priv := rom_priv and 255;
115 set_bank(rom_priv); 147 set_bank(rom_priv);
116 end; 148 end;
117 149
118 procedure set_ff0f(number:Byte); 150 procedure set_ff0f(number: byte);
119 (* 151 (*
120 152
121 FF0F - IFLAGS [RW] Interrupt Flags 153 FF0F - IFLAGS [RW] Interrupt Flags
@@ -131,430 +163,520 @@ Bit0 LCD vertical blanking impulse | ENABLED | DISABLED
131 163
132 *) 164 *)
133 begin 165 begin
134 if m_iram[$ffff] and number>0 then 166 if m_iram[$ffff] and number > 0 then
135 m_iram[$ff0f]:=m_iram[$ff0f] or number; 167 m_iram[$ff0f] := m_iram[$ff0f] or number;
136 end; 168 end;
137 169
138 170
139 171
140 function wordpeek(Addr:Word):Word; 172 function wordpeek(Addr: word): word;
141 begin 173 begin
142 result:=((speekb((addr)+1) shl 8) or speekb(addr)); 174 Result := ((speekb((addr) + 1) shl 8) or speekb(addr));
143 end; 175 end;
144 176
145 procedure wordpoke(addr:Word;val:Word); 177 procedure wordpoke(addr: word; val: word);
146 begin 178 begin
147 spokeb(addr, LO(val));spokeb(addr + 1, HI(val)); 179 spokeb(addr, LO(val));
180 spokeb(addr + 1, HI(val));
148 end; 181 end;
149 182
150 function speekb(address:Word):Byte; 183 function speekb(address: word): byte;
151 var cr,res:byte; 184 var
185 cr, res: byte;
152 begin 186 begin
153 if cart=NIL then begin result:=0;exit;end; 187 if cart = nil then
154 if address<$8000 then 188 begin
155 begin 189 Result := 0;
156 if (memc=ROM) or (address<$4000) then 190 exit;
157 res:=byte(pchar(cart)[address]) 191 end;
158 else 192 if address < $8000 then
159 res:=byte(pchar(cart)[address+addr_bank]); 193 begin
160 194 if (memc = ROM) or (address < $4000) then
161 asm mov al,res;end;result:=res;exit; 195 res := byte(PChar(cart)[address])
162 // Problem mit cdecl, keine Registerübergabe !! 196 else
163 end; 197 res := byte(PChar(cart)[address + addr_bank]);
164 198
165 if (address>=$e000) and (address<$fe00) then dec(address,$2000); 199 asm
166 200 MOV AL,res;
167 if gb_mode=CGB then 201 end;
168 begin 202 Result := res;
169 if (m_iram[$ff4f] and 1>0) and (address>=$8000) and (address<$a000) then 203 exit;
170 begin 204 // Problem mit cdecl, keine Registerübergabe !!
171 res:=m_iram2[address]; 205 end;
172 asm mov al,res;end; result:=res;exit; 206
173 end; 207 if (address >= $e000) and (address < $fe00) then
174 if (address>=$d000) and (address<=$dfff) then 208 Dec(address, $2000);
175 begin 209
176 cr:=(m_iram[$ff70]) and 7; 210 if gb_mode = CGB then
177 if cr=0 then cr:=1; 211 begin
178 res:=m_cgbram[4096*cr+address-$d000]; 212 if (m_iram[$ff4f] and 1 > 0) and (address >= $8000) and (address < $a000) then
179 asm mov al,res; end; result:=res;exit; 213 begin
180 end; 214 res := m_iram2[address];
181 215 asm
182 case address of 216 MOV AL,res;
183 $ff26: begin // sound 217 end;
184 m_iram[$ff26]:=(m_iram[$ff26] and $f0) or (byte(snd[4].Enable) shl 3) or 218 Result := res;
185 (byte(snd[3].Enable) shl 2) or (byte(snd[2].Enable) shl 1) or byte(snd[1].Enable); 219 exit;
186 res:=m_iram[$ff26]; 220 end;
187 asm mov al,res end; result:=res; 221 if (address >= $d000) and (address <= $dfff) then
222 begin
223 cr := (m_iram[$ff70]) and 7;
224 if cr = 0 then
225 cr := 1;
226 res := m_cgbram[4096 * cr + address - $d000];
227 asm
228 MOV AL,res;
229 end;
230 Result := res;
231 exit;
232 end;
233
234 case address of
235 $ff26:
236 begin // sound
237 m_iram[$ff26] := (m_iram[$ff26] and $f0) or (byte(snd[4].Enable) shl 3) or
238 (byte(snd[3].Enable) shl 2) or (byte(snd[2].Enable) shl 1) or
239 byte(snd[1].Enable);
240 res := m_iram[$ff26];
241 asm
242 MOV AL,res end;
243 Result := res;
244 end;
245 $ff69:
246 begin
247 res := palramb[(m_iram[$ff68]) and 63];
248 asm
249 MOV AL,res;
188 end; 250 end;
189 $ff69: begin 251 Result := res;
190 res:=palramb[(m_iram[$ff68]) and 63]; 252 exit;
191 asm mov al,res; end; result:=res;exit; 253 end;
192 end; 254 $ff6b:
193 $ff6b: begin 255 begin
194 res:=palramo[(m_iram[$ff68]) and 63]; 256 res := palramo[(m_iram[$ff68]) and 63];
195 asm mov al,res; end; result:=res;exit; 257 asm
196 end; 258 MOV AL,res;
197 end; // case 259 end;
198 end; // end CGB 260 Result := res;
261 exit;
262 end;
263 end; // case
264 end; // end CGB
199 265
200 266
201 if (sram>0) and ((address>=$a000) and (address<$c000)) then 267 if (sram > 0) and ((address >= $a000) and (address < $c000)) then
202 begin 268 begin
203 res:=m_ram[address-$a000+n_ram*$8912]; 269 res := m_ram[address - $a000 + n_ram * $8912];
204 asm mov al,res; end; result:=res;exit; 270 asm
205 end; 271 MOV AL,res;
272 end;
273 Result := res;
274 exit;
275 end;
206 276
207 res:=m_iram[address]; 277 res := m_iram[address];
208 asm mov al,res; end; result:=res; 278 asm
279 MOV AL,res;
280 end;
281 Result := res;
209 end; 282 end;
210 283
211 procedure spokeb(address:WORD;data:byte);cdecl; // neu 284 procedure spokeb(address: word; Data: byte); cdecl; // neu
212 var cr:byte; 285 var
213 ji,pi:longint; 286 cr: byte;
214 sAddr,Offset:Word; 287 ji, pi: longint;
215 templ,tempr:Byte; 288 sAddr, Offset: word;
289 templ, tempr: byte;
216 290
217 begin 291 begin
218 if cart=NIL then exit; 292 if cart = nil then
219 if (address<$8000) then 293 exit;
220 begin 294 if (address < $8000) then
221 case memc of 295 begin
222 MBC3: begin 296 case memc of
223 if((address>=$2000) and (address<=$3fff)) then 297 MBC3:
224 begin 298 begin
225 if(data=0) then data:=1; 299 if ((address >= $2000) and (address <= $3fff)) then
226 set_bank(data); 300 begin
227 exit; 301 if (Data = 0) then
228 end else 302 Data := 1;
229 if ((address>=$4000) and (address<$6000)) then 303 set_bank(Data);
230 begin 304 exit;
231 n_ram:=data and 3; 305 end
232 exit; 306 else
233 end; 307 if ((address >= $4000) and (address < $6000)) then
234 end; 308 begin
235 MBC1: begin 309 n_ram := Data and 3;
236 if((address>=$6000) and (address<$8000)) then 310 exit;
237 begin 311 end;
238 mbc1_type:=data and 1; 312 end;
239 exit; 313 MBC1:
240 end 314 begin
241 else 315 if ((address >= $6000) and (address < $8000)) then
242 if((address>=$2000) and (address<$4000)) then 316 begin
243 begin 317 mbc1_type := Data and 1;
244 data:=data and 31; 318 exit;
245 set_bank_mbc1_lo(data); 319 end
246 exit; 320 else
247 end else 321 if ((address >= $2000) and (address < $4000)) then
248 if((address>=$4000) and (address<$6000)) then 322 begin
323 Data := Data and 31;
324 set_bank_mbc1_lo(Data);
325 exit;
326 end
327 else
328 if ((address >= $4000) and (address < $6000)) then
329 begin
330 if mbc1_type > 0 then
249 begin 331 begin
250 if mbc1_type>0 then 332 n_ram := Data and 3;
251 begin
252 n_ram:=data and 3;
253 exit; 333 exit;
254 end;
255 end
256 else
257 begin
258 set_bank_mbc1_hi(data);
259 exit;
260 end; 334 end;
261 end; 335 end
262 MBC5: begin 336 else
263 if((address>=$2000) and (address<=$2fff)) then
264 begin 337 begin
265 set_bank_mbc5_lo(data); 338 set_bank_mbc1_hi(Data);
266 exit; 339 exit;
267 end; 340 end;
268 if((address>=$3000) and (address<=$3fff)) then 341 end;
342 MBC5:
343 begin
344 if ((address >= $2000) and (address <= $2fff)) then
269 begin 345 begin
270 set_bank_mbc5_hi(data); 346 set_bank_mbc5_lo(Data);
271 exit; 347 exit;
272 end; 348 end;
273 if((address>=$4000) and (address<=$5fff)) then 349 if ((address >= $3000) and (address <= $3fff)) then
274 begin 350 begin
275 n_ram:=data and 15; 351 set_bank_mbc5_hi(Data);
276 exit; 352 exit;
277 end; 353 end;
354 if ((address >= $4000) and (address <= $5fff)) then
355 begin
356 n_ram := Data and 15;
357 exit;
278 end; 358 end;
279 MBC2: begin 359 end;
280 if((address>=$2000) and (address<$4000) and (address and 256>0)) then 360 MBC2:
361 begin
362 if ((address >= $2000) and (address < $4000) and (address and 256 > 0)) then
281 begin 363 begin
282 data:=data and 15; 364 Data := Data and 15;
283 set_bank(data); 365 set_bank(Data);
284 exit; 366 exit;
285 end; 367 end;
286 end; 368 end;
369 end;
287 end; 370 end;
288 end;
289 371
290 372
291 if gb_mode=CGB then 373 if gb_mode = CGB then
292 begin
293 if ((address>=$d000) and (address<=$dfff)) then
294 begin
295 cr:=(m_iram[$ff70]) and 7;
296 if(cr=0) then cr:=1;
297 m_cgbram[4096*cr+address-$d000]:=data;
298 exit;
299 end;
300
301 if (address=$ff55) then
302 begin 374 begin
303 if(data and 128=0) then 375 if ((address >= $d000) and (address <= $dfff)) then
304 begin 376 begin
305 if hdma>0 then hdma:=0 else 377 cr := (m_iram[$ff70]) and 7;
378 if (cr = 0) then
379 cr := 1;
380 m_cgbram[4096 * cr + address - $d000] := Data;
381 exit;
382 end;
383
384 if (address = $ff55) then
385 begin
386 if (Data and 128 = 0) then
387 begin
388 if hdma > 0 then
389 hdma := 0
390 else
306 begin 391 begin
307 adr_s:=((m_iram[$ff51]) shl 8) or (m_iram[$ff52] and 240); 392 adr_s := ((m_iram[$ff51]) shl 8) or (m_iram[$ff52] and 240);
308 adr_p:=((((m_iram[$ff53]) and 31) shl 8) or (m_iram[$ff54] and 240)) or $8000; 393 adr_p := ((((m_iram[$ff53]) and 31) shl 8) or (m_iram[$ff54] and 240)) or $8000;
309 for ji:=0 to ((data and 127)*16+16)-1 do 394 for ji := 0 to ((Data and 127) * 16 + 16) - 1 do
310 begin 395 begin
311 spokeb(adr_p,speekb(adr_s)); 396 spokeb(adr_p, speekb(adr_s));
312 inc(adr_p);inc(adr_s); 397 Inc(adr_p);
398 Inc(adr_s);
313 end; 399 end;
314 inc(cnumber,data*32+928 div gb_speed); 400 Inc(cnumber, Data * 32 + 928 div gb_speed);
315 data:=$ff; 401 Data := $ff;
316 end 402 end;
317 end 403 end
318 else 404 else
319 begin 405 begin
320 data:=data and 127; 406 Data := Data and 127;
321 if(m_iram[$ff40] and 128>0) then 407 if (m_iram[$ff40] and 128 > 0) then
322 begin 408 begin
323 hdma:=1; 409 hdma := 1;
324 hdma_count:=data+1; 410 hdma_count := Data + 1;
325 adr_s:=((m_iram[$ff51]) shl 8) or (m_iram[$ff52] and 240); 411 adr_s := ((m_iram[$ff51]) shl 8) or (m_iram[$ff52] and 240);
326 adr_p:=((((m_iram[$ff53]) and 31) shl 8) or (m_iram[$ff54] and 240)) or $8000; 412 adr_p := ((((m_iram[$ff53]) and 31) shl 8) or (m_iram[$ff54] and 240)) or $8000;
327 end; 413 end;
328 end; 414 end;
329 end; 415 end;
330 416
331 417
332 if((address>=$8000) and (address<$a000) and ((m_iram[$ff4f] and 1>0))) then 418 if ((address >= $8000) and (address < $a000) and ((m_iram[$ff4f] and 1 > 0))) then
333 begin 419 begin
334 m_iram2[address]:=data; 420 m_iram2[address] := Data;
335 exit; 421 exit;
336 end; 422 end;
337 423
338 case address of 424 case address of
339 $ff69: begin 425 $ff69:
340 palramb[(m_iram[$ff68]) and 63]:=data; 426 begin
341 if(m_iram[$ff68] and 1)>0 then 427 palramb[(m_iram[$ff68]) and 63] := Data;
342 begin 428 if (m_iram[$ff68] and 1) > 0 then
343 tempL:=((m_iram[$ff68]) and 56) shr 3; 429 begin
344 tempR:=((m_iram[$ff68]) and 6) shr 1; 430 tempL := ((m_iram[$ff68]) and 56) shr 3;
345 pal_b[templ][tempr][0]:=(data and 124) shl 1; 431 tempR := ((m_iram[$ff68]) and 6) shr 1;
346 pal_b[templ][tempr][1]:=pal_b[templ][tempr][1] and 63; 432 pal_b[templ][tempr][0] := (Data and 124) shl 1;
347 pal_b[templ][tempr][1]:=pal_b[templ][tempr][1] or (data shl 6); 433 pal_b[templ][tempr][1] := pal_b[templ][tempr][1] and 63;
348 end 434 pal_b[templ][tempr][1] := pal_b[templ][tempr][1] or (Data shl 6);
349 else 435 end
350 begin 436 else
351 templ:=((m_iram[$ff68]) and 56) shr 3; 437 begin
352 tempr:=((m_iram[$ff68]) and 6) shr 1; 438 templ := ((m_iram[$ff68]) and 56) shr 3;
439 tempr := ((m_iram[$ff68]) and 6) shr 1;
353 440
354 pal_b[templ][tempr][2]:=(data and 31) shl 3; 441 pal_b[templ][tempr][2] := (Data and 31) shl 3;
355 pal_b[templ][tempr][1]:=pal_b[templ][tempr][1] and 192; 442 pal_b[templ][tempr][1] := pal_b[templ][tempr][1] and 192;
356 pal_b[templ][tempr][1]:=pal_b[templ][tempr][1] or ((data and 224) shr 2); 443 pal_b[templ][tempr][1] := pal_b[templ][tempr][1] or ((Data and 224) shr 2);
357 end; 444 end;
358 445
359 pal_dx_b[((m_iram[$ff68]) and 56) shr 3][((m_iram[$ff68]) and 6) shr 1]:= 446 pal_dx_b[((m_iram[$ff68]) and 56) shr 3][((m_iram[$ff68]) and 6) shr 1] :=
360 (((pal_b[((m_iram[$ff68]) and 56) shr 3][((m_iram[$ff68]) and 6) shr 1][2]) shr (8-dx_r)) shl dx_sr) or (((pal_b[((m_iram[$ff68]) and 56) shr 3][((m_iram[$ff68]) and 6) shr 1][1]) shr (8-dx_g)) shl dx_sg) or (((pal_b[((m_iram[$ff68]) and 56) shr 3][((m_iram[$ff68]) and 6) shr 1][0]) shr (8-dx_b)) shl dx_sb); 447 (((pal_b[((m_iram[$ff68]) and 56) shr 3][((m_iram[$ff68]) and 6) shr 1][2]) shr
361 if(m_iram[$ff68] and 128)>0 then 448 (8 - dx_r)) shl dx_sr) or (((pal_b[((m_iram[$ff68]) and 56) shr 3][
449 ((m_iram[$ff68]) and 6) shr 1][1]) shr (8 - dx_g)) shl dx_sg) or
450 (((pal_b[((m_iram[$ff68]) and 56) shr 3][((m_iram[$ff68]) and 6) shr 1][0]) shr
451 (8 - dx_b)) shl dx_sb);
452 if (m_iram[$ff68] and 128) > 0 then
362 begin 453 begin
363 m_iram[$ff68]:=m_iram[$ff68] and $3f; 454 m_iram[$ff68] := m_iram[$ff68] and $3f;
364 inc(m_iram[$ff68]); 455 Inc(m_iram[$ff68]);
365 m_iram[$ff68]:=m_iram[$ff68] or 128; 456 m_iram[$ff68] := m_iram[$ff68] or 128;
366 end; 457 end;
367 end; 458 end;
368 $ff6b: begin 459 $ff6b:
369 palramo[(m_iram[$ff6a]) and 63]:=data; 460 begin
370 if(m_iram[$ff6a] and 1)>0 then 461 palramo[(m_iram[$ff6a]) and 63] := Data;
371 begin 462 if (m_iram[$ff6a] and 1) > 0 then
372 templ:=((m_iram[$ff6a]) and 56) shr 3; 463 begin
373 tempr:=((m_iram[$ff6a]) and 6) shr 1; 464 templ := ((m_iram[$ff6a]) and 56) shr 3;
374 465 tempr := ((m_iram[$ff6a]) and 6) shr 1;
375 pal_o[templ][tempr][0]:=(data and 124) shl 1;
376 pal_o[templ][tempr][1]:=pal_o[templ][tempr][1] and 63;
377 pal_o[templ][tempr][1]:=pal_o[templ][tempr][1] or (data shl 6);
378 end
379 else
380 begin
381 templ:=((m_iram[$ff6a]) and 56) shr 3;
382 tempr:=((m_iram[$ff6a]) and 6) shr 1;
383
384 pal_o[templ][tempr][2]:=(data and 31) shl 3;
385 pal_o[templ][tempr][1]:=pal_o[templ][tempr][1] and 192;
386 pal_o[templ][tempr][1]:=pal_o[templ][tempr][1] or ((data and 224) shr 2);
387 end;
388 pal_dx_o[((m_iram[$ff6a]) and 56) shr 3][((m_iram[$ff6a]) and 6) shr 1]:=(((pal_o[((m_iram[$ff6a]) and 56) shr 3][((m_iram[$ff6a]) and 6) shr 1][2]) shr (8-dx_r)) shl dx_sr) or (((pal_o[((m_iram[$ff6a]) and 56) shr 3][((m_iram[$ff6a]) and 6) shr 1][1]) shr (8-dx_g)) shl dx_sg) or (((pal_o[((m_iram[$ff6a]) and 56) shr 3][((m_iram[$ff6a]) and 6) shr 1][0]) shr (8-dx_b)) shl dx_sb);
389 if(m_iram[$ff6a] and 128)>0 then
390 begin
391 m_iram[$ff6a]:=m_iram[$ff6a] and $3f;
392 inc(m_iram[$ff6a]);
393 m_iram[$ff6a]:=m_iram[$ff6a] or 128;
394 end;
395 end;
396 end;
397 end;
398 466
399 if ((address>=$e000) and (address<$fe00)) then dec(address,$2000); 467 pal_o[templ][tempr][0] := (Data and 124) shl 1;
468 pal_o[templ][tempr][1] := pal_o[templ][tempr][1] and 63;
469 pal_o[templ][tempr][1] := pal_o[templ][tempr][1] or (Data shl 6);
470 end
471 else
472 begin
473 templ := ((m_iram[$ff6a]) and 56) shr 3;
474 tempr := ((m_iram[$ff6a]) and 6) shr 1;
400 475
401 if (address>=$ff00) then 476 pal_o[templ][tempr][2] := (Data and 31) shl 3;
402 begin 477 pal_o[templ][tempr][1] := pal_o[templ][tempr][1] and 192;
403 case address of 478 pal_o[templ][tempr][1] := pal_o[templ][tempr][1] or ((Data and 224) shr 2);
404 $ff00: begin 479 end;
405 if (data=3) then data:=$ff else 480 pal_dx_o[((m_iram[$ff6a]) and 56) shr 3][((m_iram[$ff6a]) and 6) shr 1] :=
406 if((data and $30)=$30) then data:=$ff 481 (((pal_o[((m_iram[$ff6a]) and 56) shr 3][((m_iram[$ff6a]) and 6) shr 1][2]) shr
407 else 482 (8 - dx_r)) shl dx_sr) or (((pal_o[((m_iram[$ff6a]) and 56) shr 3][
408 begin 483 ((m_iram[$ff6a]) and 6) shr 1][1]) shr (8 - dx_g)) shl dx_sg) or
409 if((data and $30)=$20) then 484 (((pal_o[((m_iram[$ff6a]) and 56) shr 3][((m_iram[$ff6a]) and 6) shr 1][0]) shr
410 data:=$20 or (k_down shl 3) or (k_up shl 2) or (k_left shl 1) or k_right 485 (8 - dx_b)) shl dx_sb);
411 else 486 if (m_iram[$ff6a] and 128) > 0 then
412 if((data and $30)=$10) then 487 begin
413 data:=$10 or (k_start shl 3) or (k_select shl 2) or(k_b shl 1) or k_a; 488 m_iram[$ff6a] := m_iram[$ff6a] and $3f;
414 end; 489 Inc(m_iram[$ff6a]);
415 data:=data or $c0; 490 m_iram[$ff6a] := m_iram[$ff6a] or 128;
491 end;
416 end; 492 end;
417 $ff02: begin 493 end;
418 if((data and 128>0) and (data and 1>0)) then sio_count:=8; 494 end;
419 data:=data or 126; 495
420 end; 496 if ((address >= $e000) and (address < $fe00)) then
421 $ff04: begin 497 Dec(address, $2000);
422 data:=0; 498
423 n_ff04:=0; 499 if (address >= $ff00) then
500 begin
501 case address of
502 $ff00:
503 begin
504 if (Data = 3) then
505 Data := $ff
506 else
507 if ((Data and $30) = $30) then
508 Data := $ff
509 else
510 begin
511 if ((Data and $30) = $20) then
512 Data := $20 or (k_down shl 3) or (k_up shl 2) or (k_left shl 1) or k_right
513 else
514 if ((Data and $30) = $10) then
515 Data := $10 or (k_start shl 3) or (k_select shl 2) or (k_b shl 1) or k_a;
424 end; 516 end;
425 $ff07: begin 517 Data := Data or $c0;
426 if(data and 4)>0 then 518 end;
427 begin 519 $ff02:
428 c_count:=0; 520 begin
429 t_count:=m_iram[$ff06]; 521 if ((Data and 128 > 0) and (Data and 1 > 0)) then
430 end; 522 sio_count := 8;
523 Data := Data or 126;
524 end;
525 $ff04:
526 begin
527 Data := 0;
528 n_ff04 := 0;
529 end;
530 $ff07:
531 begin
532 if (Data and 4) > 0 then
533 begin
534 c_count := 0;
535 t_count := m_iram[$ff06];
431 end; 536 end;
432 $ff40: begin 537 end;
433 if(data and 128=0) then vbioff_count:=1 else 538 $ff40:
434 if(m_iram[$ff40] and 128)=0 then 539 begin
435 begin 540 if (Data and 128 = 0) then
436 old_mode:=5; 541 vbioff_count := 1
437 cycles:=1; 542 else
438 cur_c:=2; 543 if (m_iram[$ff40] and 128) = 0 then
439 nr_t:=0; 544 begin
440 end; 545 old_mode := 5;
546 cycles := 1;
547 cur_c := 2;
548 nr_t := 0;
441 end; 549 end;
442 $ff0f: begin 550 end;
443 if(data and 16)>0 then set_ff0f(16); 551 $ff0f:
444 if(data and 8)>0 then set_ff0f(8); 552 begin
445 if(data and 4)>0 then set_ff0f(4); 553 if (Data and 16) > 0 then
446 if(data and 2)>0 then set_ff0f(2); 554 set_ff0f(16);
447 if(data and 1)>0 then set_ff0f(1); 555 if (Data and 8) > 0 then
556 set_ff0f(8);
557 if (Data and 4) > 0 then
558 set_ff0f(4);
559 if (Data and 2) > 0 then
560 set_ff0f(2);
561 if (Data and 1) > 0 then
562 set_ff0f(1);
563 end;
564 $ff10..$ff3F:
565 begin
566 sndRegChange := True;
567 if address = $ff26 then
568 begin
569 m_iram[$ff26] := Data;
570 if Data and $80 = 0 then
571 begin
572 snd[1].Enable := False;
573 snd[2].Enable := False;
574 snd[3].Enable := False;
575 snd[4].Enable := False;
576 end;
577 exit;
448 end; 578 end;
449 $ff10..$ff3F: begin 579 m_iram[address] := Data;
450 sndRegChange:=true; 580 exit;
451 if address=$ff26 then 581 end;
452 begin 582
453 m_iram[$ff26]:=data; 583 $ff47:
454 if data and $80=0 then 584 begin
455 begin 585 if (gb_mode <> CGB) then
456 snd[1].Enable:=false; 586 begin
457 snd[2].Enable:=false; 587 gb_mode := CGB;
458 snd[3].Enable:=false; 588 spokeb($ff68, 128);
459 snd[4].Enable:=false; 589 spokeb($ff69, (colors[Data and 3]) and $ff);
460 end; 590 spokeb($ff69, (colors[Data and 3]) shr 8);
461 exit; 591 spokeb($ff69, (colors[(Data and $c) shr 2]) and $ff);
462 end; 592 spokeb($ff69, (colors[(Data and $c) shr 2]) shr 8);
463 m_iram[address]:=data; 593 spokeb($ff69, (colors[(Data and $30) shr 4]) and $ff);
464 exit; 594 spokeb($ff69, (colors[(Data and $30) shr 4]) shr 8);
465 end; 595 spokeb($ff69, (colors[(Data and $c0) shr 6]) and $ff);
466 596 spokeb($ff69, (colors[(Data and $c0) shr 6]) shr 8);
467 $ff47: begin 597 gb_mode := DMG;
468 if(gb_mode<>CGB) then
469 begin
470 gb_mode:=CGB;
471 spokeb($ff68,128);
472 spokeb($ff69,(colors[data and 3]) and $ff);
473 spokeb($ff69,(colors[data and 3]) shr 8);
474 spokeb($ff69,(colors[(data and $c) shr 2]) and $ff);
475 spokeb($ff69,(colors[(data and $c) shr 2]) shr 8);
476 spokeb($ff69,(colors[(data and $30) shr 4]) and $ff);
477 spokeb($ff69,(colors[(data and $30) shr 4]) shr 8);
478 spokeb($ff69,(colors[(data and $c0) shr 6]) and $ff);
479 spokeb($ff69,(colors[(data and $c0) shr 6]) shr 8);
480 gb_mode:=DMG;
481 end;
482 end; 598 end;
483 $ff48: begin 599 end;
484 if(gb_mode<>CGB) then 600 $ff48:
485 begin 601 begin
486 gb_mode:=CGB; 602 if (gb_mode <> CGB) then
487 spokeb($ff6a,128); 603 begin
488 spokeb($ff6b,(colors[data and 3]) and $ff); 604 gb_mode := CGB;
489 spokeb($ff6b,(colors[data and 3]) shr 8); 605 spokeb($ff6a, 128);
490 spokeb($ff6b,(colors[(data and $c) shr 2]) and $ff); 606 spokeb($ff6b, (colors[Data and 3]) and $ff);
491 spokeb($ff6b,(colors[(data and $c) shr 2]) shr 8); 607 spokeb($ff6b, (colors[Data and 3]) shr 8);
492 spokeb($ff6b,(colors[(data and $30) shr 4]) and $ff); 608 spokeb($ff6b, (colors[(Data and $c) shr 2]) and $ff);
493 spokeb($ff6b,(colors[(data and $30) shr 4]) shr 8); 609 spokeb($ff6b, (colors[(Data and $c) shr 2]) shr 8);
494 spokeb($ff6b,(colors[(data and $c0) shr 6]) and $ff); 610 spokeb($ff6b, (colors[(Data and $30) shr 4]) and $ff);
495 spokeb($ff6b,(colors[(data and $c0) shr 6]) shr 8); 611 spokeb($ff6b, (colors[(Data and $30) shr 4]) shr 8);
496 gb_mode:=DMG; 612 spokeb($ff6b, (colors[(Data and $c0) shr 6]) and $ff);
497 end; 613 spokeb($ff6b, (colors[(Data and $c0) shr 6]) shr 8);
614 gb_mode := DMG;
498 end; 615 end;
499 $ff49: begin 616 end;
500 if gb_mode<>CGB then 617 $ff49:
501 begin 618 begin
502 gb_mode:=CGB; 619 if gb_mode <> CGB then
503 spokeb($ff6a,128+8); 620 begin
504 spokeb($ff6b,(colors[data and 3]) and $ff); 621 gb_mode := CGB;
505 spokeb($ff6b,(colors[data and 3]) shr 8); 622 spokeb($ff6a, 128 + 8);
506 spokeb($ff6b,(colors[(data and $c) shr 2]) and $ff); 623 spokeb($ff6b, (colors[Data and 3]) and $ff);
507 spokeb($ff6b,(colors[(data and $c) shr 2]) shr 8); 624 spokeb($ff6b, (colors[Data and 3]) shr 8);
508 spokeb($ff6b,(colors[(data and $30) shr 4]) and $ff); 625 spokeb($ff6b, (colors[(Data and $c) shr 2]) and $ff);
509 spokeb($ff6b,(colors[(data and $30) shr 4]) shr 8); 626 spokeb($ff6b, (colors[(Data and $c) shr 2]) shr 8);
510 spokeb($ff6b,(colors[(data and $c0) shr 6]) and $ff); 627 spokeb($ff6b, (colors[(Data and $30) shr 4]) and $ff);
511 spokeb($ff6b,(colors[(data and $c0) shr 6]) shr 8); 628 spokeb($ff6b, (colors[(Data and $30) shr 4]) shr 8);
512 gb_mode:=DMG; 629 spokeb($ff6b, (colors[(Data and $c0) shr 6]) and $ff);
513 end; 630 spokeb($ff6b, (colors[(Data and $c0) shr 6]) shr 8);
631 gb_mode := DMG;
514 end; 632 end;
515 $ff41: begin 633 end;
516 if((mode=0) or (mode=1)) then 634 $ff41:
517 begin 635 begin
518 m_iram[$ff0f]:=m_iram[$ff0f] or 2; 636 if ((mode = 0) or (mode = 1)) then
637 begin
638 m_iram[$ff0f] := m_iram[$ff0f] or 2;
519 set_ff0f(2); 639 set_ff0f(2);
520 end;
521 end; 640 end;
522 $ff46: begin 641 end;
523 sAddr:=data shl 8; 642 $ff46:
524 Offset:=$fe00; 643 begin
525 for pi:=0 to $9f do 644 sAddr := Data shl 8;
526 begin 645 Offset := $fe00;
527 m_iram[Offset]:=speekb(sAddr); 646 for pi := 0 to $9f do
528 inc(Offset);inc(sAddr); 647 begin
529 end; 648 m_iram[Offset] := speekb(sAddr);
649 Inc(Offset);
650 Inc(sAddr);
530 end; 651 end;
652 end;
531 653
532 end; 654 end;
533 end; 655 end;
534 656
535 if(sram>0) and (address>=$a000) and (address<$c000) then 657 if (sram > 0) and (address >= $a000) and (address < $c000) then
536 m_ram[address-$a000+n_ram*$8912]:=data 658 m_ram[address - $a000 + n_ram * $8912] := Data
537 else 659 else
538 m_iram[address]:=data; 660 m_iram[address] := Data;
539 end; 661 end;
540 662
541 663
542 procedure push_pc;assembler; 664 procedure push_pc; assembler;
543 asm 665 asm
544 mov ax,pc.w 666 MOV AX,pc.w
545 dec sp_.w 667 DEC sp_.w
546 xchg ah,al 668 XCHG AH,AL
547 push eax 669 PUSH EAX
548 push dword ptr sp_.w 670 PUSH dword ptr sp_.w
549 call spokeb 671 CALL spokeb
550 lea esp,[esp+8] 672 LEA ESP,[ESP+8]
551 mov ax,pc.w 673 MOV AX,pc.w
552 push eax 674 PUSH EAX
553 dec sp_.w 675 DEC sp_.w
554 push dword ptr sp_.w 676 PUSH dword ptr sp_.w
555 call spokeb 677 CALL spokeb
556 lea esp,[esp+8] 678 LEA ESP,[ESP+8]
557 end; 679 end;
558 (* dec(sp_.W,2);wordpoke(sp_.W,pc.w);*) 680 (* dec(sp_.W,2);wordpoke(sp_.W,pc.w);*)
559 681
560 682
ModifiedCpu/z80cpu.pas +4774−4689
@@ -11,6355 +11,6440 @@ unit Z80CPU;
11 11
12 interface 12 interface
13 13
14 var z80:array[0..511] of function:byte; 14 var
15 z80: array[0..511] of function: byte;
15 16
16 implementation uses vars,machine,windows; 17 implementation
18
19 uses vars, machine, Windows;
17 20
18 // temporäre Variablen 21 // temporäre Variablen
19 var b:Pair; 22 var
20 cycle:byte; 23 b: Pair;
21 w1,w2:Word; 24 cycle: byte;
25 w1, w2: word;
22 26
23 function NOP:byte; 27 function NOP: byte;
24 begin 28 begin
25 result:=4; 29 Result := 4;
26 end; 30 end;
27 31
28 function LD_BC_WORD:byte; 32 function LD_BC_WORD: byte;
29 begin 33 begin
30 asm 34 asm
31 push dword ptr pc.w 35 PUSH dword ptr pc.w
32 call speekb 36 CALL speekb
33 lea esp,[esp+4] 37 LEA ESP,[ESP+4]
34 mov bc.l,al 38 MOV bc.l,AL
35 inc word ptr pc.w 39 INC word ptr pc.w
36 push dword ptr pc.w 40 PUSH dword ptr pc.w
37 call speekb 41 CALL speekb
38 lea esp,[esp+4] 42 LEA ESP,[ESP+4]
39 mov bc.h,al 43 MOV bc.h,AL
40 inc word ptr pc.w 44 INC word ptr pc.w
41 end; 45 end;
42 result:=12; 46 Result := 12;
43 end; 47 end;
44 48
45 function LD_xBC_A:byte; 49 function LD_xBC_A: byte;
46 begin 50 begin
47 asm 51 asm
48 mov ax,bc.w 52 MOV AX,bc.w
49 push dword ptr af.h 53 PUSH dword ptr af.h
50 push eax 54 PUSH EAX
51 call SpokeB 55 CALL SpokeB
52 lea esp,[esp+8] 56 LEA ESP,[ESP+8]
53 end; 57 end;
54 result:=8; 58 Result := 8;
55 end; 59 end;
56 60
57 function INC_BC:byte; 61 function INC_BC: byte;
58 begin 62 begin
59 asm 63 asm
60 inc bc.w 64 INC bc.w
61 end; 65 end;
62 result:=8; 66 Result := 8;
63 end; 67 end;
64 68
65 function INC_B:byte; 69 function INC_B: byte;
66 begin 70 begin
67 asm 71 asm
68 inc bc.h 72 INC bc.h
69 lahf 73 LAHF
70 and eax,$5100 74 AND EAX,$5100
71 and af.l,1 75 AND af.l,1
72 or af.l,ah 76 OR af.l,AH
73 end; 77 end;
74 78
75 result:=4; 79 Result := 4;
76 end; 80 end;
77 81
78 function DEC_B:byte; 82 function DEC_B: byte;
79 begin 83 begin
80 asm 84 asm
81 dec bc.h 85 DEC bc.h
82 lahf 86 LAHF
83 and af.l,1 87 AND af.l,1
84 and eax,$5500 88 AND EAX,$5500
85 or eax,$400 89 OR EAX,$400
86 or af.l,ah 90 OR af.l,AH
87 end; 91 end;
88 92
89 result:=4; 93 Result := 4;
90 94
91 end; 95 end;
92 96
93 function LD_B_BYTE:byte; 97 function LD_B_BYTE: byte;
94 begin 98 begin
95 asm 99 asm
96 push dword ptr pc.w 100 PUSH dword ptr pc.w
97 call speekb 101 CALL speekb
98 lea esp,[esp+4] 102 LEA ESP,[ESP+4]
99 mov bc.h,al 103 MOV bc.h,AL
100 inc word ptr pc.w 104 INC word ptr pc.w
101 end; 105 end;
102 result:=8; 106 Result := 8;
103 end;
104
105 function RLCA:byte;
106 begin
107 asm
108 rol af.h,1
109 lahf
110 and eax,$100
111 mov af.l,ah
112 end;
113
114
115 result:=4;
116 end; 107 end;
117 108
118 function EX_AF_AF:byte; 109 function RLCA: byte;
119 begin 110 begin
120 asm 111 asm
121 push dword ptr pc.w 112 ROL af.h,1
122 call speekb 113 LAHF
123 lea esp,[esp+4] 114 AND EAX,$100
124 inc word ptr pc.w 115 MOV af.l,AH
125 push eax 116 end;
126
127 push dword ptr pc.w
128 call speekb
129 lea esp,[esp+4]
130 inc word ptr pc.w
131 xchg ah,al
132 pop ebx
133 mov al,bl
134 mov bx,sp_.w
135 push ebx
136 push eax
137 117
138 push ebx
139 push eax
140 call SpokeB
141 lea esp,[esp+8]
142 118
143 pop eax 119 Result := 4;
144 pop ebx 120 end;
145 inc eax 121
146 xchg bh,bl 122 function EX_AF_AF: byte;
147 push ebx 123 begin
148 push eax 124 asm
149 call SpokeB 125 PUSH dword ptr pc.w
150 lea esp,[esp+8] 126 CALL speekb
151 end; 127 LEA ESP,[ESP+4]
152 result:=20; 128 INC word ptr pc.w
129 PUSH EAX
130
131 PUSH dword ptr pc.w
132 CALL speekb
133 LEA ESP,[ESP+4]
134 INC word ptr pc.w
135 XCHG AH,AL
136 POP EBX
137 MOV AL,BL
138 MOV BX,sp_.w
139 PUSH EBX
140 PUSH EAX
141
142 PUSH EBX
143 PUSH EAX
144 CALL SpokeB
145 LEA ESP,[ESP+8]
146
147 POP EAX
148 POP EBX
149 INC EAX
150 XCHG BH,BL
151 PUSH EBX
152 PUSH EAX
153 CALL SpokeB
154 LEA ESP,[ESP+8]
155 end;
156 Result := 20;
153 end; 157 end;
154 158
155 function ADD_HL_BC:byte; 159 function ADD_HL_BC: byte;
156 begin 160 begin
157 asm 161 asm
158 and af.l,64 162 AND af.l,64
159 mov ax,hl.w 163 MOV AX,hl.w
160 mov bx,bc.w 164 MOV BX,bc.w
161 165
162 166
163 mov ecx,eax 167 MOV ECX,EAX
164 xor ecx,ebx 168 XOR ECX,EBX
165 169
166 add ax,bx 170 ADD AX,BX
167 jnc @1 171 JNC @1
168 or af.l,1 172 OR af.l,1
169 @1: 173 @1:
170 xor ecx,eax 174 XOR ECX,EAX
171 test ecx,4096 175 TEST ECX,4096
172 jz @ende 176 JZ @ende
173 or af.l,16 177 OR af.l,16
174 @ende: 178 @ende:
175 mov hl.w,ax 179 MOV hl.w,AX
176 180
177 end; 181 end;
178 result:=8; 182 Result := 8;
179 end; 183 end;
180 184
181 function LD_A_xBC:byte; 185 function LD_A_xBC: byte;
182 begin 186 begin
183 asm 187 asm
184 mov ax,bc.w 188 MOV AX,bc.w
185 push eax 189 PUSH EAX
186 call speekb 190 CALL speekb
187 lea esp,[esp+4] 191 LEA ESP,[ESP+4]
188 mov af.h,al 192 MOV af.h,AL
189 end; 193 end;
190 result:=8; 194 Result := 8;
191 end; 195 end;
192 196
193 function DEC_BC:byte; 197 function DEC_BC: byte;
194 begin 198 begin
195 asm 199 asm
196 dec bc.w 200 DEC bc.w
197 end; 201 end;
198 202
199 result:=8; 203 Result := 8;
200 end; 204 end;
201 205
202 function INC_C:byte; 206 function INC_C: byte;
203 begin 207 begin
204 asm 208 asm
205 inc bc.l 209 INC bc.l
206 lahf 210 LAHF
207 and eax,$5100 211 AND EAX,$5100
208 and af.l,1 212 AND af.l,1
209 or af.l,ah 213 OR af.l,AH
210 end; 214 end;
211 215
212 result:=4; 216 Result := 4;
213 end; 217 end;
214 218
215 function DEC_C:byte; 219 function DEC_C: byte;
216 begin 220 begin
217 asm 221 asm
218 dec bc.l 222 DEC bc.l
219 lahf 223 LAHF
220 and af.l,1 224 AND af.l,1
221 and eax,$5500 225 AND EAX,$5500
222 or eax,$400 226 OR EAX,$400
223 or af.l,ah 227 OR af.l,AH
224 end; 228 end;
225 229
226 result:=4; 230 Result := 4;
227 end; 231 end;
228 232
229 function LD_C_BYTE:byte; 233 function LD_C_BYTE: byte;
230 begin 234 begin
231 asm 235 asm
232 push dword ptr pc.w 236 PUSH dword ptr pc.w
233 call speekb 237 CALL speekb
234 lea esp,[esp+4] 238 LEA ESP,[ESP+4]
235 mov bc.l,al 239 MOV bc.l,AL
236 inc word ptr pc.w 240 INC word ptr pc.w
237 end; 241 end;
238 result:=8; 242 Result := 8;
239 end; 243 end;
240 244
241 function RRCA:byte; 245 function RRCA: byte;
242 begin 246 begin
243 asm 247 asm
244 ror af.h,1 248 ROR af.h,1
245 lahf 249 LAHF
246 and eax,$100 250 AND EAX,$100
247 mov af.l,ah 251 MOV af.l,AH
248 end; 252 end;
249 253
250 254
251 result:=4; 255 Result := 4;
252 end; 256 end;
253 257
254 function DJNZ:byte; 258 function DJNZ: byte;
255 begin 259 begin
256 stop_mode:=1; 260 stop_mode := 1;
257 inc(pc.w); 261 Inc(pc.w);
258 result:=10; 262 Result := 10;
259 end; 263 end;
260 264
261 function LD_DE_WORD:byte; 265 function LD_DE_WORD: byte;
262 begin 266 begin
263 asm 267 asm
264 push dword ptr pc.w 268 PUSH dword ptr pc.w
265 call speekb 269 CALL speekb
266 lea esp,[esp+4] 270 LEA ESP,[ESP+4]
267 mov de.l,al 271 MOV de.l,AL
268 inc word ptr pc.w 272 INC word ptr pc.w
269 273
270 push dword ptr pc.w 274 PUSH dword ptr pc.w
271 call speekb 275 CALL speekb
272 lea esp,[esp+4] 276 LEA ESP,[ESP+4]
273 mov de.h,al 277 MOV de.h,AL
274 inc word ptr pc.w 278 INC word ptr pc.w
275 end; 279 end;
276 result:=12; 280 Result := 12;
277 end; 281 end;
278 282
279 function LD_xDE_A:byte; 283 function LD_xDE_A: byte;
280 begin 284 begin
281 asm 285 asm
282 mov ax,de.w 286 MOV AX,de.w
283 push dword ptr af.h 287 PUSH dword ptr af.h
284 push eax 288 PUSH EAX
285 call SpokeB 289 CALL SpokeB
286 lea esp,[esp+8] 290 LEA ESP,[ESP+8]
287 end; 291 end;
288 292
289 result:=8; 293 Result := 8;
290 end; 294 end;
291 295
292 function INC_DE:byte; 296 function INC_DE: byte;
293 begin 297 begin
294 asm 298 asm
295 inc de.w 299 INC de.w
296 end; 300 end;
297 result:=8; 301 Result := 8;
298 end; 302 end;
299 303
300 function INC_D:byte; 304 function INC_D: byte;
301 begin 305 begin
302 asm 306 asm
303 inc de.h 307 INC de.h
304 lahf 308 LAHF
305 and eax,$5100 309 AND EAX,$5100
306 and af.l,1 310 AND af.l,1
307 or af.l,ah 311 OR af.l,AH
308 end; 312 end;
309 313
310 result:=4; 314 Result := 4;
311 end; 315 end;
312 316
313 function DEC_D:byte; 317 function DEC_D: byte;
314 begin 318 begin
315 asm 319 asm
316 dec de.h 320 DEC de.h
317 lahf 321 LAHF
318 and af.l,1 322 AND af.l,1
319 and eax,$5500 323 AND EAX,$5500
320 or eax,$400 324 OR EAX,$400
321 or af.l,ah 325 OR af.l,AH
322 end; 326 end;
323 327
324 result:=4; 328 Result := 4;
325 end; 329 end;
326 330
327 function LD_D_BYTE:byte; 331 function LD_D_BYTE: byte;
328 begin 332 begin
329 asm 333 asm
330 push dword ptr pc.w 334 PUSH dword ptr pc.w
331 call speekb 335 CALL speekb
332 lea esp,[esp+4] 336 LEA ESP,[ESP+4]
333 mov de.h,al 337 MOV de.h,AL
334 inc word ptr pc.w 338 INC word ptr pc.w
335 end; 339 end;
336 340
337 result:=8; 341 Result := 8;
338 end; 342 end;
339 343
340 function RLA:byte; 344 function RLA: byte;
341 begin 345 begin
342 asm 346 asm
343 mov ah,af.l 347 MOV AH,af.l
344 and eax,$100 348 AND EAX,$100
345 sahf 349 SAHF
346 rcl af.h,1 350 RCL af.h,1
347 lahf 351 LAHF
348 and eax,$100 352 AND EAX,$100
349 mov af.l,ah 353 MOV af.l,AH
350 end; 354 end;
351 355
352 result:=4; 356 Result := 4;
353 end; 357 end;
354 358
355 function JR:byte; 359 function JR: byte;
356 begin 360 begin
357 asm 361 asm
358 xor eax,eax 362 XOR EAX,EAX
359 mov ax,pc.w 363 MOV AX,pc.w
360 push eax 364 PUSH EAX
361 call speekb 365 CALL speekb
362 lea esp,[esp+4] 366 LEA ESP,[ESP+4]
363 inc word ptr pc.w 367 INC word ptr pc.w
364 cbw 368 CBW
365 add pc.w,ax 369 ADD pc.w,AX
366 end; 370 end;
367 371
368 result:=8; 372 Result := 8;
369 end; 373 end;
370 374
371 function ADD_HL_DE:byte; 375 function ADD_HL_DE: byte;
372 begin 376 begin
373 asm 377 asm
374 and af.l,64 378 AND af.l,64
375 mov ax,hl.w 379 MOV AX,hl.w
376 mov bx,de.w 380 MOV BX,de.w
377
378 381
379 mov ecx,eax
380 xor cx,bx
381 382
382 add ax,bx 383 MOV ECX,EAX
383 jnc @1 384 XOR CX,BX
384 or af.l,1
385 @1:
386 xor cx,ax
387 test cx,4096
388 jz @ende
389 or af.l,16
390 @ende:
391 mov hl.w,ax
392
393 end;
394 result:=8;
395 end;
396 385
397 function LD_A_xDE:byte; 386 ADD AX,BX
398 begin 387 JNC @1
399 asm 388 OR af.l,1
400 mov ax,de.w 389 @1:
401 push eax 390 XOR CX,AX
402 call speekb 391 TEST CX,4096
403 lea esp,[esp+4] 392 JZ @ende
404 mov af.h,al 393 OR af.l,16
405 end; 394 @ende:
395 MOV hl.w,AX
406 396
407 result:=8; 397 end;
398 Result := 8;
408 end; 399 end;
409 400
410 function DEC_DE:byte; 401 function LD_A_xDE: byte;
411 begin 402 begin
412 asm 403 asm
413 dec de.w 404 MOV AX,de.w
414 end; 405 PUSH EAX
406 CALL speekb
407 LEA ESP,[ESP+4]
408 MOV af.h,AL
409 end;
415 410
416 result:=8; 411 Result := 8;
417 end; 412 end;
418 413
419 function INC_E:byte; 414 function DEC_DE: byte;
420 begin 415 begin
421 asm 416 asm
422 inc de.l 417 DEC de.w
423 lahf 418 end;
424 and eax,$5100
425 and af.l,1
426 or af.l,ah
427 end;
428 419
429 result:=4; 420 Result := 8;
430 end; 421 end;
431 422
432 function DEC_E:byte; 423 function INC_E: byte;
433 begin 424 begin
434 asm 425 asm
435 dec de.l 426 INC de.l
436 lahf 427 LAHF
437 and af.l,1 428 AND EAX,$5100
438 and eax,$5500 429 AND af.l,1
439 or eax,$400 430 OR af.l,AH
440 or af.l,ah 431 end;
441 end;
442 432
443 result:=4; 433 Result := 4;
444 end; 434 end;
445 435
446 function LD_E_BYTE:byte; 436 function DEC_E: byte;
447 begin 437 begin
448 asm 438 asm
449 push dword ptr pc.w 439 DEC de.l
450 call speekb 440 LAHF
451 lea esp,[esp+4] 441 AND af.l,1
452 mov de.l,al 442 AND EAX,$5500
453 inc word ptr pc.w 443 OR EAX,$400
454 end; 444 OR af.l,AH
445 end;
455 446
456 result:=8; 447 Result := 4;
457 end; 448 end;
458 449
459 function RRA:byte; 450 function LD_E_BYTE: byte;
460 begin 451 begin
461 asm 452 asm
462 mov ah,af.l 453 PUSH dword ptr pc.w
463 sahf 454 CALL speekb
464 rcr af.h,1 455 LEA ESP,[ESP+4]
465 lahf 456 MOV de.l,AL
466 and ah,1 457 INC word ptr pc.w
467 mov af.l,ah 458 end;
468 end;
469 result:=4;
470 end;
471 459
472 function JR_NZ:byte; 460 Result := 8;
473 begin
474 asm
475 push dword ptr pc.w
476 call speekb
477 lea esp,[esp+4]
478 inc word ptr pc.w
479 test af.l,64
480 mov cycle,8
481 jnz @ende
482 mov cycle,12
483 cbw
484 add pc.w,ax
485 @ende:
486 end;
487 result:=cycle;
488 end; 461 end;
489 462
490 function LD_HL_WORD:byte; 463 function RRA: byte;
491 begin 464 begin
492 asm 465 asm
493 push dword ptr pc.w 466 MOV AH,af.l
494 call speekb 467 SAHF
495 lea esp,[esp+4] 468 RCR af.h,1
496 mov hl.l,al 469 LAHF
497 inc word ptr pc.w 470 AND AH,1
498 push dword ptr pc.w 471 MOV af.l,AH
499 call speekb 472 end;
500 lea esp,[esp+4] 473 Result := 4;
501 mov hl.h,al 474 end;
502 inc word ptr pc.w 475
503 end; 476 function JR_NZ: byte;
504 result:=12; 477 begin
478 asm
479 PUSH dword ptr pc.w
480 CALL speekb
481 LEA ESP,[ESP+4]
482 INC word ptr pc.w
483 TEST af.l,64
484 MOV cycle,8
485 JNZ @ende
486 MOV cycle,12
487 CBW
488 ADD pc.w,AX
489 @ende:
490 end;
491 Result := cycle;
492 end;
493
494 function LD_HL_WORD: byte;
495 begin
496 asm
497 PUSH dword ptr pc.w
498 CALL speekb
499 LEA ESP,[ESP+4]
500 MOV hl.l,AL
501 INC word ptr pc.w
502 PUSH dword ptr pc.w
503 CALL speekb
504 LEA ESP,[ESP+4]
505 MOV hl.h,AL
506 INC word ptr pc.w
507 end;
508 Result := 12;
505 end; 509 end;
506 510
507 function LD_xWORD_HL:byte; 511 function LD_xWORD_HL: byte;
508 begin 512 begin
509 asm 513 asm
510 mov ax,hl.w 514 MOV AX,hl.w
511 push eax 515 PUSH EAX
512 push dword ptr af.h 516 PUSH dword ptr af.h
513 push eax 517 PUSH EAX
514 call SpokeB 518 CALL SpokeB
515 lea esp,[esp+8] 519 LEA ESP,[ESP+8]
516 pop eax 520 POP EAX
517 inc eax 521 INC EAX
518 mov hl.w,ax 522 MOV hl.w,AX
519 end; 523 end;
520 result:=8; 524 Result := 8;
521 end; 525 end;
522 526
523 function INC_HL:byte; 527 function INC_HL: byte;
524 begin 528 begin
525 asm 529 asm
526 inc hl.w 530 INC hl.w
527 end; 531 end;
528 result:=8; 532 Result := 8;
529 end; 533 end;
530 534
531 function INC_H:byte; 535 function INC_H: byte;
532 begin 536 begin
533 asm 537 asm
534 inc hl.h 538 INC hl.h
535 lahf 539 LAHF
536 and eax,$5100 540 AND EAX,$5100
537 and af.l,1 541 AND af.l,1
538 or af.l,ah 542 OR af.l,AH
539 end; 543 end;
540 544
541 result:=4; 545 Result := 4;
542 end; 546 end;
543 547
544 function DEC_H:byte; 548 function DEC_H: byte;
545 begin 549 begin
546 asm 550 asm
547 dec hl.h 551 DEC hl.h
548 lahf 552 LAHF
549 and af.l,1 553 AND af.l,1
550 and eax,$5500 554 AND EAX,$5500
551 or eax,$400 555 OR EAX,$400
552 or af.l,ah 556 OR af.l,AH
553 end; 557 end;
554 558
555 result:=4; 559 Result := 4;
556 end; 560 end;
557 561
558 function LD_H_BYTE:byte; 562 function LD_H_BYTE: byte;
559 begin 563 begin
560 asm 564 asm
561 push dword ptr pc.w 565 PUSH dword ptr pc.w
562 call speekb 566 CALL speekb
563 lea esp,[esp+4] 567 LEA ESP,[ESP+4]
564 mov hl.h,al 568 MOV hl.h,AL
565 inc word ptr pc.w 569 INC word ptr pc.w
566 end; 570 end;
567 571
568 result:=8; 572 Result := 8;
569 end; 573 end;
570 574
571 function DAA:byte; 575 function DAA: byte;
572 begin 576 begin
573 asm 577 asm
574 mov ah,af.l 578 MOV AH,af.l
575 mov bl,ah 579 MOV BL,AH
576 and bl,4 580 AND BL,4
577 sahf 581 SAHF
578 mov al,af.h 582 MOV AL,af.h
579 jp @dec_adjust 583 JP @dec_adjust
580 daa 584 DAA
581 jmp @ddld 585 JMP @ddld
582 586
583 @dec_adjust: 587 @dec_adjust:
584 das 588 DAS
585 589
586 @ddld: 590 @ddld:
587 mov af.h,al 591 MOV af.h,AL
588 lahf 592 LAHF
589 and ah,65 593 AND AH,65
590 or ah,bl 594 OR AH,BL
591 mov af.l,ah 595 MOV af.l,AH
592 end; 596 end;
593 597
594 598
595 599
596 result:=4; 600 Result := 4;
597 end; 601 end;
598 602
599 function JR_Z:byte; 603 function JR_Z: byte;
600 604
601 begin 605 begin
602 asm 606 asm
603 push dword ptr pc.w 607 PUSH dword ptr pc.w
604 call speekb 608 CALL speekb
605 lea esp,[esp+4] 609 LEA ESP,[ESP+4]
606 inc word ptr pc.w 610 INC word ptr pc.w
607 test af.l,64 611 TEST af.l,64
608 mov cycle,8 612 MOV cycle,8
609 jz @ende 613 JZ @ende
610 mov cycle,12 614 MOV cycle,12
611 cbw 615 CBW
612 add pc.w,ax 616 ADD pc.w,AX
613 @ende: 617 @ende:
614 end; 618 end;
615 619
616 result:=cycle; 620 Result := cycle;
617 end; 621 end;
618 622
619 function ADD_HL_HL:byte; 623 function ADD_HL_HL: byte;
620 begin 624 begin
621 asm 625 asm
622 and af.l,64 626 AND af.l,64
623 mov ax,hl.w 627 MOV AX,hl.w
624 xor ecx,ecx 628 XOR ECX,ECX
625 629
626 add ax,ax 630 ADD AX,AX
627 jnc @1 631 JNC @1
628 or af.l,1 632 OR af.l,1
629 @1: 633 @1:
630 xor ecx,eax 634 XOR ECX,EAX
631 test cx,4096 635 TEST CX,4096
632 jz @ende 636 JZ @ende
633 or af.l,16 637 OR af.l,16
634 @ende: 638 @ende:
635 mov hl.w,ax 639 MOV hl.w,AX
636 640
637 end; 641 end;
638 642
639 result:=8; 643 Result := 8;
640 end; 644 end;
641 645
642 function LD_HL_xWORD:byte; 646 function LD_HL_xWORD: byte;
643 begin 647 begin
644 648
645 asm 649 asm
646 mov ax,hl.w 650 MOV AX,hl.w
647 push eax 651 PUSH EAX
648 push eax 652 PUSH EAX
649 call speekb 653 CALL speekb
650 lea esp,[esp+4] 654 LEA ESP,[ESP+4]
651 mov af.h,al 655 MOV af.h,AL
652 pop eax 656 POP EAX
653 inc ax 657 INC AX
654 mov hl.w,ax 658 MOV hl.w,AX
655 end; 659 end;
656 660
657 result:=8; 661 Result := 8;
658 end; 662 end;
659 663
660 function DEC_HL:byte; 664 function DEC_HL: byte;
661 begin 665 begin
662 asm 666 asm
663 dec hl.w 667 DEC hl.w
664 end; 668 end;
665 669
666 result:=8; 670 Result := 8;
667 end; 671 end;
668 672
669 function INC_L:byte; 673 function INC_L: byte;
670 begin 674 begin
671 asm 675 asm
672 inc hl.l 676 INC hl.l
673 lahf 677 LAHF
674 and eax,$5100 678 AND EAX,$5100
675 and af.l,1 679 AND af.l,1
676 or af.l,ah 680 OR af.l,AH
677 end; 681 end;
678 682
679 result:=4; 683 Result := 4;
680 end; 684 end;
681 685
682 function DEC_L:byte; 686 function DEC_L: byte;
683 begin 687 begin
684 asm 688 asm
685 dec hl.l 689 DEC hl.l
686 lahf 690 LAHF
687 and af.l,1 691 AND af.l,1
688 and eax,$5500 692 AND EAX,$5500
689 or eax,$400 693 OR EAX,$400
690 or af.l,ah 694 OR af.l,AH
691 end; 695 end;
692 696
693 result:=4; 697 Result := 4;
694 end; 698 end;
695 699
696 function LD_L_BYTE:byte; 700 function LD_L_BYTE: byte;
697 begin 701 begin
698 asm 702 asm
699 push dword ptr pc.w 703 PUSH dword ptr pc.w
700 call speekb 704 CALL speekb
701 lea esp,[esp+4] 705 LEA ESP,[ESP+4]
702 inc word ptr pc.w 706 INC word ptr pc.w
703 mov hl.l,al 707 MOV hl.l,AL
704 end; 708 end;
705 709
706 result:=8; 710 Result := 8;
707 end; 711 end;
708 712
709 function CPL:byte; 713 function CPL: byte;
710 begin 714 begin
711 asm 715 asm
712 xor af.h,255 716 XOR af.h,255
713 717
714 or af.l,$14 718 OR af.l,$14
715 719
716 end; 720 end;
717 721
718 result:=4; 722 Result := 4;
719 end; 723 end;
720 724
721 function JR_NC:byte; 725 function JR_NC: byte;
722
723 begin
724 asm
725 push dword ptr pc.w
726 call speekb
727 lea esp,[esp+4]
728 inc word ptr pc.w
729 test af.l,1
730 mov cycle,8
731 jnz @ende
732 mov cycle,12
733 cbw
734 add pc.w,ax
735 @ende:
736 end;
737
738 result:=cycle;
739 end;
740 726
741 function LD_SP_WORD:byte;
742 begin 727 begin
743 asm 728 asm
744 push dword ptr pc.w 729 PUSH dword ptr pc.w
745 call speekb 730 CALL speekb
746 lea esp,[esp+4] 731 LEA ESP,[ESP+4]
747 inc word ptr pc.w 732 INC word ptr pc.w
748 push eax 733 TEST af.l,1
749 push dword ptr pc.w 734 MOV cycle,8
750 call speekb 735 JNZ @ende
751 lea esp,[esp+4] 736 MOV cycle,12
752 inc word ptr pc.w 737 CBW
753 shl eax,8 738 ADD pc.w,AX
754 pop ebx 739 @ende:
755 mov al,bl 740 end;
756 741
757 mov sp_.w,ax 742 Result := cycle;
758 end;
759 //sp_.w:=wordpeek(pc.w);inc(pc.w,2);
760 result:=12;
761 end; 743 end;
762 744
763 function LD_xWORD_A:byte; 745 function LD_SP_WORD: byte;
764 begin 746 begin
765 asm 747 asm
766 mov ax,hl.w 748 PUSH dword ptr pc.w
767 push eax 749 CALL speekb
768 push dword ptr af.h 750 LEA ESP,[ESP+4]
769 push eax 751 INC word ptr pc.w
770 call SpokeB 752 PUSH EAX
771 lea esp,[esp+8] 753 PUSH dword ptr pc.w
772 pop eax 754 CALL speekb
773 dec ax 755 LEA ESP,[ESP+4]
774 mov hl.w,ax 756 INC word ptr pc.w
775 end; 757 SHL EAX,8
776 758 POP EBX
759 MOV AL,BL
777 760
761 MOV sp_.w,AX
762 end;
763 //sp_.w:=wordpeek(pc.w);inc(pc.w,2);
764 Result := 12;
765 end;
766
767 function LD_xWORD_A: byte;
768 begin
769 asm
770 MOV AX,hl.w
771 PUSH EAX
772 PUSH dword ptr af.h
773 PUSH EAX
774 CALL SpokeB
775 LEA ESP,[ESP+8]
776 POP EAX
777 DEC AX
778 MOV hl.w,AX
779 end;
778 780
779 781
780 result:=8;
781 end;
782 782
783 function INC_SP:byte;
784 begin
785 asm
786 inc sp_.w
787 end;
788 783
789 result:=8; 784 Result := 8;
790 end; 785 end;
791 786
792 function INC_xHL:byte; 787 function INC_SP: byte;
793 begin 788 begin
794 asm 789 asm
795 mov ax,hl.w 790 INC sp_.w
796 push eax 791 end;
797 push eax
798 call speekb
799 lea esp,[esp+4]
800 inc al
801 lahf
802 and ah,$51
803 and af.l,1
804 or af.l,ah
805 pop ebx
806 push eax
807 push ebx
808 call SpokeB
809 lea esp,[esp+8]
810 end;
811 792
793 Result := 8;
794 end;
795
796 function INC_xHL: byte;
797 begin
798 asm
799 MOV AX,hl.w
800 PUSH EAX
801 PUSH EAX
802 CALL speekb
803 LEA ESP,[ESP+4]
804 INC AL
805 LAHF
806 AND AH,$51
807 AND af.l,1
808 OR af.l,AH
809 POP EBX
810 PUSH EAX
811 PUSH EBX
812 CALL SpokeB
813 LEA ESP,[ESP+8]
814 end;
812 815
813 result:=12;
814 end;
815 816
816 function DEC_xHL:byte; 817 Result := 12;
817 begin 818 end;
818 asm 819
819 mov ax,hl.w 820 function DEC_xHL: byte;
820 push eax 821 begin
821 push eax 822 asm
822 call speekb 823 MOV AX,hl.w
823 lea esp,[esp+4] 824 PUSH EAX
824 dec al 825 PUSH EAX
825 lahf 826 CALL speekb
826 and af.l,1 827 LEA ESP,[ESP+4]
827 and ah,$55 828 DEC AL
828 or eax,$400 829 LAHF
829 or af.l,ah 830 AND af.l,1
830 pop ebx 831 AND AH,$55
831 push eax 832 OR EAX,$400
832 push ebx 833 OR af.l,AH
833 call SpokeB 834 POP EBX
834 lea esp,[esp+8] 835 PUSH EAX
835 end; 836 PUSH EBX
836 result:=12; 837 CALL SpokeB
838 LEA ESP,[ESP+8]
839 end;
840 Result := 12;
837 end; 841 end;
838 842
839 function LD_xHL_BYTE:byte; 843 function LD_xHL_BYTE: byte;
840 begin 844 begin
841 asm 845 asm
842 push dword ptr pc.w 846 PUSH dword ptr pc.w
843 call speekb 847 CALL speekb
844 lea esp,[esp+4] 848 LEA ESP,[ESP+4]
845 inc word ptr pc.w 849 INC word ptr pc.w
846 push eax 850 PUSH EAX
847 mov ax,hl.w 851 MOV AX,hl.w
848 push eax 852 PUSH EAX
849 call SpokeB 853 CALL SpokeB
850 lea esp,[esp+8] 854 LEA ESP,[ESP+8]
851 end; 855 end;
852 856
853 857
854 result:=12; 858 Result := 12;
855 end; 859 end;
856 860
857 function SCF:byte; 861 function SCF: byte;
858 begin 862 begin
859 asm 863 asm
860 and af.l,64 864 AND af.l,64
861 or af.l,1 865 OR af.l,1
862 end; 866 end;
863 867
864 result:=4; 868 Result := 4;
865 end; 869 end;
866 870
867 function JR_C:byte; 871 function JR_C: byte;
868 872
869 begin 873 begin
870 asm 874 asm
871 push dword ptr pc.w 875 PUSH dword ptr pc.w
872 call speekb 876 CALL speekb
873 lea esp,[esp+4] 877 LEA ESP,[ESP+4]
874 inc word ptr pc.w 878 INC word ptr pc.w
875 test af.l,1 879 TEST af.l,1
876 mov cycle,8 880 MOV cycle,8
877 jz @ende 881 JZ @ende
878 mov cycle,12 882 MOV cycle,12
879 cbw 883 CBW
880 add pc.w,ax 884 ADD pc.w,AX
881 @ende: 885 @ende:
882 end; 886 end;
883 887
884 result:=cycle; 888 Result := cycle;
885 end; 889 end;
886 890
887 function ADD_HL_SP:byte; 891 function ADD_HL_SP: byte;
888 begin 892 begin
889 asm 893 asm
890 and af.l,64 894 AND af.l,64
891 mov ax,hl.w 895 MOV AX,hl.w
892 mov bx,sp_.w 896 MOV BX,sp_.w
893 897
894 898
895 mov ecx,eax 899 MOV ECX,EAX
896 xor ecx,ebx 900 XOR ECX,EBX
897 901
898 add ax,bx 902 ADD AX,BX
899 jnc @1 903 JNC @1
900 or af.l,1 904 OR af.l,1
901 @1: 905 @1:
902 xor ecx,eax 906 XOR ECX,EAX
903 test ecx,4096 907 TEST ECX,4096
904 jz @ende 908 JZ @ende
905 or af.l,16 909 OR af.l,16
906 @ende: 910 @ende:
907 mov hl.w,ax 911 MOV hl.w,AX
908 end; 912 end;
909 result:=8; 913 Result := 8;
910 end; 914 end;
911 915
912 function LD_A_xWORD:byte; 916 function LD_A_xWORD: byte;
913 begin 917 begin
914 918
915 asm 919 asm
916 mov ax,hl.w 920 MOV AX,hl.w
917 push eax 921 PUSH EAX
918 push eax 922 PUSH EAX
919 call speekb 923 CALL speekb
920 lea esp,[esp+4] 924 LEA ESP,[ESP+4]
921 mov af.h,al 925 MOV af.h,AL
922 pop eax 926 POP EAX
923 dec ax 927 DEC AX
924 mov hl.w,ax 928 MOV hl.w,AX
925 end; 929 end;
926 930
927 result:=8; 931 Result := 8;
928 end; 932 end;
929 933
930 function DEC_SP:byte; 934 function DEC_SP: byte;
931 begin 935 begin
932 asm 936 asm
933 dec sp_.w 937 DEC sp_.w
934 end; 938 end;
935 result:=8; 939 Result := 8;
936 end; 940 end;
937 941
938 function INC_A:byte; 942 function INC_A: byte;
939 begin 943 begin
940 asm 944 asm
941 inc af.h 945 INC af.h
942 lahf 946 LAHF
943 and eax,$5100 947 AND EAX,$5100
944 and af.l,1 948 AND af.l,1
945 or af.l,ah 949 OR af.l,AH
946 end; 950 end;
947 951
948 result:=4; 952 Result := 4;
949 end; 953 end;
950 954
951 function DEC_A:byte; 955 function DEC_A: byte;
952 begin 956 begin
953 asm 957 asm
954 dec af.h 958 DEC af.h
955 lahf 959 LAHF
956 and af.l,1 960 AND af.l,1
957 and eax,$5500 961 AND EAX,$5500
958 or eax,$400 962 OR EAX,$400
959 or af.l,ah 963 OR af.l,AH
960 end; 964 end;
961 965
962 result:=4; 966 Result := 4;
963 end; 967 end;
964 968
965 function LD_A_BYTE:byte; 969 function LD_A_BYTE: byte;
966 begin 970 begin
967 asm 971 asm
968 push dword ptr pc.w 972 PUSH dword ptr pc.w
969 call speekb 973 CALL speekb
970 lea esp,[esp+4] 974 LEA ESP,[ESP+4]
971 mov af.h,al 975 MOV af.h,AL
972 inc word ptr pc.w 976 INC word ptr pc.w
973 end; 977 end;
974 978
975 result:=8; 979 Result := 8;
976 end; 980 end;
977 981
978 function CCF:byte; 982 function CCF: byte;
979 begin 983 begin
980 asm 984 asm
981 mov ah,af.l 985 MOV AH,af.l
982 sahf 986 SAHF
983 cmc 987 CMC
984 lahf 988 LAHF
985 and ah,65 989 AND AH,65
986 mov af.l,ah 990 MOV af.l,AH
987 end; 991 end;
988 992
989 result:=4; 993 Result := 4;
990 end; 994 end;
991 995
992 function LD_B_B:byte; 996 function LD_B_B: byte;
993 begin 997 begin
994 result:=4; 998 Result := 4;
995 end; 999 end;
996 1000
997 function LD_B_C:byte; 1001 function LD_B_C: byte;
998 begin 1002 begin
999 bc.h:=bc.l; 1003 bc.h := bc.l;
1000 result:=4; 1004 Result := 4;
1001 end; 1005 end;
1002 1006
1003 function LD_B_D:byte; 1007 function LD_B_D: byte;
1004 begin 1008 begin
1005 bc.h:=de.h; 1009 bc.h := de.h;
1006 result:=4; 1010 Result := 4;
1007 end; 1011 end;
1008 1012
1009 function LD_B_E:byte; 1013 function LD_B_E: byte;
1010 begin 1014 begin
1011 bc.h:=de.l; 1015 bc.h := de.l;
1012 result:=4; 1016 Result := 4;
1013 end; 1017 end;
1014 1018
1015 function LD_B_H:byte; 1019 function LD_B_H: byte;
1016 begin 1020 begin
1017 bc.h:=hl.h; 1021 bc.h := hl.h;
1018 result:=4; 1022 Result := 4;
1019 end; 1023 end;
1020 1024
1021 function LD_B_L:byte; 1025 function LD_B_L: byte;
1022 begin 1026 begin
1023 bc.h:=hl.l; 1027 bc.h := hl.l;
1024 result:=4; 1028 Result := 4;
1025 end; 1029 end;
1026 1030
1027 function LD_B_xHL:byte; 1031 function LD_B_xHL: byte;
1028 begin 1032 begin
1029 asm 1033 asm
1030 mov ax,hl.w 1034 MOV AX,hl.w
1031 push eax 1035 PUSH EAX
1032 call speekb 1036 CALL speekb
1033 lea esp,[esp+4] 1037 LEA ESP,[ESP+4]
1034 mov bc.h,al 1038 MOV bc.h,AL
1035 end; 1039 end;
1036 1040
1037 1041
1038 result:=8; 1042 Result := 8;
1039 end; 1043 end;
1040 1044
1041 function LD_B_A:byte; 1045 function LD_B_A: byte;
1042 begin 1046 begin
1043 bc.h:=af.h; 1047 bc.h := af.h;
1044 result:=4; 1048 Result := 4;
1045 end; 1049 end;
1046 1050
1047 function LD_C_B:byte; 1051 function LD_C_B: byte;
1048 begin 1052 begin
1049 bc.l:=bc.h; 1053 bc.l := bc.h;
1050 result:=4; 1054 Result := 4;
1051 end; 1055 end;
1052 1056
1053 function LD_C_C:byte; 1057 function LD_C_C: byte;
1054 begin 1058 begin
1055 result:=4; 1059 Result := 4;
1056 end; 1060 end;
1057 1061
1058 function LD_C_D:byte; 1062 function LD_C_D: byte;
1059 begin 1063 begin
1060 bc.l:=de.h; 1064 bc.l := de.h;
1061 result:=4; 1065 Result := 4;
1062 end; 1066 end;
1063 1067
1064 function LD_C_E:byte; 1068 function LD_C_E: byte;
1065 begin 1069 begin
1066 bc.l:=de.l; 1070 bc.l := de.l;
1067 result:=4; 1071 Result := 4;
1068 end; 1072 end;
1069 1073
1070 function LD_C_H:byte; 1074 function LD_C_H: byte;
1071 begin 1075 begin
1072 bc.l:=hl.h; 1076 bc.l := hl.h;
1073 result:=4; 1077 Result := 4;
1074 end; 1078 end;
1075 1079
1076 function LD_C_L:byte; 1080 function LD_C_L: byte;
1077 begin 1081 begin
1078 bc.l:=hl.l; 1082 bc.l := hl.l;
1079 result:=4; 1083 Result := 4;
1080 end; 1084 end;
1081 1085
1082 function LD_C_xHL:byte; 1086 function LD_C_xHL: byte;
1083 begin 1087 begin
1084 asm 1088 asm
1085 mov ax,hl.w 1089 MOV AX,hl.w
1086 push eax 1090 PUSH EAX
1087 call speekb 1091 CALL speekb
1088 lea esp,[esp+4] 1092 LEA ESP,[ESP+4]
1089 mov bc.l,al 1093 MOV bc.l,AL
1090 end; 1094 end;
1091 1095
1092 result:=8; 1096 Result := 8;
1093 end; 1097 end;
1094 1098
1095 function LD_C_A:byte; 1099 function LD_C_A: byte;
1096 begin 1100 begin
1097 bc.l:=af.h; 1101 bc.l := af.h;
1098 result:=4; 1102 Result := 4;
1099 end; 1103 end;
1100 1104
1101 function LD_D_B:byte; 1105 function LD_D_B: byte;
1102 begin 1106 begin
1103 de.h:=bc.h; 1107 de.h := bc.h;
1104 1108
1105 result:=4; 1109 Result := 4;
1106 end; 1110 end;
1107 1111
1108 function LD_D_C:byte; 1112 function LD_D_C: byte;
1109 begin 1113 begin
1110 de.h:=bc.l; 1114 de.h := bc.l;
1111 result:=4; 1115 Result := 4;
1112 end; 1116 end;
1113 1117
1114 function LD_D_D:byte; 1118 function LD_D_D: byte;
1115 begin 1119 begin
1116 result:=4; 1120 Result := 4;
1117 end; 1121 end;
1118 1122
1119 function LD_D_E:byte; 1123 function LD_D_E: byte;
1120 begin 1124 begin
1121 de.h:=de.l; 1125 de.h := de.l;
1122 result:=4; 1126 Result := 4;
1123 end; 1127 end;
1124 1128
1125 function LD_D_H:byte; 1129 function LD_D_H: byte;
1126 begin 1130 begin
1127 de.h:=hl.h; 1131 de.h := hl.h;
1128 result:=4; 1132 Result := 4;
1129 end; 1133 end;
1130 1134
1131 function LD_D_L:byte; 1135 function LD_D_L: byte;
1132 begin 1136 begin
1133 de.h:=hl.l; 1137 de.h := hl.l;
1134 result:=4; 1138 Result := 4;
1135 end; 1139 end;
1136 1140
1137 function LD_D_xHL:byte; 1141 function LD_D_xHL: byte;
1138 begin 1142 begin
1139 asm 1143 asm
1140 mov ax,hl.w 1144 MOV AX,hl.w
1141 push eax 1145 PUSH EAX
1142 call speekb 1146 CALL speekb
1143 lea esp,[esp+4] 1147 LEA ESP,[ESP+4]
1144 mov de.h,al 1148 MOV de.h,AL
1145 end; 1149 end;
1146 1150
1147 result:=8; 1151 Result := 8;
1148 end; 1152 end;
1149 1153
1150 function LD_D_A:byte; 1154 function LD_D_A: byte;
1151 begin 1155 begin
1152 de.h:=af.h; 1156 de.h := af.h;
1153 result:=4; 1157 Result := 4;
1154 end; 1158 end;
1155 1159
1156 function LD_E_B:byte; 1160 function LD_E_B: byte;
1157 begin 1161 begin
1158 de.l:=bc.h; 1162 de.l := bc.h;
1159 result:=4; 1163 Result := 4;
1160 end; 1164 end;
1161 1165
1162 function LD_E_C:byte; 1166 function LD_E_C: byte;
1163 begin 1167 begin
1164 de.l:=bc.l; 1168 de.l := bc.l;
1165 result:=4; 1169 Result := 4;
1166 end; 1170 end;
1167 1171
1168 function LD_E_D:byte; 1172 function LD_E_D: byte;
1169 begin 1173 begin
1170 de.l:=de.h; 1174 de.l := de.h;
1171 result:=4; 1175 Result := 4;
1172 end; 1176 end;
1173 1177
1174 function LD_E_E:byte; 1178 function LD_E_E: byte;
1175 begin 1179 begin
1176 result:=4; 1180 Result := 4;
1177 end; 1181 end;
1178 1182
1179 function LD_E_H:byte; 1183 function LD_E_H: byte;
1180 begin 1184 begin
1181 de.l:=hl.h; 1185 de.l := hl.h;
1182 result:=4; 1186 Result := 4;
1183 end; 1187 end;
1184 1188
1185 function LD_E_L:byte; 1189 function LD_E_L: byte;
1186 begin 1190 begin
1187 de.l:=hl.l; 1191 de.l := hl.l;
1188 result:=4; 1192 Result := 4;
1189 end; 1193 end;
1190 1194
1191 function LD_E_xHL:byte; 1195 function LD_E_xHL: byte;
1192 begin 1196 begin
1193 asm 1197 asm
1194 mov ax,hl.w 1198 MOV AX,hl.w
1195 push eax 1199 PUSH EAX
1196 call speekb 1200 CALL speekb
1197 lea esp,[esp+4] 1201 LEA ESP,[ESP+4]
1198 mov de.l,al 1202 MOV de.l,AL
1199 end; 1203 end;
1200 ; 1204 ;
1201 result:=8; 1205 Result := 8;
1202 end; 1206 end;
1203 1207
1204 function LD_E_A:byte; 1208 function LD_E_A: byte;
1205 begin 1209 begin
1206 de.l:=af.h; 1210 de.l := af.h;
1207 result:=4; 1211 Result := 4;
1208 end; 1212 end;
1209 1213
1210 function LD_H_B:byte; 1214 function LD_H_B: byte;
1211 begin 1215 begin
1212 hl.h:=bc.h; 1216 hl.h := bc.h;
1213 result:=4; 1217 Result := 4;
1214 end; 1218 end;
1215 1219
1216 function LD_H_C:byte; 1220 function LD_H_C: byte;
1217 begin 1221 begin
1218 hl.h:=bc.l; 1222 hl.h := bc.l;
1219 result:=4; 1223 Result := 4;
1220 end; 1224 end;
1221 1225
1222 function LD_H_D:byte; 1226 function LD_H_D: byte;
1223 begin 1227 begin
1224 hl.h:=de.h; 1228 hl.h := de.h;
1225 result:=4; 1229 Result := 4;
1226 end; 1230 end;
1227 1231
1228 function LD_H_E:byte; 1232 function LD_H_E: byte;
1229 begin 1233 begin
1230 hl.h:=de.l; 1234 hl.h := de.l;
1231 result:=4; 1235 Result := 4;
1232 end; 1236 end;
1233 1237
1234 function LD_H_H:byte; 1238 function LD_H_H: byte;
1235 begin 1239 begin
1236 result:=4; 1240 Result := 4;
1237 end; 1241 end;
1238 1242
1239 function LD_H_L:byte; 1243 function LD_H_L: byte;
1240 begin 1244 begin
1241 hl.h:=hl.l; 1245 hl.h := hl.l;
1242 result:=4; 1246 Result := 4;
1243 end; 1247 end;
1244 1248
1245 function LD_H_xHL:byte; 1249 function LD_H_xHL: byte;
1246 begin 1250 begin
1247 asm 1251 asm
1248 mov ax,hl.w 1252 MOV AX,hl.w
1249 push eax 1253 PUSH EAX
1250 call speekb 1254 CALL speekb
1251 lea esp,[esp+4] 1255 LEA ESP,[ESP+4]
1252 mov hl.h,al 1256 MOV hl.h,AL
1253 end; 1257 end;
1254 1258
1255 result:=8; 1259 Result := 8;
1256 end; 1260 end;
1257 1261
1258 function LD_H_A:byte; 1262 function LD_H_A: byte;
1259 begin 1263 begin
1260 hl.h:=af.h; 1264 hl.h := af.h;
1261 result:=4; 1265 Result := 4;
1262 end; 1266 end;
1263 1267
1264 function LD_L_B:byte; 1268 function LD_L_B: byte;
1265 begin 1269 begin
1266 hl.l:=bc.h; 1270 hl.l := bc.h;
1267 result:=4; 1271 Result := 4;
1268 end; 1272 end;
1269 1273
1270 function LD_L_C:byte; 1274 function LD_L_C: byte;
1271 begin 1275 begin
1272 hl.l:=bc.l; 1276 hl.l := bc.l;
1273 result:=4; 1277 Result := 4;
1274 end; 1278 end;
1275 1279
1276 function LD_L_D:byte; 1280 function LD_L_D: byte;
1277 begin 1281 begin
1278 hl.l:=de.h; 1282 hl.l := de.h;
1279 result:=4; 1283 Result := 4;
1280 end; 1284 end;
1281 1285
1282 function LD_L_E:byte; 1286 function LD_L_E: byte;
1283 begin 1287 begin
1284 hl.l:=de.l; 1288 hl.l := de.l;
1285 result:=4; 1289 Result := 4;
1286 end; 1290 end;
1287 1291
1288 function LD_L_H:byte; 1292 function LD_L_H: byte;
1289 begin 1293 begin
1290 hl.l:=hl.h; 1294 hl.l := hl.h;
1291 result:=4; 1295 Result := 4;
1292 end; 1296 end;
1293 1297
1294 function LD_L_L:byte; 1298 function LD_L_L: byte;
1295 begin 1299 begin
1296 result:=4; 1300 Result := 4;
1297 end; 1301 end;
1298 1302
1299 function LD_L_xHL:byte; 1303 function LD_L_xHL: byte;
1300 begin 1304 begin
1301 asm 1305 asm
1302 mov ax,hl.w 1306 MOV AX,hl.w
1303 push eax 1307 PUSH EAX
1304 call speekb 1308 CALL speekb
1305 lea esp,[esp+4] 1309 LEA ESP,[ESP+4]
1306 mov hl.l,al 1310 MOV hl.l,AL
1307 end; 1311 end;
1308 1312
1309 result:=8; 1313 Result := 8;
1310 end; 1314 end;
1311 1315
1312 function LD_L_A:byte; 1316 function LD_L_A: byte;
1313 begin 1317 begin
1314 hl.l:=af.h; 1318 hl.l := af.h;
1315 result:=4; 1319 Result := 4;
1316 end; 1320 end;
1317 1321
1318 function LD_xHL_B:byte; 1322 function LD_xHL_B: byte;
1319 begin 1323 begin
1320 asm 1324 asm
1321 mov ax,hl.w 1325 MOV AX,hl.w
1322 push dword ptr bc.h 1326 PUSH dword ptr bc.h
1323 push eax 1327 PUSH EAX
1324 call SpokeB 1328 CALL SpokeB
1325 lea esp,[esp+8] 1329 LEA ESP,[ESP+8]
1326 end; 1330 end;
1327 1331
1328 result:=8; 1332 Result := 8;
1329 end; 1333 end;
1330 1334
1331 function LD_xHL_C:byte; 1335 function LD_xHL_C: byte;
1332 begin 1336 begin
1333 asm 1337 asm
1334 mov ax,hl.w 1338 MOV AX,hl.w
1335 push dword ptr bc.l 1339 PUSH dword ptr bc.l
1336 push eax 1340 PUSH EAX
1337 call SpokeB 1341 CALL SpokeB
1338 lea esp,[esp+8] 1342 LEA ESP,[ESP+8]
1339 end; 1343 end;
1340 1344
1341 result:=8; 1345 Result := 8;
1342 end; 1346 end;
1343 1347
1344 function LD_xHL_D:byte; 1348 function LD_xHL_D: byte;
1345 begin 1349 begin
1346 asm 1350 asm
1347 mov ax,hl.w 1351 MOV AX,hl.w
1348 push dword ptr de.h 1352 PUSH dword ptr de.h
1349 push eax 1353 PUSH EAX
1350 call SpokeB 1354 CALL SpokeB
1351 lea esp,[esp+8] 1355 LEA ESP,[ESP+8]
1352 end; 1356 end;
1353 1357
1354 result:=8; 1358 Result := 8;
1355 end; 1359 end;
1356 1360
1357 function LD_xHL_E:byte; 1361 function LD_xHL_E: byte;
1358 begin 1362 begin
1359 asm 1363 asm
1360 mov ax,hl.w 1364 MOV AX,hl.w
1361 push dword ptr de.l 1365 PUSH dword ptr de.l
1362 push eax 1366 PUSH EAX
1363 call SpokeB 1367 CALL SpokeB
1364 lea esp,[esp+8] 1368 LEA ESP,[ESP+8]
1365 end; 1369 end;
1366 1370
1367 result:=8; 1371 Result := 8;
1368 end; 1372 end;
1369 1373
1370 function LD_xHL_H:byte; 1374 function LD_xHL_H: byte;
1371 begin 1375 begin
1372 asm 1376 asm
1373 mov ax,hl.w 1377 MOV AX,hl.w
1374 push dword ptr hl.h 1378 PUSH dword ptr hl.h
1375 push eax 1379 PUSH EAX
1376 call SpokeB 1380 CALL SpokeB
1377 lea esp,[esp+8] 1381 LEA ESP,[ESP+8]
1378 end; 1382 end;
1379 1383
1380 result:=8; 1384 Result := 8;
1381 end; 1385 end;
1382 1386
1383 function LD_xHL_L:byte; 1387 function LD_xHL_L: byte;
1384 begin 1388 begin
1385 asm 1389 asm
1386 mov ax,hl.w 1390 MOV AX,hl.w
1387 push dword ptr hl.l 1391 PUSH dword ptr hl.l
1388 push eax 1392 PUSH EAX
1389 call SpokeB 1393 CALL SpokeB
1390 lea esp,[esp+8] 1394 LEA ESP,[ESP+8]
1391 end; 1395 end;
1392 1396
1393 result:=8; 1397 Result := 8;
1394 end; 1398 end;
1395 1399
1396 function HALT:byte; 1400 function HALT: byte;
1397 begin 1401 begin
1398 if gbr_ime then halt_mode:=1 else halt_mode:=2; 1402 if gbr_ime then
1399 result:=4; 1403 halt_mode := 1
1404 else
1405 halt_mode := 2;
1406 Result := 4;
1400 end; 1407 end;
1401 1408
1402 function LD_xHL_A:byte; 1409 function LD_xHL_A: byte;
1403 begin 1410 begin
1404 asm 1411 asm
1405 mov ax,hl.w 1412 MOV AX,hl.w
1406 push dword ptr af.h 1413 PUSH dword ptr af.h
1407 push eax 1414 PUSH EAX
1408 call SpokeB 1415 CALL SpokeB
1409 lea esp,[esp+8] 1416 LEA ESP,[ESP+8]
1410 end; 1417 end;
1411 1418
1412 result:=8; 1419 Result := 8;
1413 end; 1420 end;
1414 1421
1415 function LD_A_B:byte; 1422 function LD_A_B: byte;
1416 begin 1423 begin
1417 af.h:=bc.h; 1424 af.h := bc.h;
1418 result:=4; 1425 Result := 4;
1419 end; 1426 end;
1420 1427
1421 function LD_A_C:byte; 1428 function LD_A_C: byte;
1422 begin 1429 begin
1423 af.h:=bc.l; 1430 af.h := bc.l;
1424 result:=4; 1431 Result := 4;
1425 end; 1432 end;
1426 1433
1427 function LD_A_D:byte; 1434 function LD_A_D: byte;
1428 begin 1435 begin
1429 af.h:=de.h; 1436 af.h := de.h;
1430 result:=4; 1437 Result := 4;
1431 end; 1438 end;
1432 1439
1433 function LD_A_E:byte; 1440 function LD_A_E: byte;
1434 begin 1441 begin
1435 af.h:=de.l; 1442 af.h := de.l;
1436 result:=4; 1443 Result := 4;
1437 end; 1444 end;
1438 1445
1439 function LD_A_H:byte; 1446 function LD_A_H: byte;
1440 begin 1447 begin
1441 af.h:=hl.h; 1448 af.h := hl.h;
1442 result:=4; 1449 Result := 4;
1443 end; 1450 end;
1444 1451
1445 function LD_A_L:byte; 1452 function LD_A_L: byte;
1446 begin 1453 begin
1447 af.h:=hl.l; 1454 af.h := hl.l;
1448 result:=4; 1455 Result := 4;
1449 end; 1456 end;
1450 1457
1451 function LD_A_xHL:byte; 1458 function LD_A_xHL: byte;
1452 begin 1459 begin
1453 asm 1460 asm
1454 mov ax,hl.w 1461 MOV AX,hl.w
1455 push eax 1462 PUSH EAX
1456 call speekb 1463 CALL speekb
1457 lea esp,[esp+4] 1464 LEA ESP,[ESP+4]
1458 mov af.h,al 1465 MOV af.h,AL
1459 end; 1466 end;
1460 1467
1461 result:=8; 1468 Result := 8;
1462 end; 1469 end;
1463 1470
1464 function LD_A_A:byte; 1471 function LD_A_A: byte;
1465 begin 1472 begin
1466 result:=4; 1473 Result := 4;
1467 end; 1474 end;
1468 1475
1469 function ADD_B:byte; 1476 function ADD_B: byte;
1470 begin 1477 begin
1471 asm 1478 asm
1472 mov al,bc.h 1479 MOV AL,bc.h
1473 add af.h,al 1480 ADD af.h,AL
1474 lahf 1481 LAHF
1475 and eax,$5100 1482 AND EAX,$5100
1476 mov af.l,ah 1483 MOV af.l,AH
1477 1484
1478 end; 1485 end;
1479 result:=4; 1486 Result := 4;
1480 end; 1487 end;
1481 1488
1482 function ADD_C:byte; 1489 function ADD_C: byte;
1483 begin 1490 begin
1484 asm 1491 asm
1485 mov al,bc.l 1492 MOV AL,bc.l
1486 add af.h,al 1493 ADD af.h,AL
1487 lahf 1494 LAHF
1488 and ah,81 1495 AND AH,81
1489 mov af.l,ah 1496 MOV af.l,AH
1490 1497
1491 end; 1498 end;
1492 result:=4; 1499 Result := 4;
1493 end; 1500 end;
1494 1501
1495 function ADD_D:byte; 1502 function ADD_D: byte;
1496 begin 1503 begin
1497 asm 1504 asm
1498 mov al,de.h 1505 MOV AL,de.h
1499 add af.h,al 1506 ADD af.h,AL
1500 lahf 1507 LAHF
1501 and ah,81 1508 AND AH,81
1502 mov af.l,ah 1509 MOV af.l,AH
1503 1510
1504 end; 1511 end;
1505 1512
1506 result:=4; 1513 Result := 4;
1507 end; 1514 end;
1508 1515
1509 function ADD_E:byte; 1516 function ADD_E: byte;
1510 begin 1517 begin
1511 asm 1518 asm
1512 mov al,de.l 1519 MOV AL,de.l
1513 add af.h,al 1520 ADD af.h,AL
1514 lahf 1521 LAHF
1515 and ah,81 1522 AND AH,81
1516 mov af.l,ah 1523 MOV af.l,AH
1517 1524
1518 end; 1525 end;
1519 1526
1520 result:=4; 1527 Result := 4;
1521 end; 1528 end;
1522 1529
1523 function ADD_H:byte; 1530 function ADD_H: byte;
1524 begin 1531 begin
1525 asm 1532 asm
1526 mov al,hl.h 1533 MOV AL,hl.h
1527 add af.h,al 1534 ADD af.h,AL
1528 lahf 1535 LAHF
1529 and ah,81 1536 AND AH,81
1530 mov af.l,ah 1537 MOV af.l,AH
1531 1538
1532 end; 1539 end;
1533 1540
1534 result:=4; 1541 Result := 4;
1535 end; 1542 end;
1536 1543
1537 function ADD_L:byte; 1544 function ADD_L: byte;
1538 begin 1545 begin
1539 asm 1546 asm
1540 mov al,hl.l 1547 MOV AL,hl.l
1541 add af.h,al 1548 ADD af.h,AL
1542 lahf 1549 LAHF
1543 and ah,81 1550 AND AH,81
1544 mov af.l,ah 1551 MOV af.l,AH
1545 1552
1546 end; 1553 end;
1547 result:=4; 1554 Result := 4;
1548 end; 1555 end;
1549 1556
1550 function ADD_xHL:byte; 1557 function ADD_xHL: byte;
1551 begin 1558 begin
1552 1559
1553 asm 1560 asm
1554 mov ax,hl.w 1561 MOV AX,hl.w
1555 push eax 1562 PUSH EAX
1556 call speekb 1563 CALL speekb
1557 lea esp,[esp+4] 1564 LEA ESP,[ESP+4]
1558 1565
1559 add af.h,al 1566 ADD af.h,AL
1560 lahf 1567 LAHF
1561 and eax,$5100 1568 AND EAX,$5100
1562 mov af.l,ah 1569 MOV af.l,AH
1563 1570
1564 end; 1571 end;
1565 result:=8; 1572 Result := 8;
1566 end; 1573 end;
1567 1574
1568 function ADD_A:byte; 1575 function ADD_A: byte;
1569 begin 1576 begin
1570 asm 1577 asm
1571 mov al,af.h 1578 MOV AL,af.h
1572 add af.h,al 1579 ADD af.h,AL
1573 lahf 1580 LAHF
1574 and ah,81 1581 AND AH,81
1575 mov af.l,ah 1582 MOV af.l,AH
1576 1583
1577 end; 1584 end;
1578 1585
1579 result:=4; 1586 Result := 4;
1580 end; 1587 end;
1581 1588
1582 function ADC_B:byte; 1589 function ADC_B: byte;
1583 begin 1590 begin
1584 asm 1591 asm
1585 mov ah,af.l 1592 MOV AH,af.l
1586 sahf 1593 SAHF
1587 mov al,bc.h 1594 MOV AL,bc.h
1588 adc af.h,al 1595 ADC af.h,AL
1589 lahf 1596 LAHF
1590 and eax,$5100 1597 AND EAX,$5100
1591 mov af.l,ah 1598 MOV af.l,AH
1592 1599
1593 end; 1600 end;
1594 1601
1595 result:=4; 1602 Result := 4;
1596 end; 1603 end;
1597 1604
1598 function ADC_C:byte; 1605 function ADC_C: byte;
1599 begin 1606 begin
1600 asm 1607 asm
1601 mov ah,af.l 1608 MOV AH,af.l
1602 sahf 1609 SAHF
1603 mov al,bc.l 1610 MOV AL,bc.l
1604 adc af.h,al 1611 ADC af.h,AL
1605 lahf 1612 LAHF
1606 and eax,$5100 1613 AND EAX,$5100
1607 mov af.l,ah 1614 MOV af.l,AH
1608 1615
1609 end; 1616 end;
1610 1617
1611 result:=4; 1618 Result := 4;
1612 end; 1619 end;
1613 1620
1614 function ADC_D:byte; 1621 function ADC_D: byte;
1615 begin 1622 begin
1616 asm 1623 asm
1617 mov ah,af.l 1624 MOV AH,af.l
1618 sahf 1625 SAHF
1619 mov al,de.h 1626 MOV AL,de.h
1620 adc af.h,al 1627 ADC af.h,AL
1621 lahf 1628 LAHF
1622 and eax,$5100 1629 AND EAX,$5100
1623 mov af.l,ah 1630 MOV af.l,AH
1624 1631
1625 end; 1632 end;
1626 result:=4; 1633 Result := 4;
1627 end; 1634 end;
1628 1635
1629 function ADC_E:byte; 1636 function ADC_E: byte;
1630 begin 1637 begin
1631 asm 1638 asm
1632 mov ah,af.l 1639 MOV AH,af.l
1633 sahf 1640 SAHF
1634 mov al,de.l 1641 MOV AL,de.l
1635 adc af.h,al 1642 ADC af.h,AL
1636 lahf 1643 LAHF
1637 and eax,$5100 1644 AND EAX,$5100
1638 mov af.l,ah 1645 MOV af.l,AH
1639 1646
1640 end; 1647 end;
1641 1648
1642 result:=4; 1649 Result := 4;
1643 end; 1650 end;
1644 1651
1645 function ADC_H:byte; 1652 function ADC_H: byte;
1646 begin 1653 begin
1647 asm 1654 asm
1648 mov ah,af.l 1655 MOV AH,af.l
1649 sahf 1656 SAHF
1650 mov al,hl.h 1657 MOV AL,hl.h
1651 adc af.h,al 1658 ADC af.h,AL
1652 lahf 1659 LAHF
1653 and eax,$5100 1660 AND EAX,$5100
1654 mov af.l,ah 1661 MOV af.l,AH
1655 1662
1656 end; 1663 end;
1657 1664
1658 result:=4; 1665 Result := 4;
1659 end; 1666 end;
1660 1667
1661 function ADC_L:byte; 1668 function ADC_L: byte;
1662 begin 1669 begin
1663 asm 1670 asm
1664 mov ah,af.l 1671 MOV AH,af.l
1665 sahf 1672 SAHF
1666 mov al,hl.l 1673 MOV AL,hl.l
1667 adc af.h,al 1674 ADC af.h,AL
1668 lahf 1675 LAHF
1669 and eax,$5100 1676 AND EAX,$5100
1670 mov af.l,ah 1677 MOV af.l,AH
1671 1678
1672 end; 1679 end;
1673 1680
1674 result:=4; 1681 Result := 4;
1675 end; 1682 end;
1676 1683
1677 function ADC_xHL:byte; 1684 function ADC_xHL: byte;
1678 begin 1685 begin
1679 1686
1680 asm 1687 asm
1681 mov ax,hl.w 1688 MOV AX,hl.w
1682 push eax 1689 PUSH EAX
1683 call speekb 1690 CALL speekb
1684 lea esp,[esp+4] 1691 LEA ESP,[ESP+4]
1685 mov ah,af.l 1692 MOV AH,af.l
1686 and ah,1 1693 AND AH,1
1687 sahf 1694 SAHF
1688 1695
1689 adc af.h,al 1696 ADC af.h,AL
1690 lahf 1697 LAHF
1691 and eax,$5100 1698 AND EAX,$5100
1692 mov af.l,ah 1699 MOV af.l,AH
1693 1700
1694 end; 1701 end;
1695 1702
1696 result:=8; 1703 Result := 8;
1697 end; 1704 end;
1698 1705
1699 function ADC_A:byte; 1706 function ADC_A: byte;
1700 begin 1707 begin
1701 asm 1708 asm
1702 mov ah,af.l 1709 MOV AH,af.l
1703 sahf 1710 SAHF
1704 mov al,af.h 1711 MOV AL,af.h
1705 adc af.h,al 1712 ADC af.h,AL
1706 lahf 1713 LAHF
1707 and eax,$5100 1714 AND EAX,$5100
1708 mov af.l,ah 1715 MOV af.l,AH
1709 1716
1710 end; 1717 end;
1711 1718
1712 result:=4; 1719 Result := 4;
1713 end; 1720 end;
1714 1721
1715 function SUB_B:byte; 1722 function SUB_B: byte;
1716 begin 1723 begin
1717 asm 1724 asm
1718 mov al,bc.h 1725 MOV AL,bc.h
1719 sub af.h,al 1726 SUB af.h,AL
1720 lahf 1727 LAHF
1721 or eax,$400 1728 OR EAX,$400
1722 mov af.l,ah 1729 MOV af.l,AH
1723 1730
1724 end; 1731 end;
1725 result:=4; 1732 Result := 4;
1726 end; 1733 end;
1727 1734
1728 function SUB_C:byte; 1735 function SUB_C: byte;
1729 begin 1736 begin
1730 asm 1737 asm
1731 mov al,bc.l 1738 MOV AL,bc.l
1732 sub af.h,al 1739 SUB af.h,AL
1733 lahf 1740 LAHF
1734 or eax,$400 1741 OR EAX,$400
1735 mov af.l,ah 1742 MOV af.l,AH
1736 1743
1737 end; 1744 end;
1738 1745
1739 result:=4; 1746 Result := 4;
1740 end; 1747 end;
1741 1748
1742 function SUB_D:byte; 1749 function SUB_D: byte;
1743 begin 1750 begin
1744 asm 1751 asm
1745 mov al,de.h 1752 MOV AL,de.h
1746 sub af.h,al 1753 SUB af.h,AL
1747 lahf 1754 LAHF
1748 or eax,$400 1755 OR EAX,$400
1749 mov af.l,ah 1756 MOV af.l,AH
1750 1757
1751 end; 1758 end;
1752 1759
1753 result:=4; 1760 Result := 4;
1754 end; 1761 end;
1755 1762
1756 function SUB_E:byte; 1763 function SUB_E: byte;
1757 begin 1764 begin
1758 asm 1765 asm
1759 mov al,de.l 1766 MOV AL,de.l
1760 sub af.h,al 1767 SUB af.h,AL
1761 lahf 1768 LAHF
1762 or eax,$400 1769 OR EAX,$400
1763 mov af.l,ah 1770 MOV af.l,AH
1764 1771
1765 end; 1772 end;
1766 1773
1767 1774
1768 result:=4; 1775 Result := 4;
1769 end; 1776 end;
1770 1777
1771 function SUB_H:byte; 1778 function SUB_H: byte;
1772 begin 1779 begin
1773 asm 1780 asm
1774 mov al,hl.h 1781 MOV AL,hl.h
1775 sub af.h,al 1782 SUB af.h,AL
1776 lahf 1783 LAHF
1777 or eax,$400 1784 OR EAX,$400
1778 mov af.l,ah 1785 MOV af.l,AH
1779 1786
1780 end; 1787 end;
1781 1788
1782 result:=4; 1789 Result := 4;
1783 end; 1790 end;
1784 1791
1785 function SUB_L:byte; 1792 function SUB_L: byte;
1786 begin 1793 begin
1787 asm 1794 asm
1788 mov al,hl.l 1795 MOV AL,hl.l
1789 sub af.h,al 1796 SUB af.h,AL
1790 lahf 1797 LAHF
1791 or eax,$400 1798 OR EAX,$400
1792 mov af.l,ah 1799 MOV af.l,AH
1793 1800
1794 end; 1801 end;
1795 1802
1796 result:=4; 1803 Result := 4;
1797 end; 1804 end;
1798 1805
1799 function SUB_xHL:byte; 1806 function SUB_xHL: byte;
1800 begin 1807 begin
1801 1808
1802 asm 1809 asm
1803 mov ax,hl.w 1810 MOV AX,hl.w
1804 push eax 1811 PUSH EAX
1805 call speekb 1812 CALL speekb
1806 lea esp,[esp+4] 1813 LEA ESP,[ESP+4]
1807 1814
1808 sub af.h,al 1815 SUB af.h,AL
1809 lahf 1816 LAHF
1810 or eax,$400 1817 OR EAX,$400
1811 mov af.l,ah 1818 MOV af.l,AH
1812 1819
1813 end; 1820 end;
1814 1821
1815 result:=8; 1822 Result := 8;
1816 end; 1823 end;
1817 1824
1818 function SUB_A:byte; 1825 function SUB_A: byte;
1819 begin 1826 begin
1820 asm 1827 asm
1821 mov al,af.h 1828 MOV AL,af.h
1822 sub af.h,al 1829 SUB af.h,AL
1823 lahf 1830 LAHF
1824 or eax,$400 1831 OR EAX,$400
1825 mov af.l,ah 1832 MOV af.l,AH
1826 1833
1827 end; 1834 end;
1828 result:=4; 1835 Result := 4;
1829 1836
1830 end; 1837 end;
1831 1838
1832 function SBC_B:byte; 1839 function SBC_B: byte;
1833 begin 1840 begin
1834 asm 1841 asm
1835 mov ah,af.l 1842 MOV AH,af.l
1836 sahf 1843 SAHF
1837 mov al,bc.h 1844 MOV AL,bc.h
1838 sbb af.h,al 1845 SBB af.h,AL
1839 lahf 1846 LAHF
1840 or eax,$400 1847 OR EAX,$400
1841 mov af.l,ah 1848 MOV af.l,AH
1842 1849
1843 end; 1850 end;
1844 1851
1845 result:=4; 1852 Result := 4;
1846 1853
1847 end; 1854 end;
1848 1855
1849 function SBC_C:byte; 1856 function SBC_C: byte;
1850 begin 1857 begin
1851 asm 1858 asm
1852 mov ah,af.l 1859 MOV AH,af.l
1853 sahf 1860 SAHF
1854 mov al,bc.l 1861 MOV AL,bc.l
1855 sbb af.h,al 1862 SBB af.h,AL
1856 lahf 1863 LAHF
1857 or eax,$400 1864 OR EAX,$400
1858 mov af.l,ah 1865 MOV af.l,AH
1859 1866
1860 end; 1867 end;
1861 1868
1862 result:=4; 1869 Result := 4;
1863 end; 1870 end;
1864 1871
1865 function SBC_D:byte; 1872 function SBC_D: byte;
1866 begin 1873 begin
1867 asm 1874 asm
1868 mov ah,af.l 1875 MOV AH,af.l
1869 sahf 1876 SAHF
1870 mov al,de.h 1877 MOV AL,de.h
1871 sbb af.h,al 1878 SBB af.h,AL
1872 lahf 1879 LAHF
1873 or eax,$400 1880 OR EAX,$400
1874 mov af.l,ah 1881 MOV af.l,AH
1875 1882
1876 end; 1883 end;
1877 1884
1878 result:=4; 1885 Result := 4;
1879 end; 1886 end;
1880 1887
1881 function SBC_E:byte; 1888 function SBC_E: byte;
1882 begin 1889 begin
1883 asm 1890 asm
1884 mov ah,af.l 1891 MOV AH,af.l
1885 sahf 1892 SAHF
1886 mov al,de.l 1893 MOV AL,de.l
1887 sbb af.h,al 1894 SBB af.h,AL
1888 lahf 1895 LAHF
1889 or eax,$400 1896 OR EAX,$400
1890 mov af.l,ah 1897 MOV af.l,AH
1891 1898
Diff truncated after the static-page render limit. Clone the repository to inspect the complete change.
ModifiedDebugger/UnitDebug.pas +1−0
@@ -18,6 +18,7 @@ interface
18 uses 18 uses
19 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 19 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
20 debugger, StdCtrls, ComCtrls, Menus; 20 debugger, StdCtrls, ComCtrls, Menus;
21
21 type 22 type
22 TfrmDebug = class(TForm) 23 TfrmDebug = class(TForm)
23 private 24 private
ModifiedDebugger/UnitMapview.pas +306−224
@@ -38,8 +38,8 @@ type
38 B0: TLabel; 38 B0: TLabel;
39 procedure PaintBox1Paint(Sender: TObject); 39 procedure PaintBox1Paint(Sender: TObject);
40 procedure TabControl1Change(Sender: TObject); 40 procedure TabControl1Change(Sender: TObject);
41 procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X, 41 procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
42 Y: Integer); 42 X, Y: integer);
43 private 43 private
44 { Private-Deklarationen} 44 { Private-Deklarationen}
45 45
@@ -51,276 +51,358 @@ type
51 var 51 var
52 frmMapview: TfrmMapview; 52 frmMapview: TfrmMapview;
53 53
54 implementation uses vars; 54 implementation
55 55
56 const mapBase:word=$1800; 56 uses vars;
57 vidBase=$8000; 57
58 const
59 mapBase: word = $1800;
60 vidBase = $8000;
58 61
59 62
60 {$R *.lfm} 63 {$R *.lfm}
61 64
62 procedure TfrmMapview.PaintBox1Paint(Sender: TObject); 65 procedure TfrmMapview.PaintBox1Paint(Sender: TObject);
63 begin 66 begin
64 DoUpdate; 67 DoUpdate;
65 end; 68 end;
66 69
67 procedure TfrmMapview.DoUpdate; 70 procedure TfrmMapview.DoUpdate;
68 var bmp:TBitmap; 71 var
72 bmp: TBitmap;
69 73
70 i,j,x,y:byte; // Tilepositions 74 i, j, x, y: byte; // Tilepositions
71 n: Word; 75 n: word;
72 76
73 pal:byte; 77 pal: byte;
74 78
75 tileptr:Array[0..1] of byte; 79 tileptr: array[0..1] of byte;
76 bmpPtr0:pointer; 80 bmpPtr0: pointer;
77 81
78 tile_addr:Word; 82 tile_addr: word;
79 bmpPtr0_index:word; 83 bmpPtr0_index: word;
80 84
81 bit,bit0,bit1:byte; 85 bit, bit0, bit1: byte;
82 c:Word; 86 c: word;
83 vflip,hflip:boolean; 87 vflip, hflip: boolean;
84 begin 88 begin
85 89
86 case m_iram[$FF40] and $48 of 90 case m_iram[$FF40] and $48 of
87 $00: begin 91 $00:
88 TabControl1.Tabs.Strings[0]:='$9800 (BG/Wnd)'; 92 begin
89 TabControl1.Tabs.Strings[1]:='$9C00'; 93 TabControl1.Tabs.Strings[0] := '$9800 (BG/Wnd)';
90 end; 94 TabControl1.Tabs.Strings[1] := '$9C00';
91 $08: begin 95 end;
92 TabControl1.Tabs.Strings[0]:='$9800 (Wnd)'; 96 $08:
93 TabControl1.Tabs.Strings[1]:='$9C00 (BG)'; 97 begin
94 end; 98 TabControl1.Tabs.Strings[0] := '$9800 (Wnd)';
95 $40: begin 99 TabControl1.Tabs.Strings[1] := '$9C00 (BG)';
96 TabControl1.Tabs.Strings[0]:='$9800 (BG)'; 100 end;
97 TabControl1.Tabs.Strings[1]:='$9C00 (Wnd)'; 101 $40:
98 end; 102 begin
99 $48: begin 103 TabControl1.Tabs.Strings[0] := '$9800 (BG)';
100 TabControl1.Tabs.Strings[0]:='$9800'; 104 TabControl1.Tabs.Strings[1] := '$9C00 (Wnd)';
101 TabControl1.Tabs.Strings[1]:='$9C00 (BG/Wnd)'; 105 end;
102 end; 106 $48:
103 end; 107 begin
104 108 TabControl1.Tabs.Strings[0] := '$9800';
105 bmp:=TBitmap.Create; 109 TabControl1.Tabs.Strings[1] := '$9C00 (BG/Wnd)';
106 bmp.Width:=8; 110 end;
107 bmp.Height:=8; 111 end;
108 bmp.PixelFormat:=pf24bit;
109 for y:=0 to 31 do
110 for x:=0 to 31 do
111 begin
112 vflip:=false;
113 hflip:=false;
114 if m_Iram[$FF40] and 16>0 then
115 n:=m_iram[vidbase+mapBase+y*32+x]
116 else
117 n:=256+shortint(m_iram[vidbase+mapBase+y*32+x]);
118 112
113 bmp := TBitmap.Create;
114 bmp.Width := 8;
115 bmp.Height := 8;
116 bmp.PixelFormat := pf24bit;
117 for y := 0 to 31 do
118 for x := 0 to 31 do
119 begin
120 vflip := False;
121 hflip := False;
122 if m_Iram[$FF40] and 16 > 0 then
123 n := m_iram[vidbase + mapBase + y * 32 + x]
124 else
125 n := 256 + shortint(m_iram[vidbase + mapBase + y * 32 + x]);
119 126
120 if gb_mode=cgb then 127
121 begin 128 if gb_mode = cgb then
122 if m_iram[vidbase+mapBase+y*32+x+$2000] and 8>0 then inc(n,512); 129 begin
123 vflip:=m_iram[vidbase+mapBase+y*32+x+$2000] and $40>0; 130 if m_iram[vidbase + mapBase + y * 32 + x + $2000] and 8 > 0 then
124 hflip:=m_iram[vidbase+mapBase+y*32+x+$2000] and $20>0; 131 Inc(n, 512);
125 end; 132 vflip := m_iram[vidbase + mapBase + y * 32 + x + $2000] and $40 > 0;
126 pal:=m_iram[vidbase+mapBase+y*32+x+$2000] and 7; 133 hflip := m_iram[vidbase + mapBase + y * 32 + x + $2000] and $20 > 0;
127 134 end;
128 for j:=0 to 7 do 135 pal := m_iram[vidbase + mapBase + y * 32 + x + $2000] and 7;
129 begin 136
130 if vflip then 137 for j := 0 to 7 do
131 i:=7-j else i:=j; 138 begin
132 139 if vflip then
133 if n>=512 then 140 i := 7 - j
134 tile_Addr:=vidbase+$2000+(n-512)*16+i*2 else 141 else
135 tile_Addr:=vidbase+n*16+i*2; 142 i := j;
136 143
137 tilePtr[0]:=m_iram[tile_Addr]; 144 if n >= 512 then
138 tilePtr[1]:=m_iram[tile_Addr+1]; 145 tile_Addr := vidbase + $2000 + (n - 512) * 16 + i * 2
139 146 else
140 bmpPtr0:=bmp.ScanLine[j];bmpPtr0_index:=0; 147 tile_Addr := vidbase + n * 16 + i * 2;
141 148
142 if hflip then bit:=1 else bit:=128; 149 tilePtr[0] := m_iram[tile_Addr];
143 for i:=0 to 7 do 150 tilePtr[1] := m_iram[tile_Addr + 1];
144 begin 151
145 if tilePtr[0] and bit>0 then bit0:=1 else bit0:=0; 152 bmpPtr0 := bmp.ScanLine[j];
146 if tilePtr[1] and bit>0 then bit1:=2 else bit1:=0; 153 bmpPtr0_index := 0;
147 if hflip then bit:=bit shl 1 else bit:=bit shr 1; 154
148 155 if hflip then
149 if gb_mode<>cgb then 156 bit := 1
150 begin 157 else
151 case bit1 or bit0 of 158 bit := 128;
152 0: c:=3-m_Iram[$FF47] and 3; 159 for i := 0 to 7 do
153 1: c:=3-(m_Iram[$FF47] shr 2) and 3; 160 begin
154 2: c:=3-(m_Iram[$FF47] shr 4) and 3; 161 if tilePtr[0] and bit > 0 then
155 3: c:=3-(m_Iram[$FF47] shr 6) and 3; 162 bit0 := 1
156 end; 163 else
157 c:=c*255 div 3; 164 bit0 := 0;
158 165 if tilePtr[1] and bit > 0 then
159 byte(pchar(bmpPtr0)[bmpPtr0_index]):=c;inc(bmpPtr0_index); 166 bit1 := 2
160 byte(pchar(bmpPtr0)[bmpPtr0_index]):=c;inc(bmpPtr0_index); 167 else
161 byte(pchar(bmpPtr0)[bmpPtr0_index]):=c;inc(bmpPtr0_index); 168 bit1 := 0;
162 169 if hflip then
163 end 170 bit := bit shl 1
164 else 171 else
165 begin 172 bit := bit shr 1;
166 c:=bit1 or bit0; 173
167 byte(pchar(bmpPtr0)[bmpPtr0_index]):= (palramb[(pal shl 2)+c] and 31) shl 3;inc(bmpPtr0_index); 174 if gb_mode <> cgb then
168 byte(pchar(bmpPtr0)[bmpPtr0_index]):=((palramb[(pal shl 2)+c] shr 5) and 31) shl 3;inc(bmpPtr0_index); 175 begin
169 byte(pchar(bmpPtr0)[bmpPtr0_index]):=((palramb[(pal shl 2)+c] shr 10) and 31) shl 3;inc(bmpPtr0_index); 176 case bit1 or bit0 of
170 end; 177 0: c := 3 - m_Iram[$FF47] and 3;
171 178 1: c := 3 - (m_Iram[$FF47] shr 2) and 3;
172 end; 179 2: c := 3 - (m_Iram[$FF47] shr 4) and 3;
180 3: c := 3 - (m_Iram[$FF47] shr 6) and 3;
173 end; 181 end;
174 PaintBox1.Canvas.Pen.Color:=clSilver; 182 c := c * 255 div 3;
175 PaintBox1.Canvas.Brush.Color:=clSilver; 183
176 PaintBox1.Canvas.Rectangle(x*9,y*9,x*9+9,y*9+9); 184 byte(PChar(bmpPtr0)[bmpPtr0_index]) := c;
177 PaintBox1.Canvas.Draw(x*9,y*9,bmp); 185 Inc(bmpPtr0_index);
186 byte(PChar(bmpPtr0)[bmpPtr0_index]) := c;
187 Inc(bmpPtr0_index);
188 byte(PChar(bmpPtr0)[bmpPtr0_index]) := c;
189 Inc(bmpPtr0_index);
190
191 end
192 else
193 begin
194 c := bit1 or bit0;
195 byte(PChar(bmpPtr0)[bmpPtr0_index]) :=
196 (palramb[(pal shl 2) + c] and 31) shl 3;
197 Inc(bmpPtr0_index);
198 byte(PChar(bmpPtr0)[bmpPtr0_index]) :=
199 ((palramb[(pal shl 2) + c] shr 5) and 31) shl 3;
200 Inc(bmpPtr0_index);
201 byte(PChar(bmpPtr0)[bmpPtr0_index]) :=
202 ((palramb[(pal shl 2) + c] shr 10) and 31) shl 3;
203 Inc(bmpPtr0_index);
204 end;
205
178 end; 206 end;
207 end;
208 PaintBox1.Canvas.Pen.Color := clSilver;
209 PaintBox1.Canvas.Brush.Color := clSilver;
210 PaintBox1.Canvas.Rectangle(x * 9, y * 9, x * 9 + 9, y * 9 + 9);
211 PaintBox1.Canvas.Draw(x * 9, y * 9, bmp);
212 end;
179 end; 213 end;
180 214
181 procedure TfrmMapview.TabControl1Change(Sender: TObject); 215 procedure TfrmMapview.TabControl1Change(Sender: TObject);
182 begin 216 begin
183 if TabControl1.TabIndex=0 then mapBase:=$1800 else mapBase:=$1c00; 217 if TabControl1.TabIndex = 0 then
218 mapBase := $1800
219 else
220 mapBase := $1c00;
184 DoUpdate; 221 DoUpdate;
185 end; 222 end;
186 223
187 procedure TfrmMapview.PaintBox1MouseMove(Sender: TObject; 224 procedure TfrmMapview.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
188 Shift: TShiftState; X, Y: Integer); 225 X, Y: integer);
189 var i,j,n:integer; 226 var
190 vflp,hflp:Boolean; 227 i, j, n: integer;
191 tile_Addr: Word; 228 vflp, hflp: boolean;
192 str:String; 229 tile_Addr: word;
193 p:integer; 230 str: string;
194 tilePtr:Array[0..1] of byte; 231 p: integer;
195 bit0,bit1,bit,c:Byte; 232 tilePtr: array[0..1] of byte;
196 rect:TRect; 233 bit0, bit1, bit, c: byte;
197 r,g,b:byte; 234 rect: TRect;
235 r, g, b: byte;
198 begin 236 begin
199 x:=X div 9; 237 x := X div 9;
200 y:=Y div 9; 238 y := Y div 9;
201 239
202 vflp:=false; 240 vflp := False;
203 hflp:=false; 241 hflp := False;
204
205 if m_iram[$FF40] and 16>0 then
206 n:=m_iram[vidbase+mapBase+y*32+x]
207 else
208 n:=256+shortint(m_iram[vidbase+mapBase+y*32+x]);
209
210 if gb_mode=cgb then
211 begin
212 if m_iram[vidbase+mapBase+y*32+x+$2000] and 8>0 then inc(n,512);
213 242
214 vflp:=m_iram[vidbase+mapBase+y*32+x+$2000] and $40>0; 243 if m_iram[$FF40] and 16 > 0 then
215 hflp:=m_iram[vidbase+mapBase+y*32+x+$2000] and $20>0; 244 n := m_iram[vidbase + mapBase + y * 32 + x]
216 end; 245 else
246 n := 256 + shortint(m_iram[vidbase + mapBase + y * 32 + x]);
217 247
218 p:=m_iram[vidbase+mapBase+y*32+x+$2000] and 7; 248 if gb_mode = cgb then
219 Number.Caption:='Tile number = '+inttostr(m_iram[vidbase+mapBase+y*32+x]); 249 begin
220 if (n<512) then 250 if m_iram[vidbase + mapBase + y * 32 + x + $2000] and 8 > 0 then
221 Address.Caption:='Tile address = 0:'+inttostr(n*16+$8000) 251 Inc(n, 512);
222 else
223 Address.Caption:='Tile address = 1:'+inttostr((n-512)*16+$8000);
224 252
225 if HFlp then HFlip.Caption:='HFlip=Yes' else HFlip.Caption:='HFlip=No'; 253 vflp := m_iram[vidbase + mapBase + y * 32 + x + $2000] and $40 > 0;
226 if vFlp then vFlip.Caption:='VFlip=Yes' else vFlip.Caption:='VFlip=No'; 254 hflp := m_iram[vidbase + mapBase + y * 32 + x + $2000] and $20 > 0;
255 end;
227 256
228 for j:=0 to 7 do 257 p := m_iram[vidbase + mapBase + y * 32 + x + $2000] and 7;
229 begin 258 Number.Caption := 'Tile number = ' + IntToStr(m_iram[vidbase + mapBase + y * 32 + x]);
230 if vflp then i:=7-j else i:=j; 259 if (n < 512) then
260 Address.Caption := 'Tile address = 0:' + IntToStr(n * 16 + $8000)
261 else
262 Address.Caption := 'Tile address = 1:' + IntToStr((n - 512) * 16 + $8000);
263
264 if HFlp then
265 HFlip.Caption := 'HFlip=Yes'
266 else
267 HFlip.Caption := 'HFlip=No';
268 if vFlp then
269 vFlip.Caption := 'VFlip=Yes'
270 else
271 vFlip.Caption := 'VFlip=No';
272
273 for j := 0 to 7 do
274 begin
275 if vflp then
276 i := 7 - j
277 else
278 i := j;
231 279
232 if n>=512 then 280 if n >= 512 then
233 tile_Addr:=vidbase+$2000+(n-512)*16+i*2 else 281 tile_Addr := vidbase + $2000 + (n - 512) * 16 + i * 2
234 tile_Addr:=vidbase+n*16+i*2; 282 else
283 tile_Addr := vidbase + n * 16 + i * 2;
235 284
236 tilePtr[0]:=m_iram[tile_Addr]; 285 tilePtr[0] := m_iram[tile_Addr];
237 tilePtr[1]:=m_iram[tile_Addr+1]; 286 tilePtr[1] := m_iram[tile_Addr + 1];
238 287
239 if hflp then bit:=1 else bit:=128; 288 if hflp then
240 for i:=0 to 7 do 289 bit := 1
290 else
291 bit := 128;
292 for i := 0 to 7 do
293 begin
294 if tilePtr[0] and bit > 0 then
295 bit0 := 1
296 else
297 bit0 := 0;
298 if tilePtr[1] and bit > 0 then
299 bit1 := 2
300 else
301 bit1 := 0;
302 if hflp then
303 bit := bit shl 1
304 else
305 bit := bit shr 1;
306
307 if gb_mode <> cgb then
241 begin 308 begin
242 if tilePtr[0] and bit>0 then bit0:=1 else bit0:=0; 309 case bit1 or bit0 of
243 if tilePtr[1] and bit>0 then bit1:=2 else bit1:=0; 310 0: c := 3 - m_Iram[$FF47] and 3;
244 if hflp then bit:=bit shl 1 else bit:=bit shr 1; 311 1: c := 3 - (m_Iram[$FF47] shr 2) and 3;
312 2: c := 3 - (m_Iram[$FF47] shr 4) and 3;
313 3: c := 3 - (m_Iram[$FF47] shr 6) and 3;
314 end;
245 315
246 if gb_mode<>cgb then 316 Shape1.Brush.Color := ((((3 - m_iram[$FF47] and 3) * 255 div 3) shl 16) or
317 (((3 - m_iram[$FF47] and 3) * 255 div 3) shl 8) or ((3 - m_iram[$FF47] and 3) * 255 div 3));
318 Shape2.Brush.Color :=
319 ((((3 - (m_iram[$FF47] shr 2) and 3) * 255 div 3) shl 16) or
320 (((3 - (m_iram[$FF47] shr 2) and 3) * 255 div 3) shl 8) or
321 ((3 - (m_iram[$FF47] shr 2) and 3) * 255 div 3));
322 Shape3.Brush.Color :=
323 ((((3 - (m_iram[$FF47] shr 4) and 3) * 255 div 3) shl 16) or
324 (((3 - (m_iram[$FF47] shr 4) and 3) * 255 div 3) shl 8) or
325 ((3 - (m_iram[$FF47] shr 4) and 3) * 255 div 3));
326 Shape4.Brush.Color :=
327 ((((3 - (m_iram[$FF47] shr 6) and 3) * 255 div 3) shl 16) or
328 (((3 - (m_iram[$FF47] shr 6) and 3) * 255 div 3) shl 8) or
329 ((3 - (m_iram[$FF47] shr 6) and 3) * 255 div 3));
330
331 R0.Caption := 'R=' + IntToStr((3 - m_iram[$FF47] and 3) * 31 div 3);
332 G0.Caption := 'G=' + IntToStr((3 - m_iram[$FF47] and 3) * 31 div 3);
333 B0.Caption := 'B=' + IntToStr((3 - m_iram[$FF47] and 3) * 31 div 3);
334 R1.Caption := 'R=' + IntToStr((3 - (m_iram[$FF47] shr 2) and 3) * 31 div 3);
335 G1.Caption := 'G=' + IntToStr((3 - (m_iram[$FF47] shr 2) and 3) * 31 div 3);
336 B1.Caption := 'B=' + IntToStr((3 - (m_iram[$FF47] shr 2) and 3) * 31 div 3);
337 R2.Caption := 'R=' + IntToStr((3 - (m_iram[$FF47] shr 4) and 3) * 31 div 3);
338 G2.Caption := 'G=' + IntToStr((3 - (m_iram[$FF47] shr 4) and 3) * 31 div 3);
339 B2.Caption := 'B=' + IntToStr((3 - (m_iram[$FF47] shr 4) and 3) * 31 div 3);
340 R3.Caption := 'R=' + IntToStr((3 - (m_iram[$FF47] shr 6) and 3) * 31 div 3);
341 G3.Caption := 'G=' + IntToStr((3 - (m_iram[$FF47] shr 6) and 3) * 31 div 3);
342 B3.Caption := 'B=' + IntToStr((3 - (m_iram[$FF47] shr 6) and 3) * 31 div 3);
343
344 c := c * 255 div 3;
345
346 PaintBox2.Canvas.Brush.Color := ((c shl 16) or (c shl 8) or c);
347
348 with rect do
247 begin 349 begin
248 case bit1 or bit0 of 350 Left := 16 * i;
249 0: c:=3-m_Iram[$FF47] and 3; 351 Right := 16 * i + 15;
250 1: c:=3-(m_Iram[$FF47] shr 2) and 3; 352 Top := 16 * j;
251 2: c:=3-(m_Iram[$FF47] shr 4) and 3; 353 Bottom := 16 * j + 15;
252 3: c:=3-(m_Iram[$FF47] shr 6) and 3; 354 end;
253 end; 355 PaintBox2.Canvas.FillRect(rect);
254 356 end
255 Shape1.Brush.Color:=((((3-m_iram[$FF47] and 3)*255 div 3) shl 16) or (((3-m_iram[$FF47] and 3)*255 div 3) shl 8) or ((3-m_iram[$FF47] and 3)*255 div 3)); 357 else
256 Shape2.Brush.Color:=((((3-(m_iram[$FF47] shr 2) and 3)*255 div 3) shl 16) or (((3-(m_iram[$FF47] shr 2) and 3)*255 div 3) shl 8) or ((3-(m_iram[$FF47] shr 2) and 3)*255 div 3)); 358 begin
257 Shape3.Brush.Color:=((((3-(m_iram[$FF47] shr 4) and 3)*255 div 3) shl 16) or (((3-(m_iram[$FF47] shr 4) and 3)*255 div 3) shl 8) or ((3-(m_iram[$FF47] shr 4) and 3)*255 div 3)); 359 c := bit1 or bit0;
258 Shape4.Brush.Color:=((((3-(m_iram[$FF47] shr 6) and 3)*255 div 3) shl 16) or (((3-(m_iram[$FF47] shr 6) and 3)*255 div 3) shl 8) or ((3-(m_iram[$FF47] shr 6) and 3)*255 div 3)); 360 Shape1.Brush.Color := (((palramb[(p shl 2) + 0] and 31) shl 19) or
259 361 (((palramb[(p shl 2) + 0] shr 5) and 31) shl 11) or
260 R0.Caption:='R='+inttostr((3-m_iram[$FF47] and 3)*31 div 3); 362 (((palramb[(p shl 2) + 0] shr 10) and 31) shl 3));
261 G0.Caption:='G='+inttostr((3-m_iram[$FF47] and 3)*31 div 3); 363 Shape2.Brush.Color := (((palramb[(p shl 2) + 1] and 31) shl 19) or
262 B0.Caption:='B='+inttostr((3-m_iram[$FF47] and 3)*31 div 3); 364 (((palramb[(p shl 2) + 1] shr 5) and 31) shl 11) or
263 R1.Caption:='R='+inttostr((3-(m_iram[$FF47] shr 2) and 3)*31 div 3); 365 (((palramb[(p shl 2) + 1] shr 10) and 31) shl 3));
264 G1.Caption:='G='+inttostr((3-(m_iram[$FF47] shr 2) and 3)*31 div 3); 366 Shape3.Brush.Color := (((palramb[(p shl 2) + 2] and 31) shl 19) or
265 B1.Caption:='B='+inttostr((3-(m_iram[$FF47] shr 2) and 3)*31 div 3); 367 (((palramb[(p shl 2) + 2] shr 5) and 31) shl 11) or
266 R2.Caption:='R='+inttostr((3-(m_iram[$FF47] shr 4) and 3)*31 div 3); 368 (((palramb[(p shl 2) + 2] shr 10) and 31) shl 3));
267 G2.Caption:='G='+inttostr((3-(m_iram[$FF47] shr 4) and 3)*31 div 3); 369 Shape4.Brush.Color := (((palramb[(p shl 2) + 3] and 31) shl 19) or
268 B2.Caption:='B='+inttostr((3-(m_iram[$FF47] shr 4) and 3)*31 div 3); 370 (((palramb[(p shl 2) + 3] shr 5) and 31) shl 11) or
269 R3.Caption:='R='+inttostr((3-(m_iram[$FF47] shr 6) and 3)*31 div 3); 371 (((palramb[(p shl 2) + 3] shr 10) and 31) shl 3));
270 G3.Caption:='G='+inttostr((3-(m_iram[$FF47] shr 6) and 3)*31 div 3); 372 R0.Caption := 'R=' + IntToStr(palramb[(p shl 2) + 0] and 31);
271 B3.Caption:='B='+inttostr((3-(m_iram[$FF47] shr 6) and 3)*31 div 3); 373 G0.Caption := 'G=' + IntToStr(palramb[(p shl 2) + 1] and 31);
272 374 B0.Caption := 'B=' + IntToStr(palramb[(p shl 2) + 2] and 31);
273 c:=c*255 div 3; 375 R1.Caption := 'R=' + IntToStr(palramb[(p shl 2) + 3] and 31);
274 376 G1.Caption := 'G=' + IntToStr((palramb[(p shl 2) + 0] shr 5) and 31);
275 PaintBox2.Canvas.Brush.Color:=((c shl 16) or (c shl 8) or c); 377 B1.Caption := 'B=' + IntToStr((palramb[(p shl 2) + 1] shr 5) and 31);
276 378 R2.Caption := 'R=' + IntToStr((palramb[(p shl 2) + 2] shr 5) and 31);
277 with rect do 379 G2.Caption := 'G=' + IntToStr((palramb[(p shl 2) + 3] shr 5) and 31);
278 begin 380 B2.Caption := 'B=' + IntToStr((palramb[(p shl 2) + 0] shr 10) and 31);
279 Left:=16*i; Right:=16*i+15; 381 R3.Caption := 'R=' + IntToStr((palramb[(p shl 2) + 1] shr 10) and 31);
280 Top:=16*j; Bottom:=16*j+15; 382 G3.Caption := 'G=' + IntToStr((palramb[(p shl 2) + 2] shr 10) and 31);
281 end; 383 B3.Caption := 'B=' + IntToStr((palramb[(p shl 2) + 3] shr 10) and 31);
282 PaintBox2.Canvas.FillRect(rect); 384
283 end 385 r := (palramb[(p shl 2) + c] and 31) shl 3;
284 else 386 g := ((palramb[(p shl 2) + c] shr 5) and 31) shl 3;
387 b := ((palramb[(p shl 2) + c] shr 10) and 31) shl 3;
388 PaintBox2.Canvas.Brush.Color := ((r shl 16) or (g shl 8) or b);
389 with rect do
285 begin 390 begin
286 c:=bit1 or bit0; 391 Left := 16 * i;
287 Shape1.Brush.Color:=(((palramb[(p shl 2)+0] and 31) shl 19) or (((palramb[(p shl 2)+0] shr 5) and 31) shl 11) or (((palramb[(p shl 2)+0] shr 10) and 31) shl 3)); 392 Right := 16 * i + 15;
288 Shape2.Brush.Color:=(((palramb [(p shl 2)+1] and 31) shl 19) or (((palramb[(p shl 2)+1] shr 5) and 31) shl 11) or (((palramb[(p shl 2)+1] shr 10) and 31) shl 3)); 393 Top := 16 * j;
289 Shape3.Brush.Color:=(((palramb[(p shl 2)+2] and 31) shl 19) or (((palramb[(p shl 2)+2] shr 5) and 31) shl 11) or (((palramb[(p shl 2)+2] shr 10) and 31) shl 3)); 394 Bottom := 16 * j + 15;
290 Shape4.Brush.Color:=(((palramb[(p shl 2)+3] and 31) shl 19) or (((palramb[(p shl 2)+3] shr 5) and 31) shl 11) or (((palramb[(p shl 2)+3] shr 10) and 31) shl 3));
291 R0.Caption:='R='+inttostr(palramb[(p shl 2)+0] and 31);
292 G0.Caption:='G='+inttostr(palramb[(p shl 2)+1] and 31);
293 B0.Caption:='B='+inttostr(palramb[(p shl 2)+2] and 31);
294 R1.Caption:='R='+inttostr(palramb[(p shl 2)+3] and 31);
295 G1.Caption:='G='+inttostr((palramb[(p shl 2)+0] shr 5) and 31);
296 B1.Caption:='B='+inttostr((palramb[(p shl 2)+1] shr 5) and 31);
297 R2.Caption:='R='+inttostr((palramb[(p shl 2)+2] shr 5) and 31);
298 G2.Caption:='G='+inttostr((palramb[(p shl 2)+3] shr 5) and 31);
299 B2.Caption:='B='+inttostr((palramb[(p shl 2)+0] shr 10) and 31);
300 R3.Caption:='R='+inttostr((palramb[(p shl 2)+1] shr 10) and 31);
301 G3.Caption:='G='+inttostr((palramb[(p shl 2)+2] shr 10) and 31);
302 B3.Caption:='B='+inttostr((palramb[(p shl 2)+3] shr 10) and 31);
303
304 r:=(palramb[(p shl 2)+c] and 31) shl 3;
305 g:=((palramb[(p shl 2)+c] shr 5) and 31) shl 3;
306 b:=((palramb[(p shl 2)+c] shr 10) and 31) shl 3;
307 PaintBox2.Canvas.Brush.Color:=((r shl 16) or (g shl 8) or b);
308 with rect do
309 begin
310 Left:=16*i; Right:=16*i+15;
311 Top:=16*j; Bottom:=16*j+15;
312 end;
313 PaintBox2.Canvas.FillRect(rect);
314 end; 395 end;
396 PaintBox2.Canvas.FillRect(rect);
315 end; 397 end;
398 end;
316 end; 399 end;
317 end; 400 end;
318 401
319 end. 402 end.
320 //--------------------------------------------------------------------------- 403 //---------------------------------------------------------------------------
321 404 void __fastcall TMapWnd:: PaintBox1MouseMove(TObject * Sender,
322 void __fastcall TMapWnd::PaintBox1MouseMove(TObject *Sender, 405 TShiftState Shift, int X, int Y)
323 TShiftState Shift, int X, int Y)
324 { 406 {
325 int x=X/9; 407 int x=X/9;
326 int y=Y/9; 408 int y=Y/9;
ModifiedDebugger/debugger.pas +1368−1340
@@ -16,1361 +16,1389 @@ unit debugger;
16 {$MODE Delphi} 16 {$MODE Delphi}
17 17
18 interface 18 interface
19 type format=record {Fr opcodes}
20 op:string[18];
21 leng:shortint
22 end;
23 19
24 const major:array[0..255] of format=( 20 type
25 (op:'nop';leng:0), 21 format = record {Fr opcodes}
26 (op:'ld bc,####';leng:2), 22 op: string[18];
27 (op:'ld bc,a';leng:0), 23 leng: shortint
28 (op:'inc bc';leng:0), 24 end;
29 (op:'inc b';leng:0),
30 (op:'dec b';leng:0),
31 (op:'ld b,##';leng:1),
32 (op:'rlc a';leng:0),
33 (op:'ex af,af''';leng:0),
34 (op:'add hl,bc';leng:0),
35 (op:'ld a,(bc)';leng:0),
36 (op:'dec bc';leng:0),
37 (op:'inc c';leng:0),
38 (op:'dec c';leng:0),
39 (op:'ld c,##';leng:1),
40 (op:'rrc a';leng:0),
41 (op:'djnz ####';leng:-1),
42 (op:'ld de,####';leng:2),
43 (op:'ld (de),a';leng:0),
44 (op:'inc de';leng:0),
45 (op:'inc d';leng:0),
46 (op:'dec d';leng:0),
47 (op:'ld d,##';leng:1),
48 (op:'rla';leng:0),
49 (op:'jr ####';leng:-1),
50 (op:'add hl,de';leng:0),
51 (op:'ld a,(de)';leng:0),
52 (op:'dec de';leng:0),
53 (op:'inc e';leng:0),
54 (op:'dec e';leng:0),
55 (op:'ld e,##';leng:1),
56 (op:'rra';leng:0),
57 (op:'jr nz,####';leng:-1),
58 (op:'ld hl,####';leng:2),
59 (op:'ld (####),hl';leng:2),
60 (op:'inc hl';leng:0),
61 (op:'inc h';leng:0),
62 (op:'dec h';leng:0),
63 (op:'ld h,##';leng:1),
64 (op:'daa';leng:0),
65 (op:'jr z,####';leng:-1),
66 (op:'add hl,hl';leng:0),
67 (op:'ld hl,(####)';leng:2),
68 (op:'dec hl';leng:0),
69 (op:'inc l';leng:0),
70 (op:'dec l';leng:0),
71 (op:'ld l,##';leng:1),
72 (op:'cpl';leng:0),
73 (op:'jr nc,####';leng:-1),
74 (op:'ld sp,####';leng:2),
75 (op:'ld (####),a';leng:2),
76 (op:'inc sp';leng:0),
77 (op:'inc (hl)';leng:0),
78 (op:'dec (hl)';leng:0),
79 (op:'ld (hl),##';leng:1),
80 (op:'scf';leng:0),
81 (op:'jr c,####';leng:-1),
82 (op:'add hl,sp';leng:0),
83 (op:'ld a,(####)';leng:2),
84 (op:'dec sp';leng:0),
85 (op:'inc a';leng:0),
86 (op:'dec a';leng:0),
87 (op:'ld a,##';leng:1),
88 (op:'ccf';leng:0),
89 (op:'ld b,b';leng:0),
90 (op:'ld b,c';leng:0),
91 (op:'ld b,d';leng:0),
92 (op:'ld b,e';leng:0),
93 (op:'ld b,h';leng:0),
94 (op:'ld b,l';leng:0),
95 (op:'ld b,(hl)';leng:0),
96 (op:'ld b,a';leng:0),
97 (op:'ld c,b';leng:0),
98 (op:'ld c,c';leng:0),
99 (op:'ld c,d';leng:0),
100 (op:'ld c,e';leng:0),
101 (op:'ld c,h';leng:0),
102 (op:'ld c,l';leng:0),
103 (op:'ld c,(hl)';leng:0),
104 (op:'ld c,a';leng:0),
105 (op:'ld d,b';leng:0),
106 (op:'ld d,c';leng:0),
107 (op:'ld d,d';leng:0),
108 (op:'ld d,e';leng:0),
109 (op:'ld d,h';leng:0),
110 (op:'ld d,l';leng:0),
111 (op:'ld d,(hl)';leng:0),
112 (op:'ld d,a';leng:0),
113 (op:'ld e,b';leng:0),
114 (op:'ld e,c';leng:0),
115 (op:'ld e,d';leng:0),
116 (op:'ld e,e';leng:0),
117 (op:'ld e,h';leng:0),
118 (op:'ld e,l';leng:0),
119 (op:'ld e,(hl)';leng:0),
120 (op:'ld e,a';leng:0),
121 (op:'ld h,b';leng:0),
122 (op:'ld h,c';leng:0),
123 (op:'ld h,d';leng:0),
124 (op:'ld h,e';leng:0),
125 (op:'ld h,h';leng:0),
126 (op:'ld h,l';leng:0),
127 (op:'ld h,(hl)';leng:0),
128 (op:'ld h,a';leng:0),
129 (op:'ld l,b';leng:0),
130 (op:'ld l,c';leng:0),
131 (op:'ld l,d';leng:0),
132 (op:'ld l,e';leng:0),
133 (op:'ld l,h';leng:0),
134 (op:'ld l,l';leng:0),
135 (op:'ld l,(hl)';leng:0),
136 (op:'ld l,a';leng:0),
137 (op:'ld (hl),b';leng:0),
138 (op:'ld (hl),c';leng:0),
139 (op:'ld (hl),d';leng:0),
140 (op:'ld (hl),e';leng:0),
141 (op:'ld (hl),h';leng:0),
142 (op:'ld (hl),l';leng:0),
143 (op:'halt';leng:0),
144 (op:'ld (hl),a';leng:0),
145 (op:'ld a,b';leng:0),
146 (op:'ld a,c';leng:0),
147 (op:'ld a,d';leng:0),
148 (op:'ld a,e';leng:0),
149 (op:'ld a,h';leng:0),
150 (op:'ld a,l';leng:0),
151 (op:'ld a,(hl)';leng:0),
152 (op:'ld a,a';leng:0),
153 (op:'add a,b';leng:0),
154 (op:'add a,c';leng:0),
155 (op:'add a,d';leng:0),
156 (op:'add a,e';leng:0),
157 (op:'add a,h';leng:0),
158 (op:'add a,l';leng:0),
159 (op:'add a,(hl)';leng:0),
160 (op:'add a,a';leng:0),
161 (op:'adc a,b';leng:0),
162 (op:'adc a,c';leng:0),
163 (op:'adc a,d';leng:0),
164 (op:'adc a,e';leng:0),
165 (op:'adc a,h';leng:0),
166 (op:'adc a,l';leng:0),
167 (op:'adc a,(hl)';leng:0),
168 (op:'adc a,a';leng:0),
169 (op:'sub b';leng:0),
170 (op:'sub c';leng:0),
171 (op:'sub d';leng:0),
172 (op:'sub e';leng:0),
173 (op:'sub h';leng:0),
174 (op:'sub l';leng:0),
175 (op:'sub (hl)';leng:0),
176 (op:'sub a';leng:0),
177 (op:'sbc a,b';leng:0),
178 (op:'sbc a,c';leng:0),
179 (op:'sbc a,d';leng:0),
180 (op:'sbc a,e';leng:0),
181 (op:'sbc a,h';leng:0),
182 (op:'sbc a,l';leng:0),
183 (op:'sbc a,(hl)';leng:0),
184 (op:'sbc a,a';leng:0),
185 (op:'and b';leng:0),
186 (op:'and c';leng:0),
187 (op:'and d';leng:0),
188 (op:'and e';leng:0),
189 (op:'and h';leng:0),
190 (op:'and l';leng:0),
191 (op:'and (hl)';leng:0),
192 (op:'and a';leng:0),
193 (op:'xor b';leng:0),
194 (op:'xor c';leng:0),
195 (op:'xor d';leng:0),
196 (op:'xor e';leng:0),
197 (op:'xor h';leng:0),
198 (op:'xor l';leng:0),
199 (op:'xor (hl)';leng:0),
200 (op:'xor a';leng:0),
201 (op:'or b';leng:0),
202 (op:'or c';leng:0),
203 (op:'or d';leng:0),
204 (op:'or e';leng:0),
205 (op:'or h';leng:0),
206 (op:'or l';leng:0),
207 (op:'or (hl)';leng:0),
208 (op:'or a';leng:0),
209 (op:'cp b';leng:0),
210 (op:'cp c';leng:0),
211 (op:'cp d';leng:0),
212 (op:'cp e';leng:0),
213 (op:'cp h';leng:0),
214 (op:'cp l';leng:0),
215 (op:'cp (hl)';leng:0),
216 (op:'cp a';leng:0),
217 (op:'ret nz';leng:0),
218 (op:'pop bc';leng:0),
219 (op:'jp nz,####';leng:2),
220 (op:'jp ####';leng:2),
221 (op:'call nz,####';leng:2),
222 (op:'push bc';leng:0),
223 (op:'add a,##';leng:1),
224 (op:'rst 0';leng:0),
225 (op:'ret z';leng:0),
226 (op:'ret';leng:0),
227 (op:'jp z,####';leng:2),
228 (op:'';leng:0),
229 (op:'call z,####';leng:2),
230 (op:'call ####';leng:2),
231 (op:'adc a,##';leng:1),
232 (op:'rst 8';leng:0),
233 (op:'ret nc';leng:0),
234 (op:'pop de';leng:0),
235 (op:'jp nc,####';leng:2),
236 (op:'out (##),a';leng:1),
237 (op:'call nc,####';leng:2),
238 (op:'push de';leng:0),
239 (op:'sub ##';leng:1),
240 (op:'rst 10h';leng:0),
241 (op:'ret c';leng:0),
242 (op:'exx';leng:0),
243 (op:'jp c,####';leng:2),
244 (op:'in a,(##)';leng:1),
245 (op:'call c,####';leng:2),
246 (op:'';leng:1),
247 (op:'sbc a,##';leng:1),
248 (op:'rst 18h';leng:0),
249 (op:'ret po';leng:0),
250 (op:'pop hl';leng:0),
251 (op:'jp po,####';leng:2),
252 (op:'ex (sp),hl';leng:0),
253 (op:'call po,####';leng:2),
254 (op:'push hl';leng:0),
255 (op:'and ##';leng:1),
256 (op:'rst 20h';leng:0),
257 (op:'ret pe';leng:0),
258 (op:'jp (hl)';leng:0),
259 (op:'jp pe,####';leng:2),
260 (op:'ex de,hl';leng:0),
261 (op:'call pe,####';leng:2),
262 (op:'';leng:2),
263 (op:'xor ##';leng:1),
264 (op:'rst 28h';leng:0),
265 (op:'ret p';leng:0),
266 (op:'pop af';leng:0),
267 (op:'jp p,####';leng:2),
268 (op:'di';leng:0),
269 (op:'call p,####';leng:2),
270 (op:'push af';leng:0),
271 (op:'or ##';leng:1),
272 (op:'rst 30h';leng:0),
273 (op:'ret m';leng:0),
274 (op:'ld sp,hl';leng:0),
275 (op:'jp m,####';leng:2),
276 (op:'ei';leng:0),
277 (op:'call m,####';leng:2),
278 (op:'';leng:1),
279 (op:'cp ##';leng:1),
280 (op:'rst 38h';leng:0));
281 25
282 const minor:array[0..3,0..255] of format=(( 26 const
283 (op:'rlc b';leng:0), 27 major: array[0..255] of format = (
284 (op:'rlc c';leng:0), 28 (op: 'nop'; leng: 0),
285 (op:'rlc d';leng:0), 29 (op: 'ld bc,####'; leng: 2),
286 (op:'rlc e';leng:0), 30 (op: 'ld bc,a'; leng: 0),
287 (op:'rlc h';leng:0), 31 (op: 'inc bc'; leng: 0),
288 (op:'rlc l';leng:0), 32 (op: 'inc b'; leng: 0),
289 (op:'rlc (hl)';leng:0), 33 (op: 'dec b'; leng: 0),
290 (op:'rlc a';leng:0), 34 (op: 'ld b,##'; leng: 1),
291 (op:'rrc b';leng:0), 35 (op: 'rlc a'; leng: 0),
292 (op:'rrc c';leng:0), 36 (op: 'ex af,af'''; leng: 0),
293 (op:'rrc d';leng:0), 37 (op: 'add hl,bc'; leng: 0),
294 (op:'rrc e';leng:0), 38 (op: 'ld a,(bc)'; leng: 0),
295 (op:'rrc h';leng:0), 39 (op: 'dec bc'; leng: 0),
296 (op:'rrc l';leng:0), 40 (op: 'inc c'; leng: 0),
297 (op:'rrc (hl)';leng:0), 41 (op: 'dec c'; leng: 0),
298 (op:'rrc a';leng:0), 42 (op: 'ld c,##'; leng: 1),
299 (op:'rl b';leng:0), 43 (op: 'rrc a'; leng: 0),
300 (op:'rl c';leng:0), 44 (op: 'djnz ####'; leng: -1),
301 (op:'rl d';leng:0), 45 (op: 'ld de,####'; leng: 2),
302 (op:'rl e';leng:0), 46 (op: 'ld (de),a'; leng: 0),
303 (op:'rl h';leng:0), 47 (op: 'inc de'; leng: 0),
304 (op:'rl l';leng:0), 48 (op: 'inc d'; leng: 0),
305 (op:'rl (hl)';leng:0), 49 (op: 'dec d'; leng: 0),
306 (op:'rl a';leng:0), 50 (op: 'ld d,##'; leng: 1),
307 (op:'rr b';leng:0), 51 (op: 'rla'; leng: 0),
308 (op:'rr c';leng:0), 52 (op: 'jr ####'; leng: -1),
309 (op:'rr d';leng:0), 53 (op: 'add hl,de'; leng: 0),
310 (op:'rr e';leng:0), 54 (op: 'ld a,(de)'; leng: 0),
311 (op:'rr h';leng:0), 55 (op: 'dec de'; leng: 0),
312 (op:'rr l';leng:0), 56 (op: 'inc e'; leng: 0),
313 (op:'rr (hl)';leng:0), 57 (op: 'dec e'; leng: 0),
314 (op:'rr a';leng:0), 58 (op: 'ld e,##'; leng: 1),
315 (op:'sla b';leng:0), 59 (op: 'rra'; leng: 0),
316 (op:'sla c';leng:0), 60 (op: 'jr nz,####'; leng: -1),
317 (op:'sla d';leng:0), 61 (op: 'ld hl,####'; leng: 2),
318 (op:'sla e';leng:0), 62 (op: 'ld (####),hl'; leng: 2),
319 (op:'sla h';leng:0), 63 (op: 'inc hl'; leng: 0),
320 (op:'sla l';leng:0), 64 (op: 'inc h'; leng: 0),
321 (op:'sla (hl)';leng:0), 65 (op: 'dec h'; leng: 0),
322 (op:'sla a';leng:0), 66 (op: 'ld h,##'; leng: 1),
323 (op:'sra b';leng:0), 67 (op: 'daa'; leng: 0),
324 (op:'sra c';leng:0), 68 (op: 'jr z,####'; leng: -1),
325 (op:'sra d';leng:0), 69 (op: 'add hl,hl'; leng: 0),
326 (op:'sra e';leng:0), 70 (op: 'ld hl,(####)'; leng: 2),
327 (op:'sra h';leng:0), 71 (op: 'dec hl'; leng: 0),
328 (op:'sra l';leng:0), 72 (op: 'inc l'; leng: 0),
329 (op:'sra (hl)';leng:0), 73 (op: 'dec l'; leng: 0),
330 (op:'sra a';leng:0), 74 (op: 'ld l,##'; leng: 1),
331 (op:'slai b';leng:0), 75 (op: 'cpl'; leng: 0),
332 (op:'slai c';leng:0), 76 (op: 'jr nc,####'; leng: -1),
333 (op:'slai d';leng:0), 77 (op: 'ld sp,####'; leng: 2),
334 (op:'slai e';leng:0), 78 (op: 'ld (####),a'; leng: 2),
335 (op:'slai h';leng:0), 79 (op: 'inc sp'; leng: 0),
336 (op:'slai l';leng:0), 80 (op: 'inc (hl)'; leng: 0),
337 (op:'slai (hl)';leng:0), 81 (op: 'dec (hl)'; leng: 0),
338 (op:'slai a';leng:0), 82 (op: 'ld (hl),##'; leng: 1),
339 (op:'srl b';leng:0), 83 (op: 'scf'; leng: 0),
340 (op:'srl c';leng:0), 84 (op: 'jr c,####'; leng: -1),
341 (op:'srl d';leng:0), 85 (op: 'add hl,sp'; leng: 0),
342 (op:'srl e';leng:0), 86 (op: 'ld a,(####)'; leng: 2),
343 (op:'srl h';leng:0), 87 (op: 'dec sp'; leng: 0),
344 (op:'srl l';leng:0), 88 (op: 'inc a'; leng: 0),
345 (op:'srl (hl)';leng:0), 89 (op: 'dec a'; leng: 0),
346 (op:'srl a';leng:0), 90 (op: 'ld a,##'; leng: 1),
347 (op:'bit 0,b';leng:0), 91 (op: 'ccf'; leng: 0),
348 (op:'bit 0,c';leng:0), 92 (op: 'ld b,b'; leng: 0),
349 (op:'bit 0,d';leng:0), 93 (op: 'ld b,c'; leng: 0),
350 (op:'bit 0,e';leng:0), 94 (op: 'ld b,d'; leng: 0),
351 (op:'bit 0,h';leng:0), 95 (op: 'ld b,e'; leng: 0),
352 (op:'bit 0,l';leng:0), 96 (op: 'ld b,h'; leng: 0),
353 (op:'bit 0,(hl)';leng:0), 97 (op: 'ld b,l'; leng: 0),
354 (op:'bit 0,a';leng:0), 98 (op: 'ld b,(hl)'; leng: 0),
355 (op:'bit 1,b';leng:0), 99 (op: 'ld b,a'; leng: 0),
356 (op:'bit 1,c';leng:0), 100 (op: 'ld c,b'; leng: 0),
357 (op:'bit 1,d';leng:0), 101 (op: 'ld c,c'; leng: 0),
358 (op:'bit 1,e';leng:0), 102 (op: 'ld c,d'; leng: 0),
359 (op:'bit 1,h';leng:0), 103 (op: 'ld c,e'; leng: 0),
360 (op:'bit 1,l';leng:0), 104 (op: 'ld c,h'; leng: 0),
361 (op:'bit 1,(hl)';leng:0), 105 (op: 'ld c,l'; leng: 0),
362 (op:'bit 1,a';leng:0), 106 (op: 'ld c,(hl)'; leng: 0),
363 (op:'bit 2,b';leng:0), 107 (op: 'ld c,a'; leng: 0),
364 (op:'bit 2,c';leng:0), 108 (op: 'ld d,b'; leng: 0),
365 (op:'bit 2,d';leng:0), 109 (op: 'ld d,c'; leng: 0),
366 (op:'bit 2,e';leng:0), 110 (op: 'ld d,d'; leng: 0),
367 (op:'bit 2,h';leng:0), 111 (op: 'ld d,e'; leng: 0),
368 (op:'bit 2,l';leng:0), 112 (op: 'ld d,h'; leng: 0),
369 (op:'bit 2,(hl)';leng:0), 113 (op: 'ld d,l'; leng: 0),
370 (op:'bit 2,a';leng:0), 114 (op: 'ld d,(hl)'; leng: 0),
371 (op:'bit 3,b';leng:0), 115 (op: 'ld d,a'; leng: 0),
372 (op:'bit 3,c';leng:0), 116 (op: 'ld e,b'; leng: 0),
373 (op:'bit 3,d';leng:0), 117 (op: 'ld e,c'; leng: 0),
374 (op:'bit 3,e';leng:0), 118 (op: 'ld e,d'; leng: 0),
375 (op:'bit 3,h';leng:0), 119 (op: 'ld e,e'; leng: 0),
376 (op:'bit 3,l';leng:0), 120 (op: 'ld e,h'; leng: 0),
377 (op:'bit 3,(hl)';leng:0), 121 (op: 'ld e,l'; leng: 0),
378 (op:'bit 3,a';leng:0), 122 (op: 'ld e,(hl)'; leng: 0),
379 (op:'bit 4,b';leng:0), 123 (op: 'ld e,a'; leng: 0),
380 (op:'bit 4,c';leng:0), 124 (op: 'ld h,b'; leng: 0),
381 (op:'bit 4,d';leng:0), 125 (op: 'ld h,c'; leng: 0),
382 (op:'bit 4,e';leng:0), 126 (op: 'ld h,d'; leng: 0),
383 (op:'bit 4,h';leng:0), 127 (op: 'ld h,e'; leng: 0),
384 (op:'bit 4,l';leng:0), 128 (op: 'ld h,h'; leng: 0),
385 (op:'bit 4,(hl)';leng:0), 129 (op: 'ld h,l'; leng: 0),
386 (op:'bit 4,a';leng:0), 130 (op: 'ld h,(hl)'; leng: 0),
387 (op:'bit 5,b';leng:0), 131 (op: 'ld h,a'; leng: 0),
388 (op:'bit 5,c';leng:0), 132 (op: 'ld l,b'; leng: 0),
389 (op:'bit 5,d';leng:0), 133 (op: 'ld l,c'; leng: 0),
390 (op:'bit 5,e';leng:0), 134 (op: 'ld l,d'; leng: 0),
391 (op:'bit 5,h';leng:0), 135 (op: 'ld l,e'; leng: 0),
392 (op:'bit 5,l';leng:0), 136 (op: 'ld l,h'; leng: 0),
393 (op:'bit 5,(hl)';leng:0), 137 (op: 'ld l,l'; leng: 0),
394 (op:'bit 5,a';leng:0), 138 (op: 'ld l,(hl)'; leng: 0),
395 (op:'bit 6,b';leng:0), 139 (op: 'ld l,a'; leng: 0),
396 (op:'bit 6,c';leng:0), 140 (op: 'ld (hl),b'; leng: 0),
397 (op:'bit 6,d';leng:0), 141 (op: 'ld (hl),c'; leng: 0),
398 (op:'bit 6,e';leng:0), 142 (op: 'ld (hl),d'; leng: 0),
399 (op:'bit 6,h';leng:0), 143 (op: 'ld (hl),e'; leng: 0),
400 (op:'bit 6,l';leng:0), 144 (op: 'ld (hl),h'; leng: 0),
401 (op:'bit 6,(hl)';leng:0), 145 (op: 'ld (hl),l'; leng: 0),
402 (op:'bit 6,a';leng:0), 146 (op: 'halt'; leng: 0),
403 (op:'bit 7,b';leng:0), 147 (op: 'ld (hl),a'; leng: 0),
404 (op:'bit 7,c';leng:0), 148 (op: 'ld a,b'; leng: 0),
405 (op:'bit 7,d';leng:0), 149 (op: 'ld a,c'; leng: 0),
406 (op:'bit 7,e';leng:0), 150 (op: 'ld a,d'; leng: 0),
407 (op:'bit 7,h';leng:0), 151 (op: 'ld a,e'; leng: 0),
408 (op:'bit 7,l';leng:0), 152 (op: 'ld a,h'; leng: 0),
409 (op:'bit 7,(hl)';leng:0), 153 (op: 'ld a,l'; leng: 0),
410 (op:'bit 7,a';leng:0), 154 (op: 'ld a,(hl)'; leng: 0),
411 (op:'res 0,b';leng:0), 155 (op: 'ld a,a'; leng: 0),
412 (op:'res 0,c';leng:0), 156 (op: 'add a,b'; leng: 0),
413 (op:'res 0,d';leng:0), 157 (op: 'add a,c'; leng: 0),
414 (op:'res 0,e';leng:0), 158 (op: 'add a,d'; leng: 0),
415 (op:'res 0,h';leng:0), 159 (op: 'add a,e'; leng: 0),
416 (op:'res 0,l';leng:0), 160 (op: 'add a,h'; leng: 0),
417 (op:'res 0,(hl)';leng:0), 161 (op: 'add a,l'; leng: 0),
418 (op:'res 0,a';leng:0), 162 (op: 'add a,(hl)'; leng: 0),
419 (op:'res 1,b';leng:0), 163 (op: 'add a,a'; leng: 0),
420 (op:'res 1,c';leng:0), 164 (op: 'adc a,b'; leng: 0),
421 (op:'res 1,d';leng:0), 165 (op: 'adc a,c'; leng: 0),
422 (op:'res 1,e';leng:0), 166 (op: 'adc a,d'; leng: 0),
423 (op:'res 1,h';leng:0), 167 (op: 'adc a,e'; leng: 0),
424 (op:'res 1,l';leng:0), 168 (op: 'adc a,h'; leng: 0),
425 (op:'res 1,(hl)';leng:0), 169 (op: 'adc a,l'; leng: 0),
426 (op:'res 1,a';leng:0), 170 (op: 'adc a,(hl)'; leng: 0),
427 (op:'res 2,b';leng:0), 171 (op: 'adc a,a'; leng: 0),
428 (op:'res 2,c';leng:0), 172 (op: 'sub b'; leng: 0),
429 (op:'res 2,d';leng:0), 173 (op: 'sub c'; leng: 0),
430 (op:'res 2,e';leng:0), 174 (op: 'sub d'; leng: 0),
431 (op:'res 2,h';leng:0), 175 (op: 'sub e'; leng: 0),
432 (op:'res 2,l';leng:0), 176 (op: 'sub h'; leng: 0),
433 (op:'res 2,(hl)';leng:0), 177 (op: 'sub l'; leng: 0),
434 (op:'res 2,a';leng:0), 178 (op: 'sub (hl)'; leng: 0),
435 (op:'res 3,b';leng:0), 179 (op: 'sub a'; leng: 0),
436 (op:'res 3,c';leng:0), 180 (op: 'sbc a,b'; leng: 0),
437 (op:'res 3,d';leng:0), 181 (op: 'sbc a,c'; leng: 0),
438 (op:'res 3,e';leng:0), 182 (op: 'sbc a,d'; leng: 0),
439 (op:'res 3,h';leng:0), 183 (op: 'sbc a,e'; leng: 0),
440 (op:'res 3,l';leng:0), 184 (op: 'sbc a,h'; leng: 0),
441 (op:'res 3,(hl)';leng:0), 185 (op: 'sbc a,l'; leng: 0),
442 (op:'res 3,a';leng:0), 186 (op: 'sbc a,(hl)'; leng: 0),
443 (op:'res 4,b';leng:0), 187 (op: 'sbc a,a'; leng: 0),
444 (op:'res 4,c';leng:0), 188 (op: 'and b'; leng: 0),
445 (op:'res 4,d';leng:0), 189 (op: 'and c'; leng: 0),
446 (op:'res 4,e';leng:0), 190 (op: 'and d'; leng: 0),
447 (op:'res 4,h';leng:0), 191 (op: 'and e'; leng: 0),
448 (op:'res 4,l';leng:0), 192 (op: 'and h'; leng: 0),
449 (op:'res 4,(hl)';leng:0), 193 (op: 'and l'; leng: 0),
450 (op:'res 4,a';leng:0), 194 (op: 'and (hl)'; leng: 0),
451 (op:'res 5,b';leng:0), 195 (op: 'and a'; leng: 0),
452 (op:'res 5,c';leng:0), 196 (op: 'xor b'; leng: 0),
453 (op:'res 5,d';leng:0), 197 (op: 'xor c'; leng: 0),
454 (op:'res 5,e';leng:0), 198 (op: 'xor d'; leng: 0),
455 (op:'res 5,h';leng:0), 199 (op: 'xor e'; leng: 0),
456 (op:'res 5,l';leng:0), 200 (op: 'xor h'; leng: 0),
457 (op:'res 5,(hl)';leng:0), 201 (op: 'xor l'; leng: 0),
458 (op:'res 5,a';leng:0), 202 (op: 'xor (hl)'; leng: 0),
459 (op:'res 6,b';leng:0), 203 (op: 'xor a'; leng: 0),
460 (op:'res 6,c';leng:0), 204 (op: 'or b'; leng: 0),
461 (op:'res 6,d';leng:0), 205 (op: 'or c'; leng: 0),
462 (op:'res 6,e';leng:0), 206 (op: 'or d'; leng: 0),
463 (op:'res 6,h';leng:0), 207 (op: 'or e'; leng: 0),
464 (op:'res 6,l';leng:0), 208 (op: 'or h'; leng: 0),
465 (op:'res 6,(hl)';leng:0), 209 (op: 'or l'; leng: 0),
466 (op:'res 6,a';leng:0), 210 (op: 'or (hl)'; leng: 0),
467 (op:'res 7,b';leng:0), 211 (op: 'or a'; leng: 0),
468 (op:'res 7,c';leng:0), 212 (op: 'cp b'; leng: 0),
469 (op:'res 7,d';leng:0), 213 (op: 'cp c'; leng: 0),
470 (op:'res 7,e';leng:0), 214 (op: 'cp d'; leng: 0),
471 (op:'res 7,h';leng:0), 215 (op: 'cp e'; leng: 0),
472 (op:'res 7,l';leng:0), 216 (op: 'cp h'; leng: 0),
473 (op:'res 7,(hl)';leng:0), 217 (op: 'cp l'; leng: 0),
474 (op:'res 7,a';leng:0), 218 (op: 'cp (hl)'; leng: 0),
475 (op:'set 0,b';leng:0), 219 (op: 'cp a'; leng: 0),
476 (op:'set 0,c';leng:0), 220 (op: 'ret nz'; leng: 0),
477 (op:'set 0,d';leng:0), 221 (op: 'pop bc'; leng: 0),
478 (op:'set 0,e';leng:0), 222 (op: 'jp nz,####'; leng: 2),
479 (op:'set 0,h';leng:0), 223 (op: 'jp ####'; leng: 2),
480 (op:'set 0,l';leng:0), 224 (op: 'call nz,####'; leng: 2),
481 (op:'set 0,(hl)';leng:0), 225 (op: 'push bc'; leng: 0),
482 (op:'set 0,a';leng:0), 226 (op: 'add a,##'; leng: 1),
483 (op:'set 1,b';leng:0), 227 (op: 'rst 0'; leng: 0),
484 (op:'set 1,c';leng:0), 228 (op: 'ret z'; leng: 0),
485 (op:'set 1,d';leng:0), 229 (op: 'ret'; leng: 0),
486 (op:'set 1,e';leng:0), 230 (op: 'jp z,####'; leng: 2),
487 (op:'set 1,h';leng:0), 231 (op: ''; leng: 0),
488 (op:'set 1,l';leng:0), 232 (op: 'call z,####'; leng: 2),
489 (op:'set 1,(hl)';leng:0), 233 (op: 'call ####'; leng: 2),
490 (op:'set 1,a';leng:0), 234 (op: 'adc a,##'; leng: 1),
491 (op:'set 2,b';leng:0), 235 (op: 'rst 8'; leng: 0),
492 (op:'set 2,c';leng:0), 236 (op: 'ret nc'; leng: 0),
493 (op:'set 2,d';leng:0), 237 (op: 'pop de'; leng: 0),
494 (op:'set 2,e';leng:0), 238 (op: 'jp nc,####'; leng: 2),
495 (op:'set 2,h';leng:0), 239 (op: 'out (##),a'; leng: 1),
496 (op:'set 2,l';leng:0), 240 (op: 'call nc,####'; leng: 2),
497 (op:'set 2,(hl)';leng:0), 241 (op: 'push de'; leng: 0),
498 (op:'set 2,a';leng:0), 242 (op: 'sub ##'; leng: 1),
499 (op:'set 3,b';leng:0), 243 (op: 'rst 10h'; leng: 0),
500 (op:'set 3,c';leng:0), 244 (op: 'ret c'; leng: 0),
501 (op:'set 3,d';leng:0), 245 (op: 'exx'; leng: 0),
502 (op:'set 3,e';leng:0), 246 (op: 'jp c,####'; leng: 2),
503 (op:'set 3,h';leng:0), 247 (op: 'in a,(##)'; leng: 1),
504 (op:'set 3,l';leng:0), 248 (op: 'call c,####'; leng: 2),
505 (op:'set 3,(hl)';leng:0), 249 (op: ''; leng: 1),
506 (op:'set 3,a';leng:0), 250 (op: 'sbc a,##'; leng: 1),
507 (op:'set 4,b';leng:0), 251 (op: 'rst 18h'; leng: 0),
508 (op:'set 4,c';leng:0), 252 (op: 'ret po'; leng: 0),
509 (op:'set 4,d';leng:0), 253 (op: 'pop hl'; leng: 0),
510 (op:'set 4,e';leng:0), 254 (op: 'jp po,####'; leng: 2),
511 (op:'set 4,h';leng:0), 255 (op: 'ex (sp),hl'; leng: 0),
512 (op:'set 4,l';leng:0), 256 (op: 'call po,####'; leng: 2),
513 (op:'set 4,(hl)';leng:0), 257 (op: 'push hl'; leng: 0),
514 (op:'set 4,a';leng:0), 258 (op: 'and ##'; leng: 1),
515 (op:'set 5,b';leng:0), 259 (op: 'rst 20h'; leng: 0),
516 (op:'set 5,c';leng:0), 260 (op: 'ret pe'; leng: 0),
517 (op:'set 5,d';leng:0), 261 (op: 'jp (hl)'; leng: 0),
518 (op:'set 5,e';leng:0), 262 (op: 'jp pe,####'; leng: 2),
519 (op:'set 5,h';leng:0), 263 (op: 'ex de,hl'; leng: 0),
520 (op:'set 5,l';leng:0), 264 (op: 'call pe,####'; leng: 2),
521 (op:'set 5,(hl)';leng:0), 265 (op: ''; leng: 2),
522 (op:'set 5,a';leng:0), 266 (op: 'xor ##'; leng: 1),
523 (op:'set 6,b';leng:0), 267 (op: 'rst 28h'; leng: 0),
524 (op:'set 6,c';leng:0), 268 (op: 'ret p'; leng: 0),
525 (op:'set 6,d';leng:0), 269 (op: 'pop af'; leng: 0),
526 (op:'set 6,e';leng:0), 270 (op: 'jp p,####'; leng: 2),
527 (op:'set 6,h';leng:0), 271 (op: 'di'; leng: 0),
528 (op:'set 6,l';leng:0), 272 (op: 'call p,####'; leng: 2),
529 (op:'set 6,(hl)';leng:0), 273 (op: 'push af'; leng: 0),
530 (op:'set 6,a';leng:0), 274 (op: 'or ##'; leng: 1),
531 (op:'set 7,b';leng:0), 275 (op: 'rst 30h'; leng: 0),
532 (op:'set 7,c';leng:0), 276 (op: 'ret m'; leng: 0),
533 (op:'set 7,d';leng:0), 277 (op: 'ld sp,hl'; leng: 0),
534 (op:'set 7,e';leng:0), 278 (op: 'jp m,####'; leng: 2),
535 (op:'set 7,h';leng:0), 279 (op: 'ei'; leng: 0),
536 (op:'set 7,l';leng:0), 280 (op: 'call m,####'; leng: 2),
537 (op:'set 7,(hl)';leng:0), 281 (op: ''; leng: 1),
538 (op:'set 7,a';leng:0)),( 282 (op: 'cp ##'; leng: 1),
539 (op:'undefined';leng:0), 283 (op: 'rst 38h'; leng: 0));
540 (op:'undefined';leng:0),
541 (op:'undefined';leng:0),
542 (op:'undefined';leng:0),
543 (op:'undefined';leng:0),
544 (op:'undefined';leng:0),
545 (op:'undefined';leng:0),
546 (op:'undefined';leng:0),
547 (op:'undefined';leng:0),
548 (op:'addix,bc';leng:0),
549 (op:'undefined';leng:0),
550 (op:'undefined';leng:0),
551 (op:'undefined';leng:0),
552 (op:'undefined';leng:0),
553 (op:'undefined';leng:0),
554 (op:'undefined';leng:0),
555 (op:'undefined';leng:0),
556 (op:'undefined';leng:0),
557 (op:'undefined';leng:0),
558 (op:'undefined';leng:0),
559 (op:'undefined';leng:0),
560 (op:'undefined';leng:0),
561 (op:'undefined';leng:0),
562 (op:'undefined';leng:0),
563 (op:'undefined';leng:0),
564 (op:'add ix,de';leng:0),
565 (op:'undefined';leng:0),
566 (op:'undefined';leng:0),
567 (op:'undefined';leng:0),
568 (op:'undefined';leng:0),
569 (op:'undefined';leng:0),
570 (op:'undefined';leng:0),
571 (op:'undefined';leng:0),
572 (op:'ld ix,####';leng:2),
573 (op:'ld (####),ix';leng:2),
574 (op:'inc ix';leng:0),
575 (op:'inc ixh';leng:0),
576 (op:'dec ixh';leng:0),
577 (op:'ld ixh,##';leng:1),
578 (op:'undefined';leng:0),
579 (op:'undefined';leng:0),
580 (op:'add ix,ix';leng:0),
581 (op:'ld ix,(####)';leng:2),
582 (op:'dec ix';leng:0),
583 (op:'inc ixl';leng:0),
584 (op:'dec ixl';leng:0),
585 (op:'ld ixl,##';leng:1),
586 (op:'undefined';leng:0),
587 (op:'undefined';leng:0),
588 (op:'undefined';leng:0),
589 (op:'undefined';leng:0),
590 (op:'undefined';leng:0),
591 (op:'inc (ix+##)';leng:1),
592 (op:'dec (ix+##)';leng:1),
593 (op:'ld (ix+##),##';leng:2),
594 (op:'undefined';leng:0),
595 (op:'undefined';leng:0),
596 (op:'add ix,sp';leng:0),
597 (op:'undefined';leng:0),
598 (op:'undefined';leng:0),
599 (op:'undefined';leng:0),
600 (op:'undefined';leng:0),
601 (op:'undefined';leng:0),
602 (op:'undefined';leng:0),
603 (op:'undefined';leng:0),
604 (op:'undefined';leng:0),
605 (op:'undefined';leng:0),
606 (op:'undefined';leng:0),
607 (op:'ld b,ixh';leng:0),
608 (op:'ld b,ixl';leng:0),
609 (op:'ld b,(ix+##)';leng:1),
610 (op:'undefined';leng:0),
611 (op:'undefined';leng:0),
612 (op:'undefined';leng:0),
613 (op:'undefined';leng:0),
614 (op:'undefined';leng:0),
615 (op:'ld c,ixh';leng:0),
616 (op:'ld c,ixl';leng:0),
617 (op:'ld c,(ix+##)';leng:1),
618 (op:'undefined';leng:0),
619 (op:'undefined';leng:0),
620 (op:'undefined';leng:0),
621 (op:'undefined';leng:0),
622 (op:'undefined';leng:0),
623 (op:'ld d,ixh';leng:0),
624 (op:'ld d,ixl';leng:0),
625 (op:'ld d,(ix+##)';leng:1),
626 (op:'undefined';leng:0),
627 (op:'undefined';leng:0),
628 (op:'undefined';leng:0),
629 (op:'undefined';leng:0),
630 (op:'undefined';leng:0),
631 (op:'ld e,ixh';leng:0),
632 (op:'ld e,ixl';leng:0),
633 (op:'ld e,(ix+##)';leng:1),
634 (op:'undefined';leng:0),
635 (op:'ld ixh,b';leng:0),
636 (op:'ld ixh,c';leng:0),
637 (op:'ld ixh,d';leng:0),
638 (op:'ld ixh,e';leng:0),
639 (op:'ld ixh,ixh';leng:0),
640 (op:'ld ixh,ixl';leng:0),
641 (op:'ld h,(ix+##)';leng:1),
642 (op:'ld ixh,a';leng:0),
643 (op:'ld ixl,b';leng:0),
644 (op:'ld ixl,c';leng:0),
645 (op:'ld ixl,d';leng:0),
646 (op:'ld ixl,e';leng:0),
647 (op:'ld ixl,ixh';leng:0),
648 (op:'ld ixl,ixh';leng:0),
649 (op:'ld l,(ix+##)';leng:1),
650 (op:'ld ixl,a';leng:0),
651 (op:'ld (ix+##),b';leng:1),
652 (op:'ld (ix+##),c';leng:1),
653 (op:'ld (ix+##),d';leng:1),
654 (op:'ld (ix+##),e';leng:1),
655 (op:'ld (ix+##),h';leng:1),
656 (op:'ld (ix+##),l';leng:1),
657 (op:'undefined';leng:0),
658 (op:'ld (ix+##),a';leng:1),
659 (op:'undefined';leng:0),
660 (op:'undefined';leng:0),
661 (op:'undefined';leng:0),
662 (op:'undefined';leng:0),
663 (op:'ld a,ixh';leng:0),
664 (op:'ld a,ixl';leng:0),
665 (op:'ld a,(ix+##)';leng:1),
666 (op:'undefined';leng:0),
667 (op:'undefined';leng:0),
668 (op:'undefined';leng:0),
669 (op:'undefined';leng:0),
670 (op:'undefined';leng:0),
671 (op:'add a,ixh';leng:0),
672 (op:'add a,ixl';leng:0),
673 (op:'add a,(ix+##)';leng:1),
674 (op:'undefined';leng:0),
675 (op:'undefined';leng:0),
676 (op:'undefined';leng:0),
677 (op:'undefined';leng:0),
678 (op:'undefined';leng:0),
679 (op:'adc a,ixh';leng:0),
680 (op:'adc a,ixl';leng:0),
681 (op:'adc a,(ix+##)';leng:1),
682 (op:'undefined';leng:0),
683 (op:'undefined';leng:0),
684 (op:'undefined';leng:0),
685 (op:'undefined';leng:0),
686 (op:'undefined';leng:0),
687 (op:'sub a,ixh';leng:0),
688 (op:'sub a,ixl';leng:0),
689 (op:'sub (ix+##)';leng:1),
690 (op:'undefined';leng:0),
691 (op:'undefined';leng:0),
692 (op:'undefined';leng:0),
693 (op:'undefined';leng:0),
694 (op:'undefined';leng:0),
695 (op:'sbc a,ixh';leng:0),
696 (op:'sbc a,ixl';leng:0),
697 (op:'sbc a,(ix+##)';leng:1),
698 (op:'undefined';leng:0),
699 (op:'undefined';leng:0),
700 (op:'undefined';leng:0),
701 (op:'undefined';leng:0),
702 (op:'undefined';leng:0),
703 (op:'and a,ixh';leng:0),
704 (op:'and a,ixl';leng:0),
705 (op:'and a,(ix+##)';leng:1),
706 (op:'undefined';leng:0),
707 (op:'undefined';leng:0),
708 (op:'undefined';leng:0),
709 (op:'undefined';leng:0),
710 (op:'undefined';leng:0),
711 (op:'xor a,ixh';leng:0),
712 (op:'xor a,ixl';leng:0),
713 (op:'xor a,(ix+##)';leng:1),
714 (op:'undefined';leng:0),
715 (op:'undefined';leng:0),
716 (op:'undefined';leng:0),
717 (op:'undefined';leng:0),
718 (op:'undefined';leng:0),
719 (op:'or a,ixh';leng:0),
720 (op:'or a,ixl';leng:0),
721 (op:'or a,(ix+##)';leng:1),
722 (op:'undefined';leng:0),
723 (op:'undefined';leng:0),
724 (op:'undefined';leng:0),
725 (op:'undefined';leng:0),
726 (op:'undefined';leng:0),
727 (op:'cp a,ixh';leng:0),
728 (op:'cp a,ixl';leng:0),
729 (op:'cp a,(ix+##)';leng:1),
730 (op:'undefined';leng:0),
731 (op:'undefined';leng:0),
732 (op:'undefined';leng:0),
733 (op:'undefined';leng:0),
734 (op:'undefined';leng:0),
735 (op:'undefined';leng:0),
736 (op:'undefined';leng:0),
737 (op:'undefined';leng:0),
738 (op:'undefined';leng:0),
739 (op:'undefined';leng:0),
740 (op:'undefined';leng:0),
741 (op:'undefined';leng:0),
742 (op:'';leng:3),
743 (op:'undefined';leng:0),
744 (op:'undefined';leng:0),
745 (op:'undefined';leng:0),
746 (op:'undefined';leng:0),
747 (op:'undefined';leng:0),
748 (op:'undefined';leng:0),
749 (op:'undefined';leng:0),
750 (op:'undefined';leng:0),
751 (op:'undefined';leng:0),
752 (op:'undefined';leng:0),
753 (op:'undefined';leng:0),
754 (op:'undefined';leng:0),
755 (op:'undefined';leng:0),
756 (op:'undefined';leng:0),
757 (op:'undefined';leng:0),
758 (op:'undefined';leng:0),
759 (op:'undefined';leng:0),
760 (op:'undefined';leng:0),
761 (op:'undefined';leng:0),
762 (op:'undefined';leng:0),
763 (op:'undefined';leng:0),
764 (op:'pop ix';leng:0),
765 (op:'undefined';leng:0),
766 (op:'ex (sp),ix';leng:0),
767 (op:'undefined';leng:0),
768 (op:'push ix';leng:0),
769 (op:'undefined';leng:0),
770 (op:'undefined';leng:0),
771 (op:'undefined';leng:0),
772 (op:'jp (ix)';leng:0),
773 (op:'undefined';leng:0),
774 (op:'undefined';leng:0),
775 (op:'undefined';leng:0),
776 (op:'undefined';leng:0),
777 (op:'undefined';leng:0),
778 (op:'undefined';leng:0),
779 (op:'undefined';leng:0),
780 (op:'undefined';leng:0),
781 (op:'undefined';leng:0),
782 (op:'undefined';leng:0),
783 (op:'undefined';leng:0),
784 (op:'undefined';leng:0),
785 (op:'undefined';leng:0),
786 (op:'undefined';leng:0),
787 (op:'undefined';leng:0),
788 (op:'ld sp,ix';leng:0),
789 (op:'undefined';leng:0),
790 (op:'undefined';leng:0),
791 (op:'undefined';leng:0),
792 (op:'undefined';leng:0),
793 (op:'undefined';leng:0),
794 (op:'undefined';leng:0)),
795 (
796 (op:'undefined';leng:0),
797 (op:'undefined';leng:0),
798 (op:'undefined';leng:0),
799 (op:'undefined';leng:0),
800 (op:'undefined';leng:0),
801 (op:'undefined';leng:0),
802 (op:'undefined';leng:0),
803 (op:'undefined';leng:0),
804 (op:'undefined';leng:0),
805 (op:'undefined';leng:0),
806 (op:'undefined';leng:0),
807 (op:'undefined';leng:0),
808 (op:'undefined';leng:0),
809 (op:'undefined';leng:0),
810 (op:'undefined';leng:0),
811 (op:'undefined';leng:0),
812 (op:'undefined';leng:0),
813 (op:'undefined';leng:0),
814 (op:'undefined';leng:0),
815 (op:'undefined';leng:0),
816 (op:'undefined';leng:0),
817 (op:'undefined';leng:0),
818 (op:'undefined';leng:0),
819 (op:'undefined';leng:0),
820 (op:'undefined';leng:0),
821 (op:'undefined';leng:0),
822 (op:'undefined';leng:0),
823 (op:'undefined';leng:0),
824 (op:'undefined';leng:0),
825 (op:'undefined';leng:0),
826 (op:'undefined';leng:0),
827 (op:'undefined';leng:0),
828 (op:'undefined';leng:0),
829 (op:'undefined';leng:0),
830 (op:'undefined';leng:0),
831 (op:'undefined';leng:0),
832 (op:'undefined';leng:0),
833 (op:'undefined';leng:0),
834 (op:'undefined';leng:0),
835 (op:'undefined';leng:0),
836 (op:'undefined';leng:0),
837 (op:'undefined';leng:0),
838 (op:'undefined';leng:0),
839 (op:'undefined';leng:0),
840 (op:'undefined';leng:0),
841 (op:'undefined';leng:0),
842 (op:'undefined';leng:0),
843 (op:'undefined';leng:0),
844 (op:'undefined';leng:0),
845 (op:'undefined';leng:0),
846 (op:'undefined';leng:0),
847 (op:'undefined';leng:0),
848 (op:'undefined';leng:0),
849 (op:'undefined';leng:0),
850 (op:'undefined';leng:0),
851 (op:'undefined';leng:0),
852 (op:'undefined';leng:0),
853 (op:'undefined';leng:0),
854 (op:'undefined';leng:0),
855 (op:'undefined';leng:0),
856 (op:'undefined';leng:0),
857 (op:'undefined';leng:0),
858 (op:'undefined';leng:0),
859 (op:'undefined';leng:0),
860 (op:'in b,(c)';leng:0),
861 (op:'out (c),b';leng:0),
862 (op:'sbc hl,bc';leng:0),
863 (op:'ld (####),bc';leng:2),
864 (op:'neg';leng:0),
865 (op:'retn';leng:0),
866 (op:'im ';leng:0),
867 (op:'ld i,a';leng:0),
Diff truncated after the static-page render limit. Clone the repository to inspect the complete change.
ModifiedGBEmu.lpr +2−1
Diff omitted because this commit exceeds the static-page render limit.
ModifiedGBEmu.lps +18−32
Diff omitted because this commit exceeds the static-page render limit.
ModifiedGameboy.lpr +170−159
Diff omitted because this commit exceeds the static-page render limit.
ModifiedGlobal/vars.pas +599−403
Diff omitted because this commit exceeds the static-page render limit.
ModifiedGpu/ddraw_out.pas +174−158
Diff omitted because this commit exceeds the static-page render limit.
ModifiedGpu/dib_out.pas +89−76
Diff omitted because this commit exceeds the static-page render limit.
ModifiedGpu/gfx.pas +320−303
Diff omitted because this commit exceeds the static-page render limit.
ModifiedSound/sound.pas +539−473
Diff omitted because this commit exceeds the static-page render limit.
ModifiedUnitMain.pas +297−235
Diff omitted because this commit exceeds the static-page render limit.
Modifiedmainloop.pas +454−412
Diff omitted because this commit exceeds the static-page render limit.