You need a python script (or its compiled windows exe) called emc_uploader_term.
The protocol is an extended version on the one used in other SXBs. They added some additional functions to write into the flash ROM area. The first 30K of the flash is copied into the upper RAM area ($8000-$F7FF) at boot then memory protected so looks like a ROM. If the 'WDC' signature is at $8000 then its executed from $8004.
I have been writing my own uploader in C# but its not complete. I've been too busy with other projects including trying to fix bugs in the WDC tool set which now crashes a lot less than it used to. Baby steps.
Yesterday I manged to build and run my first completely C application on the 165 which used the I2C peripheral to drive an SSD1306 OLED 128x32 display.
W65C165
- BitWise
- In Memoriam
- Posts: 996
- Joined: 02 Mar 2004
- Location: Berkshire, UK
- Contact:
Re: W65C165
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
-
DerTrueForce
- Posts: 483
- Joined: 04 Jun 2016
- Location: Australia
Re: W65C165
Ideally, I'd just use that script, but it's supposed to be in WDCTools. The version I have(v2.1) doesn't have it, and I seem to be unable to get hold of a newer one.
- BitWise
- In Memoriam
- Posts: 996
- Joined: 02 Mar 2004
- Location: Berkshire, UK
- Contact:
Re: W65C165
WDC sent me a revised prototyping board which has a real time clock, a flash memory and an encryption chip on it. I've been writing a peripheral library for the W65C165MMC and the other SXB boards. This is a photo of a test program using the RTCC and an I2C OLED display to create a simple clock.
The library is mostly C based and compiles with the WDC C compiler I have been fixing. The library trades performance for portability. For example a my simple LED flashing test looks like this:
If I moved the code to say the W65C02SXB and wanted to drive the LED from a VIA output then the only change would to include a different header <system/w65c02sxb.h> and alter the #define to reference a VIA pin object like 'via1_A0'.
When I have a bit more working and the updated compiler is released I will make the repository public.
Code: Select all
#include <system/w65c134sxb.h>
#define LED_PIN pin50
void main (void)
{
pinSetMode (&LED_PIN, OUTPUT);
for (;;) {
pinSetState (&LED_PIN, HIGH);
delayMS (500);
pinSetState (&LED_PIN, LOW);
delayMS (500);
}
}
When I have a bit more working and the updated compiler is released I will make the repository public.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
-
DerTrueForce
- Posts: 483
- Joined: 04 Jun 2016
- Location: Australia
Re: W65C165
I've worked out the format the W65c165 uploader wants, that it calls Z-bin. WDC's linker outputs this, but it can be generated by just about anything using appropriate assembler directives. This format is also documented in the linker manual, found here, on page 37.
It's basically a header, imediately followed by the binary.
The header is as follows:
It's basically a header, imediately followed by the binary.
The header is as follows:
Code: Select all
78 xx xx xx yy yy yy
| | | | | | +- Length bank byte. I've only ever seen this as zero, but I don't have an '816-based board, which is where I assume this would be used.
| | | | | +---- Length high byte
| | | | +------- Length low byte
| | | +---------- Start address bank byte
| | +------------- Start address high byte
| +---------------- Start address low byte
+------------------- Literal "Z"
-
DerTrueForce
- Posts: 483
- Joined: 04 Jun 2016
- Location: Australia
Re: W65C165
I believe I've also found the SPI and I2C cores used in the '165, based on the sheer similarity in naming, structure, and register descriptions.
They can be found here: https://opencores.org/projects/simple_spi and here: https://opencores.org/projects/i2c/.
The documentation is here: [Link] and here: [Link].
They can be found here: https://opencores.org/projects/simple_spi and here: https://opencores.org/projects/i2c/.
The documentation is here: [Link] and here: [Link].