comparison z80.cpu @ 1721:0e5df2bc0f9f

Implementation of some of the rotate instructions in new Z80 core
author Michael Pavone <pavone@retrodev.com>
date Thu, 31 Jan 2019 22:41:37 -0800
parents 1648c685083a
children ac809d044cab
comparison
equal deleted inserted replaced
1720:1648c685083a 1721:0e5df2bc0f9f
1 info 1 info
2 prefix z80_ 2 prefix z80_
3 opcode_size 8 3 opcode_size 8
4 extra_tables cb ed dded fded dd fd 4 extra_tables cb ed dded fded ddcb fdcb dd fd
5 body z80_run_op 5 body z80_run_op
6 include z80_util.c 6 include z80_util.c
7 header z80.h 7 header z80.h
8 8
9 regs 9 regs
65 65
66 11111101 fd_prefix 66 11111101 fd_prefix
67 z80_op_fetch 67 z80_op_fetch
68 dispatch scratch1 fd 68 dispatch scratch1 fd
69 69
70 dd 11001011 ddcb_prefix
71 z80_calc_index ix
72 cycles 2
73 mov pc scratch1
74 ocall read_8
75 add 1 pc pc
76 dispatch scratch1 ddcb
77
78 fd 11001011 fdcb_prefix
79 z80_calc_index iy
80 cycles 2
81 mov pc scratch1
82 ocall read_8
83 add 1 pc pc
84 dispatch scratch1 fdcb
85
70 z80_check_cond 86 z80_check_cond
71 arg cond 8 87 arg cond 8
72 local invert 8 88 local invert 8
73 switch cond 89 switch cond
74 case 0 90 case 0
865 881
866 dd 10100110 and_ixd 882 dd 10100110 and_ixd
867 z80_fetch_index ix 883 z80_fetch_index ix
868 and a scratch1 a 884 and a scratch1 a
869 update_flags SZYH1PXN0C0 885 update_flags SZYH1PXN0C0
870 cycles 3
871 886
872 fd 10100110 and_iyd 887 fd 10100110 and_iyd
873 z80_fetch_index iy 888 z80_fetch_index iy
874 and a scratch1 a 889 and a scratch1 a
875 update_flags SZYH1PXN0C0 890 update_flags SZYH1PXN0C0
876 cycles 3
877 891
878 11100110 and_immed 892 11100110 and_immed
879 z80_fetch_immed 893 z80_fetch_immed
880 and a scratch1 a 894 and a scratch1 a
881 update_flags SZYH1PXN0C0 895 update_flags SZYH1PXN0C0
909 923
910 dd 10110110 or_ixd 924 dd 10110110 or_ixd
911 z80_fetch_index ix 925 z80_fetch_index ix
912 or a scratch1 a 926 or a scratch1 a
913 update_flags SZYH0PXN0C0 927 update_flags SZYH0PXN0C0
914 cycles 3
915 928
916 fd 10110110 or_iyd 929 fd 10110110 or_iyd
917 z80_fetch_index iy 930 z80_fetch_index iy
918 or a scratch1 a 931 or a scratch1 a
919 update_flags SZYH0PXN0C0 932 update_flags SZYH0PXN0C0
920 cycles 3
921 933
922 11110110 or_immed 934 11110110 or_immed
923 z80_fetch_immed 935 z80_fetch_immed
924 or a scratch1 a 936 or a scratch1 a
925 update_flags SZYH0PXN0C0 937 update_flags SZYH0PXN0C0
953 965
954 dd 10101110 xor_ixd 966 dd 10101110 xor_ixd
955 z80_fetch_index ix 967 z80_fetch_index ix
956 xor a scratch1 a 968 xor a scratch1 a
957 update_flags SZYH0PXN0C0 969 update_flags SZYH0PXN0C0
958 cycles 3
959 970
960 fd 10101110 xor_iyd 971 fd 10101110 xor_iyd
961 z80_fetch_index iy 972 z80_fetch_index iy
962 xor a scratch1 a 973 xor a scratch1 a
963 update_flags SZYH0PXN0C0 974 update_flags SZYH0PXN0C0
964 cycles 3
965 975
966 11101110 xor_immed 976 11101110 xor_immed
967 z80_fetch_immed 977 z80_fetch_immed
968 xor a scratch1 a 978 xor a scratch1 a
969 update_flags SZYH0PXN0C0 979 update_flags SZYH0PXN0C0
1002 dd 10111110 cp_ixd 1012 dd 10111110 cp_ixd
1003 z80_fetch_index ix 1013 z80_fetch_index ix
1004 mov scratch1 last_flag_result 1014 mov scratch1 last_flag_result
1005 cmp scratch1 a 1015 cmp scratch1 a
1006 update_flags SZHVN1C 1016 update_flags SZHVN1C
1007 cycles 3
1008 1017
1009 fd 10111110 cp_iyd 1018 fd 10111110 cp_iyd
1010 z80_fetch_index iy 1019 z80_fetch_index iy
1011 mov scratch1 last_flag_result 1020 mov scratch1 last_flag_result
1012 cmp scratch1 a 1021 cmp scratch1 a
1013 update_flags SZHVN1C 1022 update_flags SZHVN1C
1014 cycles 3
1015 1023
1016 11111110 cp_immed 1024 11111110 cp_immed
1017 z80_fetch_immed 1025 z80_fetch_immed
1018 mov scratch1 last_flag_result 1026 mov scratch1 last_flag_result
1019 cmp scratch1 a 1027 cmp scratch1 a
1326 ed 01RRR001 out_bc 1334 ed 01RRR001 out_bc
1327 lsl b 8 scratch2 1335 lsl b 8 scratch2
1328 or c scratch2 scratch2 1336 or c scratch2 scratch2
1329 mov main.R scratch1 1337 mov main.R scratch1
1330 ocall io_write8 1338 ocall io_write8
1339
1340 00000111 rlca
1341 rol a 1 a
1342 update_flags YH0XN0C
1343
1344 00010111 rla
1345 rlc a 1 a
1346 update_flags YH0XN0C
1347
1348 00001111 rrca
1349 ror a 1 a
1350 update_flags YH0XN0C
1351
1352 00011111 rra
1353 rrc a 1 a
1354 update_flags YH0XN0C
1355
1356 cb 00000RRR rlc
1357 rol main.R 1 main.R
1358 update_flags SZYH0PXN0C
1359
1360 cb 00000110 rlc_hl
1361 local tmp 8
1362 z80_fetch_hl
1363 mov scratch1 tmp
1364 rol tmp 1 tmp
1365 update_flags SZYH0PXN0C
1366 mov tmp scratch1
1367 z80_store_hl
1368
1369 z80_rlc_index
1370 arg tmp 8
1371 mov wz scratch1
1372 ocall read_8
1373 cycles 1
1374 mov scratch1 tmp
1375 rol tmp 1 tmp
1376 update_flags SZYH0PXN0C
1377 mov tmp scratch1
1378 z80_store_index
1379
1380 ddcb 00000110 rlc_ixd
1381 local tmp 8
1382 z80_rlc_index tmp
1383
1384 ddcb 00000RRR rlc_ixd_reg
1385 z80_rlc_index main.R
1386
1387 fdcb 00000110 rlc_iyd
1388 local tmp 8
1389 z80_rlc_index tmp
1390
1391 fdcb 00000RRR rlc_iyd_reg
1392 z80_rlc_index main.R
1393
1394 cb 00010RRR rl
1395 rlc main.R 1 main.R
1396 update_flags SZYH0PXN0C
1397
1398 cb 00010110 rl_hl
1399 local tmp 8
1400 z80_fetch_hl
1401 mov scratch1 tmp
1402 rlc tmp 1 tmp
1403 update_flags SZYH0PXN0C
1404 mov tmp scratch1
1405 z80_store_hl
1406
1407 ddcb 00010110 rl_ixd
1408 local tmp 8
1409 mov wz scratch1
1410 ocall read_8
1411 cycles 1
1412 mov scratch1 tmp
1413 rlc tmp 1 tmp
1414 update_flags SZYH0PXN0C
1415 mov tmp scratch1
1416 z80_store_index
1417
1418 fdcb 00010110 rl_iyd
1419 local tmp 8
1420 mov wz scratch1
1421 ocall read_8
1422 cycles 1
1423 mov scratch1 tmp
1424 rlc tmp 1 tmp
1425 update_flags SZYH0PXN0C
1426 mov tmp scratch1
1427 z80_store_index