6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 9:53 am

All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: W65C02SXB board
PostPosted: Sun Nov 15, 2020 10:26 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Welcome! That's a nice idea, that we could at least signpost this thread as a resource and perhaps even make a document from it.

BTW, when you add yourself to a group (in linux), if you're working from the command line it should be enough to use 'newgrp' to get the group access live. If you're working from GUI tools it should be enough to logout and login again.


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Sun Nov 15, 2020 12:41 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
abqlewis wrote:
Andrew,
If you don't mind, I have a few questions/discussions/rambles :

1) To anyone else trying this on Linux, I had to add myself to the dialout group, AND restart to get it to work.

On Linux the standard is to add yourself to the dialout group. Other *NIX flavours have more accessible permisions on the device itself.

abqlewis wrote:
2) Do I have to do anything special to the code I load, to make sure that I returns to your monitor when it's done? In other words, if I load a program with the 'S' command and then run it with the 'G' command, HOW does it get back to the monitor, or DOES it get back?

The monitor traps software interrupts generated by the BRK instruction. Just add one at the location you want to stop at. In fact thats what actually starts the monitor in the first place. The reset routine initialises the vectors, prints the title string then executes a BRK to enter the monitor.
Code:
                             RESET:
00:0091' 78                :                 sei
00:0092' D8                :                 cld                     ; Ensure binary mode

00:0093' A2FF              :                 ldx     #$ff            ; Reset the stack
00:0095' 9A                :                 txs

                                             repeat                  ; Setup vectors
00:0096' BD????            :                  lda    VECTORS,x
00:0099' 9D707E            :                  sta    IRQV,x
00:009C' E8                :                  inx
00:009D' E004              :                  cpx    #4
00:009F' D0F5              :                 until eq

00:00A1' 20????            :                 jsr     NewLine
00:00A4' A200              :                 ldx     #TTL_STR
00:00A6' 20????            :                 jsr     ShowString
00:00A9' 20????            :                 jsr     NewLine

                                             repeat
00:00AC' 0000              :                  brk    #0              ; And enter monitor
00:00AE' 80FC              :                 forever


abqlewis wrote:
3) My plan for now is to find a cross-assembler/compiler that runs in Linux (thinking cc65) that can make an S19 file (or something I can script into it), and loading through your monitor until I get something that works. Does this fit into what your monitor is meant for?

The JAR file contains my 65xx assembler and linker which is used to build the monitor itself but could be used for anything. If you want a C compiler then CC65 will generate 6502 code which doesn't make use of the additional 65C02 instructions. I'm working on a port of WDC's tools to gcc but it going to take time.

The monitor can load S19 files but the uploader itself handles S19, S28 or WDC's binary format. The monitor is good for loading and debugging small programs but a if you need to use all the memory then the uploader is a better option for getting code in memory and starting it.

abqlewis wrote:
4) A sub-discussion in the thread is about re-programing the flash. One of my theories is that I can dump the contents of ROM with your monitor and write a little script to make it into an SRecord file as a backup to the existing TIDE ROM. Does this make sense? I don't have a programmer (with adapters) yet, but that's next. I need to investigate more, because this level of detail in hardware is a little out of my realm.

You can dump the rom using the uploader
Code:
java -cp "Dev65.jar;jSerialComm-2.6.2.jar" com.wdc65xx.sxb.Uploader -port COM6 savebin 8000 8000 rom.bin
java -cp "Dev65.jar;jSerialComm-2.6.2.jar" com.wdc65xx.sxb.Uploader -port COM6 save 8000 8000 rom.s28

Looks like there is a bug in the S28 save command. I'll fix it.

abqlewis wrote:
5) I copied your run.sh command but removed the "term" parameter. This allows your program to just load your monitor into RAM, and then I can just run the Linux "screen" anytime I want to connect to the board.

Thats fine but you can lose some of the output generated between the program starting and your new terminal program starting.

abqlewis wrote:
6) As far as the ROM is concerned, I think I could continue to uses the old TIDE ROM where it is and add my rom-program to a different "page" of the ROM. The docs mention changing ROM banks, but don't really say how. I've gleaned from the schematic that it involves the CA and CB ports of VIA2. I'm not quite there yet, but I will be.

Yes. A program running in RAM can switch banks by changing the VIA settings then erase and reload the flash. As the lines have external pullup resistors you flip the pins (CA2 & CB2) between being inputs (the initial setting) and low outputs by changing the control settings in the PCR register.

My 816/265 hacker programs have commands to change ROM and XMODEM download into flash but I haven't done 134/02 versions yet.

I've been discussing revising the boot ROM with another developer who is also working with WDC on the FPGA versions. The upgrade would include a flash programming option as this is already provided on the C165.

You should check the speed of the CPU oscillator Y2 next to the USB socket. It should be 8MHz but the latest batch of boards have the same 1.8432MHz oscillator used for the ACIA chip (Y1) mounted by mistake. (Someone put the wrong reel in the pick and place machine). I might try to fix my board myself but the oscillator is a bit too close to the VIA socket and I don't want to melt it.

_________________
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


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Sun Nov 15, 2020 1:34 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
abqlewis wrote:
3) My plan for now is to find a cross-assembler/compiler that runs in Linux (thinking cc65) that can make an S19 file (or something I can script into it), and loading through your monitor until I get something that works. Does this fit into what your monitor is meant for?


I'm using this as part of a Makefile in my W65C134SBX board:


Code:
rubyOsCode.srec:        rubyOs
        @rm -f rubyOsCode.srec
        @echo [rubyOsCode.srec]
        @srec_cat rubyOs -binary -offset 0x1000 -o rubyOs.srec

rubyOs: $(OBJ)
        $Q echo [Link]
        $Q ld65 -t none -S 0x1000 -vm -m rubyOs.map -o rubyOs $(OBJ)



So get srec_cat (package is srecord in Devian and probably most other Debian derived distros)

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Wed Jan 26, 2022 7:58 pm 
Offline

Joined: Sat Oct 23, 2021 8:05 am
Posts: 15
Location: Sweden
I too managed to get my W65C02SXB up and running using some of the tools from here. I eventually wrote up my own python script as a learning exercise:

https://github.com/kalj/sxb

As part of this I (manually) disassembled the flash image, and got this:

https://gist.github.com/kalj/66b23c4405 ... 50555af283

I've kind of tried to add comments / label names which describe what it seems to do. There are still quite a few question marks remaining, e.g.

* What's up with those pieces of seemingly dead code? (e.g. at $83cd and $84b9)
* Why is the code sometimes making weird unnecessary jumps just to return back immediately (there are a lot of "functions" which just do RTS)?
* What is the stuff stored at $8080 which sort of looks like an array of addresses? I don't see this being used anywhere.

NB: If you think there are any copyright problems with publishing that code, I can take it down again.


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Thu Jan 27, 2022 8:46 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Surely some interesting findings in there! Thanks for sharing the result of your explorations...


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Sat Mar 05, 2022 4:47 am 
Offline

Joined: Thu Apr 11, 2019 12:31 pm
Posts: 33
Attached is my disassembly of the WDC65c816SK WDCMON. I think I decoded the jump table. Perhaps it will help you fill in the gaps.

It seems to me that the 65C02 contains code that is only relevant for the 65C816.

The attached file produces the same bin as the ROM on the W65C816SXB board when assembled with ca65.

I have also attached sxb.inc which is needed to assemble sxb.s.

Finally, I have added a listing so that the oddities (using absolute addresses for zero page) are more apparent.


Attachments:
sxb.lst.txt [52.27 KiB]
Downloaded 142 times
sxb.inc.txt [4.49 KiB]
Downloaded 104 times
sxb.s [25.85 KiB]
Downloaded 130 times
Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Thu May 16, 2024 8:31 pm 
Offline

Joined: Wed Apr 10, 2024 7:24 am
Posts: 51
kalj wrote:
I too managed to get my W65C02SXB up and running using some of the tools from here. I eventually wrote up my own python script as a learning exercise:

https://github.com/kalj/sxb


Nice kalj, it helped me to do something similar but then in the browser. I'm using the experimental Web Serial API (only the Chrome, Edge and Opera browsers support it). But I managed to create a simple web app that is able to connect to the device and send commands to the W65C02SXB board and receive data. It is not finished yet but here is a screenshot of what I made:

Attachment:
Scherm­afbeelding 2024-05-16 om 22.30.19.png
Scherm­afbeelding 2024-05-16 om 22.30.19.png [ 259.12 KiB | Viewed 1163 times ]


I only implemented the info, getstate and read memory commands (that was needed for the getstate command. I can create buttons for some command to make it easier like for the getstate command. It could use some polishing the received bytes good be presented better.

I would be awesome to create an in browser IDE for the board. But that would take some time to build. I will make it available on the web some day and also make it opensource so you can all have a look at the sources.

kalj wrote:
As part of this I (manually) disassembled the flash image, and got this:

https://gist.github.com/kalj/66b23c4405 ... 50555af283

I've kind of tried to add comments / label names which describe what it seems to do. There are still quite a few question marks remaining, e.g.

* What's up with those pieces of seemingly dead code? (e.g. at $83cd and $84b9)
* Why is the code sometimes making weird unnecessary jumps just to return back immediately (there are a lot of "functions" which just do RTS)?
* What is the stuff stored at $8080 which sort of looks like an array of addresses? I don't see this being used anywhere.

NB: If you think there are any copyright problems with publishing that code, I can take it down again.


Do you or anyone else have an idea where those 29 info bytes stand for? Information about the board?


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Thu May 16, 2024 9:15 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
SpaceCoaster wrote:
Attached is my disassembly of the WDC65c816SK WDCMON...

Looks like someone’s superannuated 65C02 code.  :D  Other than some seemingly-gratuitous absolute-long instructions, very little of it is native-mode 816 assembly language.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Fri May 17, 2024 6:57 am 
Offline

Joined: Wed Apr 10, 2024 7:24 am
Posts: 51
BigDumbDinosaur wrote:
SpaceCoaster wrote:
Attached is my disassembly of the WDC65c816SK WDCMON...

Looks like someone’s superannuated 65C02 code.  :D  Other than some seemingly-gratuitous absolute-long instructions, very little of it is native-mode 816 assembly language.


Ah I see, sxb.s lines 374 to 432 is the same it says $04 - REGISTERS. So is this a dump of the registers? I just see some loading of bytes into the A register and transmit character in A on FT245. Or these byte the addresses of the memory positions where the status of the registers are stored? From monitor.s of kalj his disassembly #define STATE_A $7e00. I can see the second and third bytes from the are the same sbx.s line 377 and 379.


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Wed May 22, 2024 10:38 am 
Offline

Joined: Wed Apr 10, 2024 7:24 am
Posts: 51
I uploaded the source code of my web based tool for the W65C02SXB at https://github.com/sandergroen/Web-W65C02SXB. It uses the [url="https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API"]Web Serial API[/url] because it is an experimental API not all browsers support this. It only works in Chrome, Edge and Opera for now. I will publish it somewhere so I have a portable tool that does not require any installation other than one of there webbrowsers 8) .

It does not implement every command available for the board yet. But it should be enough to write bytes to memory and run that.

I hope to figure out a way to write to the flash rom. Does anyone know how to do this? I want to be able to store programs there someday so I don't have to program it over and over again.

What I also want to add to this tool is an assembler so I can code in assembly from the browser and run that on the board (entering bytes is getting tiresome and error-prone). I know there are Javascript libraries to do that. Does anyone know if there is a good one?


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Wed May 22, 2024 10:50 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
viridi wrote:
I hope to figure out a way to write to the flash rom. Does anyone know how to do this? I want to be able to store programs there someday so I don't have to program it over and over again.


I'm fairly sure Andrew Jacobs had code to do this - however I did it in the 65c134sxb board which I think has the same device to let me store TinyBasic programs, so if you get my TinyBasic sources and look there, you might find some useful code.

https://projects.drogon.net/porting-my- ... 5c134-sxb/

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Wed May 22, 2024 11:02 am 
Offline

Joined: Wed Apr 10, 2024 7:24 am
Posts: 51
drogon wrote:
viridi wrote:
I hope to figure out a way to write to the flash rom. Does anyone know how to do this? I want to be able to store programs there someday so I don't have to program it over and over again.


I'm fairly sure Andrew Jacobs had code to do this - however I did it in the 65c134sxb board which I think has the same device to let me store TinyBasic programs, so if you get my TinyBasic sources and look there, you might find some useful code.

https://projects.drogon.net/porting-my- ... 5c134-sxb/

-Gordon


Ah, yes I guess he did. I will have a look at it and at your source code as well. Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Wed May 22, 2024 11:17 am 
Offline

Joined: Wed Apr 10, 2024 7:24 am
Posts: 51
Ah, I found the S19 Record Loader code of Andrew Jacobs. I will have a look. Also in the other topic about this board I found some information.


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Thu Jun 06, 2024 10:41 am 
Offline

Joined: Wed Apr 10, 2024 7:24 am
Posts: 51
BigDumbDinosaur wrote:
SpaceCoaster wrote:
Attached is my disassembly of the WDC65c816SK WDCMON...

Looks like someone’s superannuated 65C02 code.  :D  Other than some seemingly-gratuitous absolute-long instructions, very little of it is native-mode 816 assembly language.


I'm trying to understand the source code. I'm relatively new to 6502 programming and I see that there is more then one syntax to program the 6502. There are a lot of places in the source code with f: in front of some label. What is that? Is that used in a specific assembler?

I also see that sometimes f: is used and sometimes not.

Code:
sta f:exec_k
lda exec_k


Why is that?


The WDCMON is used for both the 65C02 as well as the 65C816 based boards. I'm only interested in the 65C02 at the moment. The program is useful but I would like to strip it down so I want to remove al 65C816 stuff. I have a new empty flash rom (SST39SF010A the same as on the board) that I can use so I can get the preinstalled one out. So I can't mess up the original installed program. I also want to add some functionality myself or rewrite some stuff maybe.


Top
 Profile  
Reply with quote  
 Post subject: Re: W65C02SXB board
PostPosted: Fri Jun 07, 2024 10:15 am 
Offline

Joined: Wed Apr 10, 2024 7:24 am
Posts: 51
I tried to figure it out. Could it be that f: is used for status flags and a: for addresses? Is it some kind of convention? How does the assembler handle this syntax? Or is this source code incomplete?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 70 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron