PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

My first computer was not a ZX Spectrum but a TRS80 MC10.

A few years ago I coded my very first machinecode game for that computer.
After porting my SHOGUN game from the ZX Spectrum to the ZX81 and
the Videopac gameconsole I coded this game on the TRS80 MC10.

Like my ZX81 emulator from 1997 and my Videopac emulator from 2000
it seems almost impossible to make it a decent emulator.

The following problem might occur:
- speed
The Motorola MC6803 has a clockspeed of .79Mhz but the opcodes are faster
than a Z80. Moreover you need to translate the opcodes to run as Z80-code.

- memory
The memory is not 1 block like the ZX81 so I need to find a way to organize
the memorylocations.

- the coloursettings:
I have to make a bit different settings

Code: Select all

TRS80       black - green       - beige         - blue 
ZX Spectrum black - green       - bright yellow - blue 

TRS80       red   - white       - cyan     - magenta - orange
ZX Spectrum red   - brightwhite - cyan     - magenta - yellow
- sound
I need to work out how to solve this. I might make it optional
to get some speed

- screen
The screen is smaller than the ZX Spectrum. Will I center it
or leave a block at the bottom. Will I do instant display or by intrupt?

- Reading keyboard
Keyboard is different from ZX Spectrum

- opcodes
I am working on a list of all opcodes. Unlike a Z80 there is no
list of all opcode and all memory methods. Almost done.
zx_if1
Drutt
Posts: 48
Joined: Fri Jul 16, 2021 8:53 pm
Location: Peru
Contact:

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by zx_if1 »

Hi dr.beep

perhaps a trs80 model 1 level 1 4k ram only emulator for speccy?
maybe maybe?
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

zx_if1 wrote: Sat Jul 15, 2023 6:56 am Hi dr.beep

perhaps a trs80 model 1 level 1 4k ram only emulator for speccy?
maybe maybe?
Let me start with 1 then take a look at the next.

Download my videopacemulator and see how hard it is to get some speed.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

I started coding.

I think BASIC can be at same speed as TRS80 MC10.
Machine code I hope to get at reasonable speed.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

So after my first day coding and finding out that this method needs improvements I was thinking of a solution while walking the dog.

Best ideas come while walking the dog. I had the idea for my 1K pinball while walking the dog.

I will rearrange memory and this will help speeding up the emulator.

Back to the drawingboard.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

So far I have restarted coding 3x.

I have now coded all routines to emulate each opcode.
Next step is to check if all opcodes are done properly.
After that I can code the emulator mainprogram.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Pegaz »

Dr beep wrote: Fri Aug 04, 2023 11:21 am So far I have restarted coding 3x.

I have now coded all routines to emulate each opcode.
Next step is to check if all opcodes are done properly.
After that I can code the emulator mainprogram.
It looks promising.
I like TRS-80 for several reasons, it was the first available home computer in my country (ex-Yugoslavia) and it was used by our pioneers of computing in the early days.
Model 1 also inspired the author of our first domestic home computer "Galaksija", although its not its clone, because it has an original design.
So, it would be very nice to have an emulator like this on the Spectrum and play some TRS80 games on it. :)
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

The MC10 it is...

which is different from the bigger brothers
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

So far I have coded 256 routines for each opcode.
Now I am ordering the routines to make it a fast opcodefinder like the mainprogram in
SP-2-ZX81 or the Galaksija-emulator.

This is the mainpart of the emulator.
After that I need to code an intruptroutine to read keyboard and set up screen.

Technically the emulator should then run but really slow (first expectation).
Like the ZX81 I can then translate a part of the ROM to make it run faster in BASIC.

So still A LOT to do but I am getting to know more and more about the TRS8 MC10.
ANDREWRYALS
Microbot
Posts: 106
Joined: Sat Mar 24, 2018 5:02 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by ANDREWRYALS »

Sounds like an amazing project.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

ANDREWRYALS wrote: Sat Aug 05, 2023 8:34 pm Sounds like an amazing project.
I have the same feeling as I had in 1997 and 2000 when I coded my first ZX81 emulator and the VIdeopac emulator.

Same unknown outcome, knowing that speed will be an issue.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

All 256 opcodes are now coded in the emulator.

Before running the first tests I am relocating some parts to make the emulator a few 100 bytes smaller.
To allign all opcodes empty blocks are coded in between opcodes. Some opcodes are slower to keep the
emulator small in size. This allows also relocating code to other locations to shorten the code even further.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

I am now testing the first routines of the ROM.
Step by step.

I will add a debuggerstop option so I can see if certain addresses are reached.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

I assumed that the zeropage would only be accessed by an opcode with zeropage addressing but the ROM also uses direct access.

This means I need to relocate the zeropage and the emulatoropcode table.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

2 parts of the ROM now tested. I altered the RAM-size routine since this will not work in RAM on the ZX Spectrum.
Default RAM-size is set to 4K, like my good old MC10 was.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

Some bugs in the emulation solved. Now small alteration in a CALL-opcode is needed.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

The processor of the MC10 also set Z when 16bit register goes to 0.
Opcode emulation altered for DEX
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

The emulator stays in a loop for cursor input so it is time to
add screenupdating and keyboardreading
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

I am working on the display and now I found out that the characters are 8x12 which could create colourclash.
I will therefore make my own smaller characterset sized 8x8
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

I have defined all characters. Colours are a bit different but I like it sofar
Image
zx_if1
Drutt
Posts: 48
Joined: Fri Jul 16, 2021 8:53 pm
Location: Peru
Contact:

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by zx_if1 »

Hi dr. beep I like it all that you do
orange is the only color that speccy have not but its replacing color is not so bad
i think

ok...
mc-10
has the following basic characteristics
CPU Motorola 6803 (6800 compatible)
SPEED 0.89 MHz
CO-PROCESSOR MC-6847 Video Generator
RAM 4 kb (up to 20 kb), 3142 bytes left for user
ROM 8 kb (Microcolor Basic)
TEXT MODES 32 x 16
SOUND Beeper with variable pitch and duration
and
GRAPHIC MODES With Basic : 64 x 32, 8 colors
With machine-code : up to 128 x 192, 2 colors
With machine-code and 16k expansion RAM : 256 x 192, 2 colors


is there a possibility in the future to emulate the printer and load/save to tape?
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

zx_if1 wrote: Wed Aug 23, 2023 8:13 am Hi dr. beep I like it all that you do
orange is the only color that speccy have not but its replacing color is not so bad
i think

ok...
mc-10
has the following basic characteristics
CPU Motorola 6803 (6800 compatible)
SPEED 0.89 MHz
CO-PROCESSOR MC-6847 Video Generator
RAM 4 kb (up to 20 kb), 3142 bytes left for user
ROM 8 kb (Microcolor Basic)
TEXT MODES 32 x 16
SOUND Beeper with variable pitch and duration
and
GRAPHIC MODES With Basic : 64 x 32, 8 colors
With machine-code : up to 128 x 192, 2 colors
With machine-code and 16k expansion RAM : 256 x 192, 2 colors


is there a possibility in the future to emulate the printer and load/save to tape?
Yeah, I had to do something with orange. just as the charactersize is also smaller.


I will work on all step by step
1) make emulator work
2) speed up basic by recoding parts of ROM
3) sound
4) load and save of games
Order might change
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

Unlike the Z80 LD opcodes change flags
I need to alter all LD opcodes
User avatar
Quazar
Drutt
Posts: 31
Joined: Tue Jun 16, 2020 2:28 pm
Contact:

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Quazar »

Watching this with interest! I enjoy reading about your emulation of other systems.
Quazar - Developing for the SAM Coupé for 30+ Years!
Hardware, Software, 'SAM Revival' magazine -> www.samcoupe.com
Plus hardware for the ZX Spectrum, RC2014 and other general retro peripherals.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: PROJECT : A TRS80 MC10 emulator on the ZX Spectrum

Post by Dr beep »

Quazar wrote: Wed Aug 23, 2023 8:48 pm Watching this with interest! I enjoy reading about your emulation of other systems.
Because I did some emulation on the SAM too and a portal can be made???
SAM81 is such a port.

Too bad SAM2GB (Sam2GameBoy) was never finished.

Simon Owen used my mainprogram in his emulator on the SAM
Last edited by Dr beep on Thu Aug 24, 2023 7:51 pm, edited 1 time in total.
Post Reply