SKERNAL - a ROM for the 6502 MULTICOMP

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
User avatar
kiamnetrem
Posts: 6
Joined: 27 Aug 2014

SKERNAL - a ROM for the 6502 MULTICOMP

Post by kiamnetrem »

Hello there,

some time ago I stumbled over Grant Searle's MULTICOMP pick-and-mix FPGA computer over at http://searle.hostei.com/grant/Multicomp/

My favorite flavor is the 6502 version (having had some previous adventures with C64 programming). By default MULTICOMP has a Microsoft Basic in ROM, which on my instance is replaced with my own ROM that I develop mostly as an exercise to get more practice with 6502 assembly, which I began to pick up for C64 programming, starting in 2012.

The name of my ROM is SKERNAL (Stupid KERNAL - eventually to morph into Silly KERNAL) and I develop it over at https://github.com/maikmerten/SKERNAL

The main features are:
  • Rudimentary command line
  • Supports (and requires) the SD card controller on MULTICOMP
  • Basic support for the FAT16 file system (currently read-only, only 8.3 file names, only root directory)
  • List files in root directory of the FAT16 file system
  • Load files into memory (starting at page 8 until end of RAM or EOF)
  • Execute files loaded from SD card (JSR to the start of page eight)
  • Some facility to inspect and alter memory contents
  • Load and execute the file "autoexec.bin" on boot, if present

It's perhaps the last feature that's most useful. On MULTICOMP, the ROM is baked into the FPGA core, so changing the software basically means recompiling the whole computer. By flashing SKERNAL once and just updating autoexec.bin on the SD card one can have the machine boot into custom software without recompiling/reprogramming of the "hardware".
skernal1.png
skernal2.png
skernal3.png
Here's TinyBasic loaded from FAT16 and executed:
skernal-tinybasic.png
I develop this in Seth Morabito's Symon emulator (https://github.com/sethm/symon), for which I developed some additions to support the MULTICOMP machine model. I use CA65 as cross-assembler.


Perhaps this is useful for someone. Being a beginner in 6502 assembly clearly the coding style and overall design is quite questionable. For me it's an interesting playground to mess with, so let's see how things develop ;)

Oh, and currently it's not much of a KERNAL, given there's no proper way for external software to find the internal routines.
User avatar
HansO
Posts: 206
Joined: 31 Oct 2003

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by HansO »

Great development!

Grants work is fantastic already , and you opened it now to a real system!

Thanks for sharing!
User avatar
kiamnetrem
Posts: 6
Joined: 27 Aug 2014

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by kiamnetrem »

Thanks for your kind comment! I hesitate to call it a "real system", but at least it makes getting software to the MULTICOMP a bit easier ;)

I noticed I did no attach a binary for easy experimentation, so here's a random up-to-date version.

The code currently occupies approximately 4K (of the 8K available in MULTICOMP). I do wonder if instead of cramming more stuff into the ROM I should perhaps go the opposite route: Squeezing the "autoload from FAT" into as little room as possible (2K is more than enough for this, but 1K may not fit) so it'll load the rest of the system (console and tools) from storage. This in effect would be a minimal BIOS in ROM, which then loads a proper system from disk. This would enable a 62K RAM + 2K ROM configuration of MULTICOMP (currently it's 56K + 8K), which I guess is a decent amount of RAM for a 6502 computer without memory management.

Hmmm.
Attachments
skernal.zip
(6.33 KiB) Downloaded 208 times
User avatar
HansO
Posts: 206
Joined: 31 Oct 2003

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by HansO »

I like the idea of a minimal loader, just enough simple code to load more complex programs. Be it a Basic, or an OS that can execute programs itself/

Complete freedom to load any program/operating system.
User avatar
kiamnetrem
Posts: 6
Joined: 27 Aug 2014

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by kiamnetrem »

I forked a new code base for the "small bootloader with FAT-support" idea, called "tinyload". The source is over at https://github.com/maikmerten/tinyload

I'm currently down to 1237 bytes, so 2K of ROM indeed is plenty. I'm sure I can shave off even more, but getting this into 1K may prove difficult. I guess 1.5K ROMs are pretty unusual? (Then again, MULTICOMP is a FPGA project...)
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by BigEd »

That's a nice achievement. Note that boot code in an FPGA can be pre-loaded into RAM, or into a mixture - so it doesn't have to remain as dedicated ROM, depending on what you want.

Cheers
Ed
User avatar
kiamnetrem
Posts: 6
Joined: 27 Aug 2014

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by kiamnetrem »

Okay, am now down to 1019 bytes and I can quite possibly chew off some additional bytes. If I manage to get it small enough to clear the I/O-area (which overlaps ROM on MULTICOMP) and the reset/irq vectors one can squeeze it into a 1K ROM, making 63K of RAM available.

As for preloading into RAM: The FPGA used by MULTICOMP only has a few K of RAM, so an external SRAM-Chip is used for the configurations with spacious memory (the wiring of which can be seen on the right-hand side of my avatar picture). That one always starts empty/undefined.
Last edited by kiamnetrem on Sat Aug 30, 2014 1:21 pm, edited 1 time in total.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by BigEd »

Ah, right - thanks!
User avatar
kiamnetrem
Posts: 6
Joined: 27 Aug 2014

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by kiamnetrem »

Okay, tinyload is now 962 bytes. I think that's enough to not reach into the the I/O region starting at 0xffd0. So a 63K RAM + 1K ROM configuration is possible for the MULTICOMP.
SIGINT112
Posts: 1
Joined: 14 Oct 2014

Re: SKERNAL - a ROM for the 6502 MULTICOMP

Post by SIGINT112 »

Hello everyone,
i just found this thread. In some weeks i'll get my FPGA-Board, and i'm planning to build the Multicomp too. It would be great to design a fully functional computer system with FAT-Filesystem,Sound and Graphics based on the this design. I just thought about segmented memory: You could copy the bootloader to external RAM and then switch of the internal ROM. Just like the C64.

By the way, this could be interesting: http://papilio.cc/index.php?n=Playground.C64SID

Greetings, SIGINT
Post Reply