Loaging GT1 programs to RAM

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
Post Reply
gesari
Posts: 32
Joined: 11 Apr 2019, 07:15
Location: Valladolid, Spain
Contact:

Loaging GT1 programs to RAM

Post by gesari »

Hi,
I'm trying to use the ROM emulator to also load GT1 files directly to RAM and, while programs are actually loaded and run, I got lots of hangs and bad behavior, so there is something wrong.
This is my loading procedure:

- Stop the Gigatron while refreshing the video to be sure the vCPU emulator is not running.
- Copy the GT1 segments to their locations in RAM.
- Copy the starting address at RAM[0x16:0x17] (vPC)
- Reset RAM[0x1C]=0 (vSP)
- Continue the execution.

I guest some other things also need to be initialized (vLR?)... Any hint is welcome.
User avatar
marcelk
Posts: 488
Joined: 13 May 2018, 08:26

Re: Loaging GT1 programs to RAM

Post by marcelk »

Subtract 2 from the low byte of vPC, because vCPU pre-increments it by 2. Then place the same 16-bit value in vLR in order to be bug-compatible with Loader. That should work. The stack is already initialised after reset:

Code: Select all

              009a 0000  ld   $00
              009b c21c  st   [$1c]
It's simpler to replace Main with your own .gt1, and then build a ROM image with that. Instructions here.

Or just load the .gt1 file with Loader. That's what Loader does :-). Utils/sendFile.py uses that too.
gesari
Posts: 32
Joined: 11 Apr 2019, 07:15
Location: Valladolid, Spain
Contact:

Re: Loaging GT1 programs to RAM

Post by gesari »

The (vPC_low-2) was the problem. Thanks a lot!

I'll keep the stack pointer reset because it can have any value when the Gigatron stops and I'd like to get all the possible stack space for the GT1 program.
Post Reply