1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-12 10:30:23 +00:00
Commit Graph

196 Commits

Author SHA1 Message Date
Radosław Kujawa
7db9b2f7c6 RMB1 instruction is 2 byte long (opcode + one operand). 2017-02-13 21:54:10 +01:00
Radosław Kujawa
c23136800a Unbreak BBR and BBS - they access zero page, don't act like immediate. 2017-02-13 18:39:51 +01:00
Radosław Kujawa
8de5574aab Handle accessing bus in zero page relative mode just as in zero page.
It should make things less awkward and still work fine, as the only
instructions using this mode are BBS and BBR. These only use first
operand as the address in zero page to read data from.
2017-02-13 18:37:14 +01:00
Radosław Kujawa
0cbbce4eeb Fix operands fetching for zero page relative addressing. 2017-02-13 09:37:11 +01:00
Radosław Kujawa
7f1c27af75 Fix carry flag handling for SBC. 2017-02-12 23:27:36 +01:00
Radosław Kujawa
23105b4861 Hopefully fix decimal mode handling. Hopefully. 2017-02-12 22:56:07 +01:00
Radosław Kujawa
8f4900a877 Add simplified assemble_single_implied for implied addressing mode. 2017-02-12 21:54:07 +01:00
Radosław Kujawa
0fc79103f8 Well, once again... 2017-02-12 21:51:20 +01:00
Radosław Kujawa
1995569ec1 Fix prototypes for assembler functions. 2017-02-12 21:50:16 +01:00
Radosław Kujawa
0bd7b85dea Implement simpler to use assembly mode, straight to bus.
While here refactor existing assembly functions.
2017-02-12 16:47:06 +01:00
Radosław Kujawa
630daee702 Premilinary support for decimal mode.
While here add SED emulation. Implement BCD support for ADC instruction.
2017-02-10 22:23:06 +01:00
Radosław Kujawa
4c7a15f524 Add emulation of WAI instruction. 2017-02-09 21:53:45 +01:00
Radosław Kujawa
5cca703020 Add RTI emulation and test case. 2017-02-08 15:55:39 +01:00
Radosław Kujawa
299b7ee7d8 Add functions to dump stack.
Always useful.
2017-02-06 23:16:00 +01:00
Radosław Kujawa
272c4d0b7b BIT instruction does not affect overflow flag in immediate mode. 2017-02-04 22:07:56 +01:00
Radosław Kujawa
ac48e5435f Add preliminary support for interrupts. 2017-02-04 21:44:13 +01:00
Radosław Kujawa
51b47d707b Set reason for stopping the emulation when stepping. 2017-02-03 22:21:43 +01:00
Radosław Kujawa
a255b093e9 Fix overflow flag for SBC. 2017-02-02 22:54:34 +01:00
Radosław Kujawa
1f8db85688 Fix pointer precedence. Should resolve #1. 2017-02-02 20:58:30 +01:00
Radosław Kujawa
7f7fdad8dc Enable GDB-specific debug symbols. 2017-02-02 16:22:53 +01:00
Radosław Kujawa
77ce27e4fc Try to support assembling multi byte instructions. 2017-02-02 15:41:29 +01:00
Radosław Kujawa
9eff6d535b Add functions to assemble mnemonics into machine code (into buffer). 2017-02-02 14:45:06 +01:00
Radosław Kujawa
941036615e Add some null pointer checking asserts. 2017-02-02 14:43:44 +01:00
Radosław Kujawa
6711a8fe11 Fix bus space array indexing. Makes bus loading from buffer work. 2017-02-02 14:43:02 +01:00
Radosław Kujawa
3075ed87fa Add ability to load things onto bus from buffer. 2017-02-02 12:06:41 +01:00
Radosław Kujawa
eb7179f89a Fix emulation function for nop.
Problem introduced by s/'ing mindlessly.
2017-02-02 11:51:32 +01:00
Radosław Kujawa
4e3721ef85 Mark invalid instructions as invalid, not as nops. 2017-02-02 11:23:30 +01:00
Radosław Kujawa
249509fad0 Clean up unused function. 2017-02-02 11:00:32 +01:00
Radosław Kujawa
8e732f3b94 Make SBC somewhat less broken. 2017-02-01 22:15:16 +01:00
Radosław Kujawa
436810b79f The overflow flag should be represented by "V". 2017-02-01 22:11:24 +01:00
Radosław Kujawa
92418b0f1f Add SBC emulation.
Of dubious quality.
2017-02-01 14:35:50 +01:00
Radosław Kujawa
371856f6c7 Make emul_bbr/bbs/smb/rmb functions static.
Since they are only called by wrappers within the same file.
2017-01-31 23:30:49 +01:00
Radosław Kujawa
faa824e306 Implement emulation of ADC, plug the overflow test.
While here fix numerous test cases, lol.
2017-01-31 23:08:23 +01:00
Radosław Kujawa
afadfd8b13 Fix pointer usage. 2017-01-31 14:11:21 +01:00
Radosław Kujawa
44f723b016 Attempt to emulate the BRK instruction. 2017-01-31 00:31:28 +01:00
Radosław Kujawa
b21d884f8b Clear the decimal flag on initialisation. 2017-01-31 00:31:04 +01:00
Radosław Kujawa
bc137b9390 Add emulation of BBR0-7 and BBS0-7 instructions. 2017-01-30 21:25:45 +01:00
Radosław Kujawa
1c72bd23a8 More meaningful comments. 2017-01-30 21:24:45 +01:00
Radosław Kujawa
5554de9411 Add TSB and TRB emulation. 2017-01-29 22:54:06 +01:00
Radosław Kujawa
923a9db649 Add emulation of SMB0-SMB7 instructions. 2017-01-29 21:34:58 +01:00
Radosław Kujawa
3c5162b0b9 Add emulation of branch instructions. 2017-01-29 13:57:51 +01:00
Radosław Kujawa
79b5a01d10 Add forgotten prototype of program_counter_branch(). 2017-01-29 13:57:20 +01:00
Radosław Kujawa
e0fa334e3e Fix relative address pritning in disassembly. 2017-01-29 13:55:53 +01:00
Radosław Kujawa
f5a4f45127 Add function setting the PC for branches. 2017-01-29 13:29:17 +01:00
Radosław Kujawa
762f140efd Better operand formatting in disassembly. 2017-01-29 13:08:32 +01:00
Radosław Kujawa
bb3f77ec7f Add JSR and RTS emulation and tests. 2017-01-29 11:47:34 +01:00
Radosław Kujawa
4a8fbfbaeb Add CPX and CPY emulation and test cases. 2017-01-28 14:04:20 +01:00
Radosław Kujawa
3640a162a3 Add CMP emulation and test cases. 2017-01-28 13:26:51 +01:00
Radosław Kujawa
f3205e7272 Add CLI and SEI emulation and test case. 2017-01-28 11:19:34 +01:00
Radosław Kujawa
ee66f9c78c Add emulation and test for CLV instruction. 2017-01-28 11:12:25 +01:00
Radosław Kujawa
735c3677ce Correct address calculation for absolute indirect and absolute indirect X modes. 2017-01-28 00:10:22 +01:00
Radosław Kujawa
8d2d694158 Implement (partial) JMP emulation and basic test for it. 2017-01-27 22:28:33 +01:00
Radosław Kujawa
05cedfb1f5 Also print program counter when dumping regs. 2017-01-27 22:28:09 +01:00
Radosław Kujawa
9da9f61f5a There's one more field in that generated header. Adjust. 2017-01-27 22:27:30 +01:00
Radosław Kujawa
2430cfd722 Branch and jump instrucitons need special PC treatment. 2017-01-27 20:43:08 +01:00
Radosław Kujawa
9294891a23 Remove unused variable. 2017-01-27 20:43:02 +01:00
Radosław Kujawa
28a5d54510 Add ASL and LSR emulation. 2017-01-27 17:14:56 +01:00
Radosław Kujawa
f63c00b192 Add RMB emulation. 2017-01-27 13:18:02 +01:00
Radosław Kujawa
1f581d3fd3 Add function to dump registers state onto stdout. 2017-01-27 11:27:14 +01:00
Radosław Kujawa
646c7d1905 Some opcodes also write data to accumulator. 2017-01-27 11:03:50 +01:00
Radosław Kujawa
8d5482ad09 Remove x bit from the awk program, it is never started directly. 2017-01-27 10:14:32 +01:00
Radosław Kujawa
0c63342ad7 Add comments explaing what these functions do. 2017-01-27 10:13:32 +01:00
Radosław Kujawa
b7f1b8095b Add emulation of INC and DEC. 2017-01-27 00:04:47 +01:00
Radosław Kujawa
1da576c821 Merge branch 'master' of github.com:rkujawa/rk65c02 2017-01-26 17:27:22 +01:00
Radosław Kujawa
80b6848108 Preliminary support for stepping. 2017-01-26 13:11:00 +01:00
Radosław Kujawa
941e89173a Add struct with info about reason for stopping emulation. 2017-01-26 12:52:40 +01:00
Radosław Kujawa
285d2ee828 Initial state of the CPU has IRQ disable bit set. 2017-01-25 21:17:18 +01:00
Radosław Kujawa
13ef3e2d08 Add PHX, PLX, PHY, PLY emulation and test cases. 2017-01-25 13:14:00 +01:00
Radosław Kujawa
acc0fad32e Add emulation of BIT instruction and test cases for it. 2017-01-25 10:10:00 +01:00
Radosław Kujawa
7915657355 Add bit testing macro. 2017-01-25 10:09:50 +01:00
Radosław Kujawa
95db0b7dd2 Add commented out debug message. 2017-01-25 10:09:38 +01:00
Radosław Kujawa
47028b0e26 Add commented out debug message. 2017-01-24 22:18:21 +01:00
Radosław Kujawa
90b6c06e32 Fix missing breaks in indirect zero page handling switch. 2017-01-24 22:18:02 +01:00
Radosław Kujawa
39aaca5034 Correct indirect zero page Y behaviour. 2017-01-24 16:37:10 +01:00
Radosław Kujawa
20a39a8d6c Correct wrong ORA indirect zero page X size. 2017-01-24 16:36:39 +01:00
Radosław Kujawa
342a188314 Fix wrong mnemonic for absolute ORA. 2017-01-23 15:39:10 +01:00
Radosław Kujawa
6c3a203cdc Support all AND addressing modes. 2017-01-23 15:28:14 +01:00
Radosław Kujawa
0dd63f2bf0 Add ROL and ROR emulation. Too old to ror and to rol! 2017-01-23 15:25:32 +01:00
Radosław Kujawa
f9708ca049 Add STA, STY, STX emulation. 2017-01-23 15:02:21 +01:00
Radosław Kujawa
ee8a16a5ba Add ORA and EOR emulation. 2017-01-23 14:53:05 +01:00
Radosław Kujawa
6b7298cf8d Avoid intermediate variable in AND emulation. 2017-01-23 14:45:46 +01:00
Radosław Kujawa
aee947ad1f Don't forget to add LDY to CSV... 2017-01-23 14:44:55 +01:00
Radosław Kujawa
552fad8a7e LDY emulation. 2017-01-23 14:43:54 +01:00
Radosław Kujawa
5c38e5f05a Add emulation of LDX, TXA, TYA, TXS, TAX, TAY, TSX. 2017-01-23 14:38:50 +01:00
Radosław Kujawa
ce492e6cd3 Support all addressing variants of STZ. 2017-01-23 13:46:17 +01:00
Radosław Kujawa
05f6599681 BSD/OS X awk does not like hexadecimal constants. 2017-01-23 13:41:31 +01:00
Radosław Kujawa
9c88afae2a BBRx and BBSx instructions have zero page relative addressing.
Add zero page relative as a separate addressing type and adjust
opcode definitions for these two type of opcodes.
2017-01-23 12:17:06 +01:00
Radosław Kujawa
ee16c64310 Implement absolute X, absolute Y addressing. 2017-01-23 10:48:37 +01:00
Radosław Kujawa
452e4b3806 Implement indirect zero page with X and indirect zero page with Y addressing. 2017-01-23 10:29:19 +01:00
Radosław Kujawa
9e32c3e493 Try to emulate all variants of LDA.
But some addressing modes are still unimplemented...
2017-01-23 10:27:51 +01:00
Radosław Kujawa
87c424557e Implement aboslute addressing mode. 2017-01-23 00:00:45 +01:00
Radosław Kujawa
5eede9333b Add emulation of PHP, PLP instructions and test cases for them. 2017-01-22 23:01:24 +01:00
Radosław Kujawa
074ecdccc3 No-operand INC has accumulator addressing mode, not implied. 2017-01-22 22:44:08 +01:00
Radosław Kujawa
1460817230 Correct mnemonic for LDX with Zero Page,Y addressing. 2017-01-22 22:40:32 +01:00
Radosław Kujawa
fb7d4b28e7 Add DEX, DEY emulation and test cases for them. 2017-01-22 22:35:50 +01:00
Radosław Kujawa
52247f0ce4 Implement CLC, SEC and test for them. 2017-01-22 13:50:04 +01:00
Radosław Kujawa
473e0e2636 Add INX, INY emulation and test cases.
Some comments while here.
2017-01-22 13:07:21 +01:00
Radosław Kujawa
e763ca0d3a Avoid getting instruction definition again when emulating.
While here try to make program counter incrementation more universal
and flexible.
2017-01-22 11:07:19 +01:00
Radosław Kujawa
c7633feb87 Add STZ emulation. 2017-01-21 21:46:35 +01:00
Radosław Kujawa
86c9c6414c Add function to write data onto bus according to choosen addressing mode. 2017-01-21 21:43:31 +01:00