65Org16 - beginnings of an emulator
Posted: Fri Aug 19, 2011 5:08 pm
I made the first steps in extending Mike's py65 emulator to support the 65Org16 as a 3rd choice of CPU. The (python) source is on github.
When you run the emulator, it's in 6502 mode, then you switch to 65Org16 mode:
There's an assembler and disassembler but I haven't touched them yet, likewise the memory fill and dump commands are still 8-bit and limited to 64k address space.
But I could step through a short test program (note the lack of 16-bit constants and any branch offsets, and the opcodes and operands all coming out as 8-bit):
and it behaves as expected:
(some reformatting for the forum - it actually looks like this:)
When you run the emulator, it's in 6502 mode, then you switch to 65Org16 mode:
Code: Select all
Py65 Monitor
PC AC XR YR SP NV-BDIZC
6502: 0000 00 00 00 ff 00110000
.mpu
Current MPU is 6502
Available MPUs: 6502, 65Org16, 65C02
.mpu 65Org16
Reset with new MPU 65Org16
PC AC XR YR SP NV---------BDIZC
65Org16: 00000000 0000 0000 0000 ffff 0000000000110000
But I could step through a short test program (note the lack of 16-bit constants and any branch offsets, and the opcodes and operands all coming out as 8-bit):
Code: Select all
$0000 a9 6a LDA #$6a
$0002 6a ROR A
$0003 6a ROR A
$0004 6a ROR A
$0005 6a ROR A
$0006 69 50 ADC #$50
$0008 6a ROR A
$0009 6a ROR A
$000a 48 PHA
$000b 88 DEY
$000c 98 TYA
$000d 38 SEC
$000e 69 02 ADC #$02
$0010 aa TAX
$0011 68 PLA
$0012 ea NOP
$0013 4c 00 00 JMP $0000
Code: Select all
PC AC XR YR SP NV---------BDIZC
00000000 0000 0000 0000 fff6 0000000000110100 LDA #$6a
00000002 006a 0000 0000 fff6 0000000000110100 ROR A
00000003 0035 0000 0000 fff6 0000000000110100 ROR A
00000004 001a 0000 0000 fff6 0000000000110101 ROR A
00000005 800d 0000 0000 fff6 1000000000110100 ROR A
00000006 4006 0000 0000 fff6 0000000000110101 ADC #$50
00000008 4057 0000 0000 fff6 0000000000110100 ROR A
00000009 202b 0000 0000 fff6 0000000000110101 ROR A
0000000a 9015 0000 0000 fff6 1000000000110101 PHA
0000000b 9015 0000 0000 fff5 1000000000110101 DEY
0000000c 9015 0000 ffff fff5 1000000000110101 TYA
0000000d ffff 0000 ffff fff5 1000000000110101 SEC
0000000e ffff 0000 ffff fff5 1000000000110101 ADC #$02
00000010 0002 0000 ffff fff5 0000000000110101 TAX
00000011 0002 0002 ffff fff5 0000000000110101 PLA
00000012 9015 0002 ffff fff6 1000000000110101 NOP
00000013 9015 0002 ffff fff6 1000000000110101 JMP $0000
Code: Select all
.
$000d 38 SEC
PC AC XR YR SP NV---------BDIZC
65Org16: 0000000d ffff 0000 ffff fff5 1000000000110101
.
$000e 69 02 ADC #$02
PC AC XR YR SP NV---------BDIZC
65Org16: 0000000e ffff 0000 ffff fff5 1000000000110101
.
$0010 aa TAX
PC AC XR YR SP NV---------BDIZC
65Org16: 00000010 0002 0000 ffff fff5 0000000000110101
.