at67 gtmakerom not work with ROMv3

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice.
Post Reply
wtlprnft
Posts: 6
Joined: 28 Nov 2018, 20:21

at67 gtmakerom not work with ROMv3

Post by wtlprnft » 21 Dec 2018, 13:47

Hi there,
I did a little prime numbers prog and built it in a ROMv1 successfully and works fine using the tools gttorom and gtmakerom. using the ROMv3.rom as the base rom for those tools also run without errors but the resulting rom file is not running in emu nor on real hardware.

Anyone any idea?
thanks peter
Last edited by wtlprnft on 22 Dec 2018, 21:35, edited 1 time in total.

at67
Posts: 63
Joined: 14 May 2018, 08:29

Re: at67 gtmakerom not work with ROMv3

Post by at67 » 21 Dec 2018, 16:10

Those tools were written before v3 or even v2 existed, they do a lot of nasty things to insert code into an existing v1 ROM whilst keeping it happy enough to allow execution. There is no way they can work for v2 or v3, if you check out the source code...it's nasty.

I'll have a look at it in the next week or so after the holidays and maybe speak to Marcel about coming up with a cleaner more compatible future system, (may not be possible).

wtlprnft
Posts: 6
Joined: 28 Nov 2018, 20:21

Re: at67 gtmakerom not work with ROMv3

Post by wtlprnft » 21 Dec 2018, 21:59

thanks, at67! till then I build my extensions into a V1ROM, looking forward to hear from you

User avatar
marcelk
Posts: 178
Joined: 13 May 2018, 08:26

Re: at67 gtmakerom not work with ROMv3

Post by marcelk » 22 Dec 2018, 10:16

The Gigatron boot sequence sets up the system variables and starts the video/sound/vCPU loop.
vCPU will then load and run 'Reset'. 'Reset' completes the initialization, such as setting up the video table,
clearing the screen and writing the reset message (the top two lines of text).
Then 'Reset' loads, from ROM, whatever is included as 'Main' and executes that.
The default 'Main' application is a GCL program that handles the user menu. But we can replace it with something else.

If you have a GT1 file, the ROM v3 builder (ROMv3.py) can gobble it up and place it where the ROM loader (SYS_Exec_88) can see it. For this you just add it to the command line as an argument. For example, our GT1 file might be Apps/Sprite.gt1.

So what we do below is substitute Sprite.gt1 as the new 'Main'!

Building a ROM file, without any of the other applications included, but just ours, goes as follows (I'm using bash):

[Edit 2018-12-27: removed some preparation steps.
With a new commit to the repo, these aren't required any longer.]

Code: Select all

bash> python Core/ROMv3.py Main=Apps/Sprite.gt1 Core/Reset_v3.gcl
runVcpu at 014a cycles 100 info line0
runVcpu at 019a cycles 130 info line1-39 typeC
runVcpu at 01a1 cycles 134 info line1-39 typeABD
runVcpu at 01db cycles 126 info line40
runVcpu at 02ec cycles 148 info line41-520 typeBCD
SYS limits low 100 high 148

Including file Apps/TicTac_v1.gtb label TicTacToe ROM 916b
 Lines 170
 Variables count 0 bytes 0 end 0030
 :

Labeling file Apps/Sprite.gt1 label Main ROM 9ec6

Include file Apps/Sprite.gt1 label Sprite ROM 9ec6
 Variables count 0 bytes 0 end 0030
 :

Compile file Core/Reset_v3.gcl label Reset ROM a112
 Segment at 0200 size 250 used 199 unused  51
 Segment at 0300 size 250 used 216 unused  34
 Variables count 12 bytes 24 end 0048
 : Char Pos PrintChar [79] PrintStartupMessage [132] SetupAudio [27]
 : SetupChannel [59] SetupVideo [64] Text [51] fontData i p q

Create file ROMv3.asm
Create file ROMv3.rom
OK used 41728 free 23808 size 131072
Rename it, to avoid confusing it with the real ROMv3:

Code: Select all

bash> mv ROMv3.rom gigatron.rom
If you burn this in an EPROM, the Gigatron should do this after power on:
https://youtu.be/5gOGm5qRqOs?t=3
(The screen text will be different, as it will have the Reset-message instead of the Loader-message in it.)

It's not a completely clean ROM image, because some data used by now-absent applications is still in there. That's why it says "used 41728" (words). That's mostly the built-in Parrot and Jupiter images that are still there. But it works.

P.S.1: The regular Main is a GCL program that handles the user menu. If you want to add your program to the menu, you'll have to modify that.

P.S.2: When I do something like this, I normally also modify the version number that 'Reset' prints: from 'ROM v3' into something like 'ROM v3x'. And I put all steps in the Makefile for convenience.

P.S.3: Sprite.gt1 is in the repo, but you can rebuild it from Sprite.gcl if you want. The offline GCL compiler can be invoked directly, or by make:

Code: Select all

bash> make Apps/Sprite.gt1
Core/compilegcl.py "Apps/Sprite.gcl" `dirname ./"Apps/Sprite.gt1"`
Compiling file Apps/Sprite.gcl
 Segment at 0200 size 250 used 208 unused  42
 Segment at 0300 size 250 used  74 unused 176
 Variables count 7 bytes 14 end 003e
 : FaceLeft [19] FaceRight [18] Image [150] o p u v
Apply patch 5b86
Execute at 5b86
Create file ./Apps/Sprite.gt1
OK size 300

wtlprnft
Posts: 6
Joined: 28 Nov 2018, 20:21

Re: at67 gtmakerom not work with ROMv3

Post by wtlprnft » 23 Dec 2018, 20:42

marcelk, many thanks for your detailed instructions! I Did my rom within my prime numbers proggy :D

Post Reply