6502 emulation on Gigatron

Topics pertaining to the emulation or simulation of the 65xx microprocessors and their peripheral chips.
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

Testing has progressed. We can run Microchess now. Video: https://youtu.be/KBdDg5JfVs8
Screenshot 2019-07-11 at 17.06.35.png
Changes are:
  • It runs in full
  • On true TTL :-)
  • Without VGA timing errors
It runs in "Super Blitz" mode to make it bearable. In the video you can see me change the VGA mode twice to speed up the program more.

[Edit: Updated the video url to show captions]
monsonite
Posts: 9
Joined: 06 Jul 2019

Re: 6502 emulation on Gigatron

Post by monsonite »

Well Done Marcel,

Microchess in under 1000 bytes of code - executed by under 1000 TTL logic gates.


regards


Ken
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

Thanks, and under 1000 Elo?

A month ago this was little more than just a nagging idea. Testing will continue the next weeks by hopping from application to application. VTL02, Apple1 BASIC and MS BASIC are still in the queue. I figure that even the larger programs can fit in the small 32K system by toying with the video memory a bit.

The impressive thing about the 476-byte Baum-Wozniak disassembler isn't just its size: it's that it seems to be secretly designed for 26 character wide displays. Now that's quite a foresight by these gentlemen!
BaumWozOnTTL.png
monsonite
Posts: 9
Joined: 06 Jul 2019

Re: 6502 emulation on Gigatron

Post by monsonite »

Hi All,

Marcel has shared his draft v4 ROM with me, so I can now run WozMon and the 6502 Disassembler on the Gigatron which is emulating a 6502 at about 1/8th of 1MHz speed.

It's 35 years since I did any 6502 assembly language - at that time on a Rockwell AIM-65 at Bangor University.

I guess I'll just have to forget all those Z80 mnemonics I learnt as a teenager and learn a whole new alien language ;)

With the Gigatron executing 6502 code - that opens up a whole new opportunity to run code - including VTL02, ehBASIC, FIG Forth, Sweet-16 and all those other 6502 goodies.

The Gigatron has come a very long way in these last 2 years - from a BMOW and TTL chips on multiple breadboards - to a fully fledged system with over 500 kits sold.

The recent expansion board allows SPI communications, and forum member xopr (Martijn) has an Arduino working as an SPI slave makes a useful peripheral processor.

https://forum.gigatron.io/viewtopic.php?f=4&p=821#p821

If you are in the UK I will be presenting Gigatron to the OSHcamp in Hebden Bridge over the weekend of 31st August, 1st September - and the following weekend with Marcel, in Cambridge at the RetroComputing Festival at the Cambridge Centre for Computing History on 7/8 September.


regards


Ken
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

Next stage of testing v6502: Micro-Soft BASIC!
Screenshot 2019-10-07 at 09.43.33.png
Not quite there yet as it goes awry after the memory check. But at least we squeezed in all of the 8.3KB binary without compromising too much on screen space. We should have 3584 BASIC bytes free on the stock 32K system.
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

Progress
Attachments
FP.png
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 emulation on Gigatron

Post by BigEd »

Very good! 1/81 is a nice number too.
monsonite
Posts: 9
Joined: 06 Jul 2019

Re: 6502 emulation on Gigatron

Post by monsonite »

Well Done Marcel,

Speaking of nice numbers - there is always 355/113

Have a great weekend at VCF Berlin


Ken
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

Thanks! Apart from Ctrl-C not yet working, it's otherwise stable. With 3583 bytes free it has the same free memory as the VIC-20. This is really a coincidence. The version we have running is an early one for the Commodore PET.

Although the system can interpret 6502 code, there still was work to do: code, buffers, zero page variables and stack needed relocation. But that wasn't the biggest hurdle as Michael Steil's excellent set of reconstructed assembly sources made that relatively painless. The main problem was to create a sufficiently large continuous memory space. Although the Gigatron has 32K of RAM, 19KB of that is used for screen memory and the remainder is heavily fragmented. For example, by default the largest continuous block we have is just 512 bytes. BASIC itself needs 8KB, plus we need some K's for user program and variables. Ouch...

The first win is to disable the sound channels 2 through 4. That creates a continuous block from $200 to $800. For this trick you need ROM v4.

The next step is to compress the video memory. Our resolution is already nothing, but we can always lower it even more! Of the 120 visible pixel lines, every 8th is always empty. At least, as long as we only use capitals, and for a mid-1970s BASIC that's perfectly acceptable. The empty pixel lines can then be shared for all rows of text. That saves 14*256 = 3585 bytes already.

The last trick is to increase the spacing between text lines from 1 to 4. This reduces the text lines from 15 to 11, but yields 4 * 7 * 256 =7,168 bytes.

Of course we then went overboard and added a flashing cursor, we made sure that the WAIT 6502 Easter Egg works, and that there is a π-symbol. The Gigatron doesn't have that in its font, but it does have T and U.... And... the font is stored without horizontal spacing, so there's our glyph:

Code: Select all

  R         S         T   pi    U
  v         v         v   v     v
  x x x x . . x x x . x x # # # # . . . x
  x . . . x x . . . . . . # . . # . . . x
  x . . . x x . . . . . . # . . # . . . x
  x x x x . . x x x . . . # . . # . . . x
  x . x . . . . . . x . . # . . # . . . x
  x . . x . . . . . x . . # . . # . . . x
  x . . . x x x x x . . . # . . . # x x .
  0 1 2 3 4 5 6 7 8 9 a b c d e f 1 1 1 1
  ^                               0 1 2 3
  font82up
Good enough for me:
Screenshot 2019-10-16 at 21.28.41.png
Last edited by mvk on Fri Oct 18, 2019 8:06 am, edited 2 times in total.
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 emulation on Gigatron

Post by BigEd »

That has to be the best derivation of Pi ever!
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

TIME$ is now also working:
TI$.png
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 emulation on Gigatron

Post by BigEd »

Aha! Now you can run benchmarks! (Calculating digits of pi, for example)
User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

Be my guest, it runs ok in the online emulator :-). Binary MSBASIC.gt1 is attached to this post. For benchmarking you should change the screen mode to the dimmest/fasted with the [Select] button.
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 emulation on Gigatron

Post by BigEd »

User avatar
mvk
Posts: 81
Joined: 21 Mar 2017

Re: 6502 emulation on Gigatron

Post by mvk »

Any result yet? I hope it's not that slow :-)
Post Reply