Mercurial > repos > blastem
comparison z80.cpu @ 1759:6e4faa10f9ee
Store sync_cycle in context rather than in a local in CPU DSL. Fix the timing of a number of instructions in new Z80 core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 19 Feb 2019 22:51:33 -0800 |
parents | 093e323dc683 |
children | 7e97d820b491 |
comparison
equal
deleted
inserted
replaced
1757:bb4d19c7c047 | 1759:6e4faa10f9ee |
---|---|
23 void z80_serialize(z80_context *context, serialize_buffer *buf); | 23 void z80_serialize(z80_context *context, serialize_buffer *buf); |
24 void z80_deserialize(deserialize_buffer *buf, void *vcontext); | 24 void z80_deserialize(deserialize_buffer *buf, void *vcontext); |
25 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler); | 25 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler); |
26 void zremove_breakpoint(z80_context * context, uint16_t address); | 26 void zremove_breakpoint(z80_context * context, uint16_t address); |
27 void z80_options_free(z80_options *opts); | 27 void z80_options_free(z80_options *opts); |
28 void z80_sync_cycle(z80_context *context, uint32_t target_cycle); | |
28 | 29 |
29 regs | 30 regs |
30 main 8 b c d e h l f a | 31 main 8 b c d e h l f a |
31 alt 8 b' c' d' e' h' l' f' a' | 32 alt 8 b' c' d' e' h' l' f' a' |
32 i 8 | 33 i 8 |
81 mov pc scratch1 | 82 mov pc scratch1 |
82 ocall read_8 | 83 ocall read_8 |
83 add 1 pc pc | 84 add 1 pc pc |
84 | 85 |
85 z80_run_op | 86 z80_run_op |
87 printf "Z80: %X @ %d\n" pc cycles | |
86 #printf "Z80: %X - A: %X, B: %X, C: %X D: %X, E: %X, H: %X, L: %X, SP: %X, IX: %X, IY: %X @ %d\n" pc a b c d e h l sp ix iy cycles | 88 #printf "Z80: %X - A: %X, B: %X, C: %X D: %X, E: %X, H: %X, L: %X, SP: %X, IX: %X, IY: %X @ %d\n" pc a b c d e h l sp ix iy cycles |
87 z80_op_fetch | 89 z80_op_fetch |
88 dispatch scratch1 | 90 dispatch scratch1 |
89 | 91 |
90 z80_interrupt | 92 z80_interrupt |
854 add 1 hlt wz | 856 add 1 hlt wz |
855 add src hlt hlt | 857 add src hlt hlt |
856 update_flags YHXN0C | 858 update_flags YHXN0C |
857 mov hlt l | 859 mov hlt l |
858 lsr hlt 8 h | 860 lsr hlt 8 h |
861 cycles 7 | |
859 | 862 |
860 00001001 add_hl_bc | 863 00001001 add_hl_bc |
861 local hlw 16 | 864 local hlw 16 |
862 local bcw 16 | 865 local bcw 16 |
863 meta hlt hlw | 866 meta hlt hlw |
886 dd 00001001 add_ix_bc | 889 dd 00001001 add_ix_bc |
887 lsl b 8 scratch1 | 890 lsl b 8 scratch1 |
888 or c scratch1 scratch1 | 891 or c scratch1 scratch1 |
889 add scratch1 ix ix | 892 add scratch1 ix ix |
890 update_flags YHXN0C | 893 update_flags YHXN0C |
894 cycles 7 | |
891 | 895 |
892 dd 00011001 add_ix_de | 896 dd 00011001 add_ix_de |
893 lsl d 8 scratch1 | 897 lsl d 8 scratch1 |
894 or e scratch1 scratch1 | 898 or e scratch1 scratch1 |
895 add scratch1 ix ix | 899 add scratch1 ix ix |
896 update_flags YHXN0C | 900 update_flags YHXN0C |
901 cycles 7 | |
897 | 902 |
898 dd 00101001 add_ix_ix | 903 dd 00101001 add_ix_ix |
899 add ix ix ix | 904 add ix ix ix |
900 update_flags YHXN0C | 905 update_flags YHXN0C |
906 cycles 7 | |
901 | 907 |
902 dd 00111001 add_ix_sp | 908 dd 00111001 add_ix_sp |
903 add sp ix ix | 909 add sp ix ix |
904 update_flags YHXN0C | 910 update_flags YHXN0C |
911 cycles 7 | |
905 | 912 |
906 fd 00001001 add_iy_bc | 913 fd 00001001 add_iy_bc |
907 lsl b 8 scratch1 | 914 lsl b 8 scratch1 |
908 or c scratch1 scratch1 | 915 or c scratch1 scratch1 |
909 add scratch1 iy iy | 916 add scratch1 iy iy |
910 update_flags YHXN0C | 917 update_flags YHXN0C |
918 cycles 7 | |
911 | 919 |
912 fd 00011001 add_iy_de | 920 fd 00011001 add_iy_de |
913 lsl d 8 scratch1 | 921 lsl d 8 scratch1 |
914 or e scratch1 scratch1 | 922 or e scratch1 scratch1 |
915 add scratch1 iy iy | 923 add scratch1 iy iy |
916 update_flags YHXN0C | 924 update_flags YHXN0C |
925 cycles 7 | |
917 | 926 |
918 fd 00101001 add_iy_iy | 927 fd 00101001 add_iy_iy |
919 add iy iy iy | 928 add iy iy iy |
920 update_flags YHXN0C | 929 update_flags YHXN0C |
930 cycles 7 | |
921 | 931 |
922 fd 00111001 add_iy_sp | 932 fd 00111001 add_iy_sp |
923 add sp iy iy | 933 add sp iy iy |
924 update_flags YHXN0C | 934 update_flags YHXN0C |
935 cycles 7 | |
925 | 936 |
926 10001RRR adc_reg | 937 10001RRR adc_reg |
927 adc a main.R a | 938 adc a main.R a |
928 update_flags SZYHVXN0C | 939 update_flags SZYHVXN0C |
929 | 940 |
1385 z80_store_index | 1396 z80_store_index |
1386 | 1397 |
1387 z80_inc_pair | 1398 z80_inc_pair |
1388 arg high 8 | 1399 arg high 8 |
1389 arg low 8 | 1400 arg low 8 |
1401 cycles 2 | |
1390 local word 16 | 1402 local word 16 |
1391 lsl high 8 word | 1403 lsl high 8 word |
1392 or low word word | 1404 or low word word |
1393 add 1 word word | 1405 add 1 word word |
1394 mov word low | 1406 mov word low |
1482 lsl high 8 word | 1494 lsl high 8 word |
1483 or low word word | 1495 or low word word |
1484 sub 1 word word | 1496 sub 1 word word |
1485 mov word low | 1497 mov word low |
1486 lsr word 8 high | 1498 lsr word 8 high |
1499 cycles 2 | |
1487 | 1500 |
1488 00001011 dec_bc | 1501 00001011 dec_bc |
1489 z80_dec_pair b c | 1502 z80_dec_pair b c |
1490 | 1503 |
1491 00011011 dec_de | 1504 00011011 dec_de |
1653 lsl T 3 scratch1 | 1666 lsl T 3 scratch1 |
1654 mov scratch1 pc | 1667 mov scratch1 pc |
1655 | 1668 |
1656 11001001 ret | 1669 11001001 ret |
1657 local pch 16 | 1670 local pch 16 |
1658 cycles 1 | |
1659 meta high pch | 1671 meta high pch |
1660 meta low pc | 1672 meta low pc |
1661 z80_pop | 1673 z80_pop |
1662 lsl pch 8 pch | 1674 lsl pch 8 pch |
1663 or pch pc pc | 1675 or pch pc pc |
2167 update_flags SZH1PN0 | 2179 update_flags SZH1PN0 |
2168 | 2180 |
2169 cb 01BBB110 bit_hl | 2181 cb 01BBB110 bit_hl |
2170 local tmp 8 | 2182 local tmp 8 |
2171 z80_fetch_hl | 2183 z80_fetch_hl |
2184 cycles 1 | |
2172 lsl 1 B tmp | 2185 lsl 1 B tmp |
2173 lsr wz 8 last_flag_result | 2186 lsr wz 8 last_flag_result |
2174 and scratch1 tmp tmp | 2187 and scratch1 tmp tmp |
2175 update_flags SZH1PN0 | 2188 update_flags SZH1PN0 |
2176 | 2189 |
2282 mov tmp scratch1 | 2295 mov tmp scratch1 |
2283 add change tmp tmp | 2296 add change tmp tmp |
2284 mov tmp l | 2297 mov tmp l |
2285 lsr tmp 8 h | 2298 lsr tmp 8 h |
2286 ocall read_8 | 2299 ocall read_8 |
2287 cycles 1 | 2300 cycles 2 |
2288 | 2301 |
2289 z80_ldd_ldi | 2302 z80_ldd_ldi |
2290 arg change 16 | 2303 arg change 16 |
2291 local tmp 16 | 2304 local tmp 16 |
2292 local tmp8 8 | 2305 local tmp8 8 |
2314 | 2327 |
2315 mov tmp c | 2328 mov tmp c |
2316 lsr tmp 8 b | 2329 lsr tmp 8 b |
2317 mov c pvflag | 2330 mov c pvflag |
2318 or b pvflag pvflag | 2331 or b pvflag pvflag |
2319 | |
2320 cycles 5 | |
2321 | 2332 |
2322 | 2333 |
2323 ed 10100000 ldi | 2334 ed 10100000 ldi |
2324 z80_ldd_ldi 1 | 2335 z80_ldd_ldi 1 |
2325 | 2336 |