Commit 20f299b

Nick committed on
add remap
commit 20f299b2e3513ddb4a81aeaadb8930719415d18f parent edbe9cc
1 changed files +20−5
Modifiedmainloop.pas +20−5
@@ -9,7 +9,7 @@
9 9
10 unit mainloop; 10 unit mainloop;
11 11
12 {$MODE Delphi} 12 {$MODE objfpc}
13 13
14 interface 14 interface
15 15
@@ -17,7 +17,7 @@ uses ExtCtrls;
17 17
18 function main_loop(a: DWord): DWORD; 18 function main_loop(a: DWord): DWORD;
19 19
20 function z80_decode: byte; pascal; 20 function z80_decode: byte;
21 procedure z80_reset; 21 procedure z80_reset;
22 22
23 implementation 23 implementation
@@ -277,6 +277,21 @@ end;
277 const 277 const
278 cycles_per_hblank = 451; 278 cycles_per_hblank = 451;
279 279
280 function remap(f: byte): Byte;
281 var
282 z,n,h,c:byte;
283 begin
284 Result := 0;
285 z := f and %01000000;
286 n := f and %00000010;
287 h := f and %00010000;
288 c := f and %00000001;
289 if z<>0 then result := result or %10000000;
290 if n<>0 then result := result or %01000000;
291 if h<>0 then result := result or %00100000;
292 if c<>0 then result := result or %00010000;
293 end;
294
280 function z80_decode: byte; 295 function z80_decode: byte;
281 var 296 var
282 Count: byte; 297 Count: byte;
@@ -305,10 +320,10 @@ begin
305 end; // Set the Carry-Flag to zero 320 end; // Set the Carry-Flag to zero
306 if (RomName[2] <> 'A') and (code <> 118) then Writeln('OP ', code); 321 if (RomName[2] <> 'A') and (code <> 118) then Writeln('OP ', code);
307 if (RomName[2] <> 'A') and (code <> 118) then 322 if (RomName[2] <> 'A') and (code <> 118) then
308 Writeln('REGS_BEFOR pc=', pc.w, ' sp=', sp_.w, ' f=', af.l, ' a=', af.h, ' b=', bc.h, ' c=', bc.l, ' d=', de.h, ' e=', de.l, ' h=', hl.h, ' l=', hl.l); 323 Writeln('REGS_BEFOR pc=', pc.w, ' sp=', sp_.w, ' f=', remap(af.l), ' a=', af.h, ' b=', bc.h, ' c=', bc.l, ' d=', de.h, ' e=', de.l, ' h=', hl.h, ' l=', hl.l);
309 Count := z80[code]; 324 Count := z80[code]();
310 if (RomName[2] <> 'A') and (code <> 118) then 325 if (RomName[2] <> 'A') and (code <> 118) then
311 Writeln('REGS_AFTER pc=', pc.w, ' sp=', sp_.w, ' f=', af.l, ' a=', af.h, ' b=', bc.h, ' c=', bc.l, ' d=', de.h, ' e=', de.l, ' h=', hl.h, ' l=', hl.l); 326 Writeln('REGS_AFTER pc=', pc.w, ' sp=', sp_.w, ' f=', remap(af.l), ' a=', af.h, ' b=', bc.h, ' c=', bc.l, ' d=', de.h, ' e=', de.l, ' h=', hl.h, ' l=', hl.l);
312 SoundUpdate(Count * (3 - gb_speed)); 327 SoundUpdate(Count * (3 - gb_speed));
313 cnumber := Count div gb_speed; 328 cnumber := Count div gb_speed;
314 329