TinyBasic on the W65C134-SXB...

Let's talk about anything related to the 6502 microprocessor.
Post Reply
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

TinyBasic on the W65C134-SXB...

Post by drogon »

Not sure to put this in Programming or Hardware, so putting it here by default...

I've more or less completed my investigations into the W65C134-SXB board which I posted about here: viewtopic.php?f=4&t=7809#p104005

I blew the dust off it for a couple of reasons - one was to see how well I could port my GIBL TinyBasic to something else and another reason concerns a new project I am going to start over the solstice period (more on that at a later date).

And as these things do, it's sort of grown... the SXB board has 128KB of Flash/EEPROM which can be re-programmed in-situ (Although the re-programming program must run from RAM) so I set about making a modified version of my TinyBasic that could let me re-program bits of the EEPROM as I needed. I also decided that I needed to throw away the on-board 4K monitor program and write my own - it uses far too much Zero Page (of which 64 bytes are already consumed by hardware mapping) and has features I just don't want, so working out how to replace that was another challenge, but the upshot is that I can power on the board, go directly into my TinyBasic and have that auto-load and run a program from the EEPROM (if needed). It does all this in the usual few milliseconds that our computers of old did..

I added some features into GIBL for the board - an LED command to read and write the 4 on-board LEDs as well as Save, Load, Chain and directory commands to save files in the EEPROM and get a listing of what's in it. It's not a filing system, but variable sized buckets (4, 8 or 16KB) to store programs in and if your program has a line zero with a REM statement in it, then that's what's printed out by the DIR command although file names are simple numbers from 0 to 15.

Chaining programs loads and runs the given program but keeps variables in-tact.

And with all that I've managed to keep the size to just under 4KB. Just. (currently about 100 bytes spare) There is more code in the "monitor" section for serial IO and a 100Hz ticker though.

You can use the byte and word indirection (peek/poke) commands to read/write the 100Hz timer and play with the spare IO ports - there is an 8-bit IO port, 7 bits of another port free and one bit in a 3rd port you can use.. And as with those old micros back then, nothing will stop you poking the wrong value in the wrong place and crashing the system. (I don't think there is a HCF feature though!)

It could make the 134-SXB board into an almost usable microcontroller platform which you can program in TinyBasic although it lacks the speed and richness of hardware facilities of a modern µC like I2C, SPI, Analog and so on but the full CPU bus is available if you wanted to add in extra memory mapped hardware...


I'll tidy it all up over the weekend and make another release with ready-to-go binaries (well SREC) files if anyone wants to load it directly into their 134-SXB board - I did have a couple of people express interest over on a Facebook group, so if you have one and want to blow the dust off, then...

Code: Select all

Welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on May  6 2018, 08:02:47.
Port /dev/ttyUSB0, 18:25:17

Press CTRL-A Z for help on special keys

� <---- I pushed the reset button at this point <----

W65C134-SXB: 32K

Gordons Interactive BASIC Language: r04
Hello, Gordon. Welcome to GIBL!
cSecs to Boot: 1

>LIST
    0 REM!BOOT
    1 C=?&4B
   10 PR "Hello, Gordon. Welcome to GIBL!"
   15 PR "cSecs to Boot: ", C
   20 END

>DIR
 0: 4K: Test in Slot 0
 1: 4K: GIBL Mandelbrot
 2: 4K: Chain Test
 3: 4K: 
 4: 4K: 
 5: 4K: 
 6: 4K: 
 7: 4K: Chain Test 2
 8: 8K: Calculate Pi
 9: 8K: 
10: 8K: 
11: 8K: 
12:16K: 
13:16K: 
14:16K: 
15: 4K: BOOT

>CH 0
Hello, world!

>LIST
    0 REM Test in Slot 0
   10 PRINT "Hello, world!"
   20 END

>CH 1
Mandelbrot - Gordons TinyBasic - Integers
Start
......,,,,,,,,,,,,,,,,,,,,,,'''''''''~~~~~=+:*$O:;==~~'''''',,,,,,,,,,,........
.......,,,,,,,,,,,,,,,,,,,,,'''''''''~~~==+%*O  ;;%=~~~~''''',,,,,,,,,.........
........,,,,,,,,,,,,,,,,''''''''~~~'====++:       %++=~~~~'',,,,,,,,,..........
........,,,,,,,,,,,',,,,'''''''~~~=++::+;;*       %;:++===='''',,,,,,..........
.....,,,,,,,,,,,,''''''''~~~~~~~==+; &$%              ;*;$+=~',,,,,,,,,,.......
...,,,,,,,,,,,''''''''''~~~~~~===::;                       +~'''',,,,,,,,,.....
....,,,,,,,,,,,'''~~~=========+++&                       %:==~~''',,,,,,,......
.....,,,,,,''''''~~=+X::+; :+++:;%                        &&=~~''',,,,,,,......
....,,''''''''~~~~=+:%  *O  B*;*%                          $=~~'',,,,,,,,......
,,,,,,''''''~~~~~=++;*X        B                            =~~''',,,,,,,,,,,,.
,,,,,'''~~~~=====;*%&                                      +=~~'',,,,,,,,,,,,,.
,,,,''~~==++++:+*&                                       O:=~~'''''',,,,,,,,,,.
,,,,'                                                   %;+==~~'''',,,,,,,,,,,.
,,,,''~~==++++:+*&                                       O:=~~'''''',,,,,,,,,,.
,,,,,'''~~~~=====;*%&                                      +=~~'',,,,,,,,,,,,,.
,,,,,,''''''~~~~~=++;*X        B                            =~~''',,,,,,,,,,,,.
....,,''''''''~~~~=+:%  *O  B*;*%                          $=~~'',,,,,,,,......
.....,,,,,,''''''~~=+X::+; :+++:;%                        &&=~~''',,,,,,,......
....,,,,,,,,,,,'''~~~=========+++&                       %:==~~''',,,,,,,......
...,,,,,,,,,,,''''''''''~~~~~~===::;                       +~'''',,,,,,,,,.....
.....,,,,,,,,,,,,''''''''~~~~~~~==+; &$%              ;*;$+=~',,,,,,,,,,.......
........,,,,,,,,,,,',,,,'''''''~~~=++::+;;*       %;:++===='''',,,,,,..........
........,,,,,,,,,,,,,,,,''''''''~~~'====++:       %++=~~~~'',,,,,,,,,..........
.......,,,,,,,,,,,,,,,,,,,,,'''''''''~~~==+%*O  ;;%=~~~~''''',,,,,,,,,.........
......,,,,,,,,,,,,,,,,,,,,,,'''''''''~~~~~=+:*$O:;==~~'''''',,,,,,,,,,,........
Finished
Time:   344 secs.
>LIST
    0 REM GIBL Mandelbrot
  100 VDU12:PRINT "Mandelbrot - Gordons TinyBasic - Integers"
  110 PRINT "Start"
  120 !&4C=0:REM Initialise TIME
  130 Z=TOP:$Z=".,'~=+:;*%&$OXB#@ "
  140 F=50
  150 FOR Y = -12 TO 12
  160 FOR X = -49 TO 29
  170 C=X*229/100
  180 D=Y*416/100
  190 A=C:B=D:I=0
  200 Q=B/F:S=B-(Q*F)
  210 T=((A*A)-(B*B))/F+C
  220 B=2*((A*Q)+(A*S/F))+D
  230 A=T: P=A/F:Q=B/F
  240 IF ((P*P)+(Q*Q))>=5 GOTO 280
  250 I=I+1:IF I<16 GOTO 200
  260 PRINT" ";
  270 GOTO 290
  280 VDU ?(Z+I)
  290 NEXT X
  300 PRINT ""
  310 NEXT Y
  320 Q=!&4C
  330 PRINT"Finished"
  340 PRINT"Time: ",Q, " secs."

344 seconds - it's a lot slower than my 16MHz Ruby board (currently 77 seconds)... But if I scale that 77 by 16/3.6884 then it's pretty close.

Cheers,

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: TinyBasic on the W65C134-SXB...

Post by BigEd »

This is great! You've tamed the beast!
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: TinyBasic on the W65C134-SXB...

Post by drogon »

BigEd wrote:
This is great! You've tamed the beast!
Thanks!

There's one aspect of the hardware I just can't get my head round though - these microcontroller versions of the 65C02 and '816 have a form of clocked ring-based serial bus. It looks like you can connect up to 8 devices together in a ring then send a message to a numbered device (0-7). The messages are 29 bits wide (top top 3 bits are the destination address). It seems simple enough but I can't think of a use for it at all and I'm not about to get a 2nd device to experiment with it...

Cheers,

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
BruceRMcF
Posts: 388
Joined: 21 Aug 2019

Re: TinyBasic on the W65C134-SXB...

Post by BruceRMcF »

drogon wrote:
...

There's one aspect of the hardware I just can't get my head round though - these microcontroller versions of the 65C02 and '816 have a form of clocked ring-based serial bus. It looks like you can connect up to 8 devices together in a ring then send a message to a numbered device (0-7). The messages are 29 bits wide (top top 3 bits are the destination address). It seems simple enough but I can't think of a use for it at all and I'm not about to get a 2nd device to experiment with it...
It seems like it was intended precisely for devices that have to talk to each other by putting either a 'C02 or 'C816 MCU in each one.
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: TinyBasic on the W65C134-SXB...

Post by Dr Jefyll »

drogon wrote:
these microcontroller versions of the 65C02 and '816 have a form of clocked ring-based serial bus.
Thanks for mentioning the matter. It turns out that the '816-based microcontroller -- the 65C265 -- does NOT have the "SIB" feature, and for that reason it escaped my attention. But the 'C02-based microcontroller -- the 65C134 -- does, and it's a pretty intriguing feature, IMO... 8) ... although I admit that, where my own needs are concerned, it's presently just "a solution looking for problem"!

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: TinyBasic on the W65C134-SXB...

Post by drogon »

Dr Jefyll wrote:
drogon wrote:
these microcontroller versions of the 65C02 and '816 have a form of clocked ring-based serial bus.
Thanks for mentioning the matter. It turns out that the '816-based microcontroller -- the 65C265 -- does NOT have the "SIB" feature, and for that reason it escaped my attention. But the 'C02-based microcontroller -- the 65C134 -- does, and it's a pretty intriguing feature, IMO... 8) ... although I admit that, where my own needs are concerned, it's presently just "a solution looking for problem"!

-- Jeff
Yes, you're right - the W65C256 doesn't have it - for some reason I thought it did. Too many differences when I was looking at these chips a while back before buying the '134-SXB board.

But yes, I feel it is a solution looking for a problem. I don't think it's even hot-pluggable...

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: TinyBasic on the W65C134-SXB...

Post by drogon »

Sort of finishing up (ish) the W65C134-SXB thing so I've done a write-up on my own website and a short video...

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

https://www.youtube.com/watch?v=-66T_P7qPq4

I've going to write-up an installation guide over the weekend for anyone who wants it (I had some interest over on Facebook)

Cheers,

-Gordon

Ps. And yes, I say GIBL on the video, so you can hear how I pronounce it :-)
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Post Reply