• Firmware examination

    Keith03/10/2021 at 17:14 0 comments


    Read the development board firmware ROM and had a go at disassembly to get an idea of how it works. I used da65 from the cc65 suite, but this can only disassemble 65C02 code. The firmware is part 65C816 code, so that code disassembles incorrectly. 

    Although the firmware reserves 32K of the ROM, much of it is blank (0xFF) so the actual code is only about 1.6 K.

    It looks like the USB-interfacing VIA does not use the timers or interrupts, just polled. I need to check the VIA PCR register initialisation code to ascertain this.


    Disassembled code did not reassemble using '816-capable assemblers. Gordon Henderson provided the answer. Disassembly to 65C02 code produces some instructions that are not 65C816 instructions. My assumption that the 65C816 instruction set was an inclusive superset of the 65C02 is false!

    All the BBSn and BBRn are 'C02 instructions that have been replaced with other codes on the C816.

    Some hand disassembly later, I have some 65C816 source code that assembles. I have uploaded it.

  • Installing software tools

    Keith02/26/2021 at 02:37 0 comments


    Following instructions from here: https://wdc65xx.com/gettingstarted/816-sxb-getting-started/

    1. Download WDCTools Install WDCTools and set update preferences with the installer

    2. Download D2XX FTDI Driver

    3. Download the WDC Programming Manual (not required, but helpful resource)

    4. Download XLEDFLASH project (unzip into C:/wdc/W65C816SXB

    Done. Alas it is Windows only, so I hade to install on a spare i3 laptop instead of my i7 desktop.

    Now Find WDCTools Support  videos on YouTube

  • Porting BBC BASIC

    Keith02/21/2021 at 02:50 0 comments

    At first sight, this doesn't look too hard.  I have already hacked BBC BASIC for the Acorn second processor 6502, to run on an experimental 65C02 board. The only I/O is through the USB channel, and that is trivial. 

    There is a thread on stardot.org.uk about BBC BASIC on the 65816. Seems it has been done for the Acorn Communicator but not very well, perhaps to meet deadlines.


    I don't have time to modify the BASIC to take advantage of the 65816 instruction set and expand the built-in assembler, but it should run pretty fast.

    http://mdfs.net/Software/BBCBasic/BBC/Basic4.zip is for the 65C02, which uses a subset of the 65C816 instruction set.


    Discovered John Kortink has ported a 65C816 BBC BASIC onto his soft 65C02 second processor for the BBC micro. This is closed source, though if you had one running you could peek all the code bytes and disassemble them to analyse the firmware modifications.


    My DE0-NANO FPGA and W65C816SX development boards arrived. I could do the porting work in the FPGA, but I don't want to wait for the CPU core to be compiled every time I make a tiny software mod. So I have installed all the new Western Digital development tools.


    After emailing some big names of the 6502 world, I learned from the very long thread about it: https://stardot.org.uk/forums/viewtopic.php?f=2&t=21159 it seems that the main guy working on 65816 BASIC is Dominic Beesley who has a disassembly here https://github.com/dominicbeesley/CommunicatorBasic100 which has a fair few source files.

    Looks like this is not a trivial job, if better programmers than me are having to work hard.

    The assembler now handles all 65816 instructions, which is good. The software is purported to be ... inelegant for want of a better word. It has to deal with short and long addressing, the overhead of using a separate 'module' for arithmetic, and other stuff.

    At this point I wonder if it is what I like about the 6502 - a well-known instruction set and architecture that is easy to use. Should I just port a simple 6502 BBC BASIC and then leave the potential of the 65816 modes to programmers with the time to harness it? Off the top of my head, I can't think of anything I would want a massive memory map. Maybe a memory-based disk system? Lots of graphics memory? I do big jobs on my PC and the development board does not have graphics. My spare time is scarce and my hobby projects are therefore fairly small.

    The Communicator BASIC includes code for running all the BBC micro I/O such as keyboard, disks, screen etc. A tube version would be simpler and smaller, and indeed there is a thread about this for an FPGA version https://stardot.org.uk/forums/viewtopic.php?f=3&t=9975. Looks like a better starting point for me.

    John Kortink has firmware for his 6502 second processor that uses a real ULA, 65C02/65C816 and a CPLD. It is obtainable from here: http://www.zeridajh.org/hardware/reco6502/updates.htm


    After reading the manual and some disassembly work, I have a better idea of what it does and how. The BASIC is modified have extra commands to configure the system through calls to a modified MOS.

    The configuration is loaded in a shift-register fashion. It is write-only, so I might be able to run his firmware and have the hardware simply ignore the shifted bits. If I can't use the configuration commands, then I might as well start from the unmodified 2nd processor BASIC and MOS.

    The master clock is 44.2638 MHz, which can be divided to nice baud-rate generator compatible frequencies.

    I have only disassembled the 65C02 version, using the da65 tool from the cc65 suite. 
    Alas it does not disassemble 65C816 code. Or compile C to 65C816 code either. I am inclined to implement just a plain 65C02 BASIC and let other people implement a 65C816 version if they have...

    Read more »

  • Purchasing

    Keith02/19/2021 at 03:25 0 comments

    2021-02-17 10:54

    W65C816SXB ordered from Tindie, for $68.16 plus £15 postage US to UK. Much cheaper than Mouser who were charging £111.48 including postage. 

    2021-02-17 19:16 Item dispatched! 

    2021-02-19 11:15 Item leaves USA!

    2021-02-24 21:19 Item clears customs and enters Royal Mail network.

    2021-02-25 Item arrives. Yay!