Open caps0ff opened 4 years ago
As mentioned in #5 i will take a stab at this task. For documentation, here are some links to existing 6502 assembler written in Python:
I will take a look at the availible code and report back what i could find
Great!
FYI here is the special document you need: http://www.seanriddle.com/cpu6502.pdf
This document lists the proprietary encoding and any other special changes (maybe extra instructions). Please let us know if you have any questions!
Ok, after staring at regular expressions for a long time I decided to take my own approach and start fresh. So far the script can read assembler files, split them into single statements and parse adress and numerical values. The next step is to implement the assembler instructions. I uploaded the current state as a gist here. Should I create my own repository or do you want to have a central one?
With the addresses I still have a problem to understand how to distinguish between absolute and zero page addressing. Is it true that the differentiation is based on the size of the address? So if less than or equal to 255 it is Zeropage Mode, if bigger it is an absolute address?
Thanks!
Unfortunately the project lost a little momentum recently as there were a lot of requests to take down the repository. So maybe easiest if you just want to publish your lint tool in a dedicated repo, and someone can grab it as needed for general work on that CPU.
Don't have bandwith right now to look at the ISA, so unfortunately can't answer that question.
Hey, no problem. After seeing the repo disapear i was worried something like this might have happened.
My code can be found here: https://github.com/drunsinn/pySunPlus6502asm Let me know when the Problems have been solved and work can start again!
I have been using the 2500AD 6502 assembler (running inside of DosBox); it accepts the Furby source as is.
The Furby CPU bank selects ROM pages; the information about which data tables go into which ROM pages is not in the source scans; and will have to be deduced by comparing ROM mask data to the data in the table source.
I would think that it would be easier to construct a "linker" -- some code that places the code fragments in the correct ROM pages -- that could read the 2500AD output files then it would be to build a entire assembler/linker tool chain.
I amy have spoke too soon; the 2500AD assembler object file format is proving opaque.
One of the outstanding questions as to whether a stock 6502 assembler can be used for linting was there were rumors there were a few custom instructions. Is this not true? Can you confirm it uses the stock instruction set?
I have about 60 pages transcribed; they assemble with the 2500AD assembler. The opcodes are all standard; there are a couple of psuedo-ops that are 2500AD specific. (I don't know what the original assembler was; 2500AD was the only one I counld find that spoke the psuedo-ops.) The pseudo ops don't do anything magic; replacing them with appropriate equivalents should allow assembly with any reasonably good assembler.
Is there somne way I can add my transcribed pages to your data set? Also, I am not clear on ROM mask decoding; it seemed like you had started on that... what progress?
Regarding instruction sets: the Furby uses the SunPlus SPC81A mircoprocessor. This chip is a 6502 CPU with several instructions removed; ie it has fewer instructions then a standard 6502. (There is no Y register, no Y mode addressing "(addr),Y" and no Y register instructions (TAY, TYA, etc)).
The chip has ROM memory, programmed at the factory with the Furby code; a standard 6502 does not have ROM on the chip.
The SCP81A has specialized I/O circuits on the chip. For a standard 6502 system, these kind of circuits would be on the curcuit board with the 6502 chip. These I/O circuits are accessed though memory addresses, so in that sense there are "specialized opcodes". For example, the "Port DIrection Control Register" is located at memory location 0. On a standard 6502, a "STA 0" instruction would stores the contents if register A in memory location 0; on the Furby CPU, there is no memory location 0; the instruction passes the contents of register A to the I/O control circuits. This makes no difference to the assembler; it sees the "STA 0" and generates the same code regardless of the magic behavior of memory location 0.
Update: It appears that I am mistaken. The SPC does use different operation codes -- the assembly language is the same, but the generated binary code is different. The differences are well documented. According to various discussion boards, when SunPlus generates the ROM mask, it starts with the assembly listing, parsing out the opcodes and operands and remaps the opcodes.
I have sucessfully been using the 'asmx' cross-assembler to assemble the transcribed source; asmx is open source so jiggering it to produce the SPC opcodes should be straight-forward.
What: the original Furby uses a special 6502 with a non standard binary format. It would be nice to have a way to assemble this into proper binaries, such as we start to decode the microscpoe images.
Skills required:
We have an instruction manual that describes the list of opcodes and their relevant encoding. We believe but aren't sure that a couple of non-standard opcodes were added.
It is left to the reader on how they want to implement this. You could use an existing project or make a stand alone program. As long as its clear how to run this on either Linux or Windows it should be acceptable.