Commit e34da70

Nick committed on
WIP debugging yase core
commit e34da70d9a50ed61fb16db4a42f257a0a22e671a parent 8ae6850
3 changed files +16−88
ModifiedCpu/machine.pas +2−0
@@ -285,6 +285,8 @@ var
285 templ, tempr: byte; 285 templ, tempr: byte;
286 286
287 begin 287 begin
288 writeln('SPOKE ', address, ' ', Data);
289
288 if cart = nil then 290 if cart = nil then
289 exit; 291 exit;
290 if (address < $8000) then 292 if (address < $8000) then
ModifiedCpu/z80cpu.pas +10−79
@@ -975,7 +975,6 @@ end;
975 975
976 function Z80halt: byte; 976 function Z80halt: byte;
977 begin 977 begin
978 writeln('halting');
979 if gbr_ime then 978 if gbr_ime then
980 halt_mode := 1 979 halt_mode := 1
981 else 980 else
@@ -1824,27 +1823,8 @@ end;
1824 1823
1825 function LDFF00plusN_A: byte; 1824 function LDFF00plusN_A: byte;
1826 begin 1825 begin
1827 {TODO} 1826 spokeb($ff00 + speekb(pc.w), af.h);
1828 1827 Inc(pc.w);
1829 w1 := speekb(pc.w);
1830 asm
1831 //PUSH dword ptr [rip+pc.w]
1832 //CALL speekb
1833 //LEA ESP,[ESP+4]
1834 MOV AX, [rip+w1]
1835
1836 INC word ptr [rip+pc.w]
1837 MOV AH,$ff
1838
1839
1840 //push dword ptr [rip+af.h]
1841 //PUSH EAX
1842 //CALL SpokeB
1843 //LEA ESP,[ESP+8]
1844 MOV [rip+w1], AX
1845 end;
1846
1847 spokeb(w1, af.h);
1848 1828
1849 Result := 12; 1829 Result := 12;
1850 end; 1830 end;
@@ -1858,7 +1838,8 @@ end;
1858 1838
1859 function ld_ff00plusC_a: byte; 1839 function ld_ff00plusC_a: byte;
1860 begin 1840 begin
1861 {TODO} 1841 spokeb($ff00 + bc.l, af.h);
1842
1862 Result := 8 1843 Result := 8
1863 end; 1844 end;
1864 1845
@@ -1928,40 +1909,8 @@ end;
1928 1909
1929 function ld_nn_a: byte; 1910 function ld_nn_a: byte;
1930 begin 1911 begin
1931 {TODO} 1912 spokeb(wordpeek(pc.w), af.h);
1932 1913 Inc(pc.w, 2);
1933 i1 := speekb(pc.w);
1934 Inc(pc.w);
1935 i2 := speekb(pc.w);
1936 Inc(pc.w);
1937
1938 asm
1939 //PUSH dword ptr [rip+pc.w]
1940 //CALL speekb
1941 //LEA ESP,[ESP+4]
1942 //PUSH EAX
1943 //INC word ptr [rip+pc.w]
1944 //PUSH dword ptr [rip+pc.w]
1945 //CALL speekb
1946 //LEA ESP,[ESP+4]
1947 //INC word ptr [rip+pc.w]
1948 MOV EAX,[rip+i2]
1949
1950 SHL EAX,8
1951
1952 //POP EBX
1953 MOV EBX,[rip+i1]
1954
1955 MOV AL,BL
1956
1957 //PUSH dword ptr [rip+af.h]
1958 //PUSH EAX
1959 //CALL SpokeB
1960 //LEA ESP,[ESP+8]
1961 MOV [rip+i1], EAX
1962 end;
1963
1964 spokeb(i1, af.h);
1965 1914
1966 Result := 16; 1915 Result := 16;
1967 end; 1916 end;
@@ -2012,27 +1961,8 @@ end;
2012 1961
2013 function ld_a_ff00plusn: byte; 1962 function ld_a_ff00plusn: byte;
2014 begin 1963 begin
2015 {TODO} 1964 af.h := speekb($ff00 + speekb(pc.w));
2016 1965 Inc(pc.w);
2017 w1 := speekb(pc.w);
2018 asm
2019 //PUSH dword ptr [rip+pc.w]
2020 //CALL speekb
2021 //LEA ESP,[ESP+4]
2022 MOV AX, [rip+w1]
2023
2024 INC word ptr [rip+pc.w]
2025 MOV AH,$ff
2026
2027
2028 //push dword ptr [rip+af.h]
2029 //PUSH EAX
2030 //CALL SpokeB
2031 //LEA ESP,[ESP+8]
2032 MOV [rip+w1], AX
2033 end;
2034
2035 spokeb(w1, af.h);
2036 1966
2037 Result := 12; 1967 Result := 12;
2038 end; 1968 end;
@@ -2046,7 +1976,8 @@ end;
2046 1976
2047 function ld_a_ff00plusc: byte; 1977 function ld_a_ff00plusc: byte;
2048 begin 1978 begin
2049 {TODO} 1979 af.h := speekb($ff00 + speekb(bc.l));
1980
2050 Result := 8; 1981 Result := 8;
2051 end; 1982 end;
2052 1983
Modifiedmainloop.pas +4−9
@@ -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; 20 function z80_decode: byte; pascal;
21 procedure z80_reset; 21 procedure z80_reset;
22 22
23 implementation 23 implementation
@@ -296,20 +296,15 @@ begin
296 296
297 if (code = $cb) then 297 if (code = $cb) then
298 begin 298 begin
299 //code := speekb(pc.w) or 256; 299 code := speekb(pc.w) or 256;
300 Inc(pc.w); 300 Inc(pc.w);
301 end; 301 end;
302 302
303 asm 303 asm
304 CLC 304 CLC
305 end; // Set the Carry-Flag to zero 305 end; // Set the Carry-Flag to zero
306 if romname[2] <> 'A' then begin 306 if (RomName[2] <> 'A') and (code <> 118) then Writeln('OP ', code);
307 //writeln(code); 307 Count := z80[code];
308 //readln;
309 Count := z80[code]
310 end
311 else
312 Count := z80[code];
313 SoundUpdate(Count * (3 - gb_speed)); 308 SoundUpdate(Count * (3 - gb_speed));
314 cnumber := Count div gb_speed; 309 cnumber := Count div gb_speed;
315 310