Page 1 of 1
Port of w65c816sxb-hacker to CC65.
Posted: Fri Mar 11, 2022 3:42 am
by SpaceCoaster
I have ported the WDC Tools based
w65c816sxb-hacker to use the CC65 suite of tools. W65c816sxb-hacker was developed by Andrew Jacobs and is...
A tool for modifying the firmware on your WDC W65C816SXB Development Board
The SXB development board has a 128K Flash ROM that can be updated under
software control. The design of the SXB board divides the ROM into four 32K
banks and maps one these into the memory area between $00:8000 and $00:FFFF.
A tool for modifying the firmware on your WDC W65C816SXB Development Board
The SXB development board has a 128K Flash ROM that can be updated under
software control. The design of the SXB board divides the ROM into four 32K
banks and maps one these into the memory area between $00:8000 and $00:FFFF.
Currently I generate a direct copy of the original binary found on Github. This original binary was lacking the last few commits that were made to the original repository. I will redo the missed commits and a few other oddities when I have had more time to test.
The new and not improved at all program can be found at
https://github.com/derekmulcahy/w65c816sxb-hacker
As part of this I have extended the sxb.py tool developed by Karl Ljungkvist to write WDC Tools style binary files directly to the SXB board.
Share and Enjoy!
Re: Port of w65c816sxb-hacker to CC65.
Posted: Fri Mar 11, 2022 7:49 am
by BigEd
Thanks for picking this up and porting it!
Re: Port of w65c816sxb-hacker to CC65.
Posted: Sun Mar 13, 2022 9:24 pm
by SpaceCoaster
I have ported
w65c265sxb-hacker. This produces output which is identical to the WDC Tools version. I am waiting for USPS to deliver my W65C265SXB board to test it.
One oddity that I noticed on both the sxb-hacker ports.
For the following instruction
The WDC Tools generated an instruction using an absolute address.
CA65 generates a direct page instruction.
The same thing happens for LDA, STA, ORA, ROL and ASL with 0,X as operands.
It looks like a WDC code generation bug to me.
Re: Port of w65c816sxb-hacker to CC65.
Posted: Mon Mar 14, 2022 3:27 am
by tmr4
It looks like a WDC code generation bug to me.
The two assemblers just treat the values differently. From the
WDC Assembler/Linker Users Guide, pg. 22:
When the assembler is parsing addresses, it starts by assuming that an address is ABSOLUTE. ... To specify an address that is a direct page address, the `<' character precedes the address or expression.
In CA65 on the other hand, addresses default to the size of the segment based on the memory model. I assume you have the direct page set at page 0. See the CA65 documentation at
Address sizes and
Memory models.
ca65 assigns each segment and each symbol an address size. ... The default address size of a segment depends on the memory model used.
It's easy to test. In CA65 see what you get with
Re: Port of w65c816sxb-hacker to CC65.
Posted: Mon Mar 14, 2022 3:32 am
by BillG
One oddity that I noticed on both the sxb-hacker ports.
For the following instruction
The WDC Tools generated an instruction using an absolute address.
CA65 generates a direct page instruction.
The same thing happens for LDA, STA, ORA, ROL and ASL with 0,X as operands.
It looks like a WDC code generation bug to me.
Is there any chance there is a space between the zero and the comma?
Some assemblers treat extra characters on a line as a comment while others require that the comment start with a delimiter such as a semicolon.
Edit: ignore the above. I now see that you are talking about the indexed forms of the instructions.
Does the assembler allow the use of '<' or '>' to force the address size?
Re: Port of w65c816sxb-hacker to CC65.
Posted: Mon Mar 14, 2022 12:15 pm
by SpaceCoaster
Thanks, that makes it clearer.
Direct page could be anywhere so LDA 0,X is ambiguous unless the assembler has more info. By defaulting to the 16 bit address it won’t be wrong if zeropage was intended but it wll be wrong if direct page was intended AND the page is no longer at $0000. If you are using the direct page feature then you should tag your labels/addresses.
Defaulting to generating a direct page instruction is more fragile as changing the direct page elsewhere will break the program.
I have changed my mind, WDC’s choice is better for under-specified addresses as it doesn’t break 6502 code when used in a 65816 environment in which direct page might have been moved.
Re: Port of w65c816sxb-hacker to CC65.
Posted: Mon Mar 14, 2022 6:45 pm
by SpaceCoaster
Does the assembler allow the use of '<' or '>' to force the address size?
The CA65 assembler uses < and > to select the low byte and the high byte respectively. It uses ^ to select the bank byte.
The address size can be forced using z:, a: and f: as prefixes for 8, 16 and 24 bit addresses.
It's easy to test. In CA65 see what you get with
In CA65 that generates the absolute address.
Cheers,
Derek