Loaging GT1 programs to RAM

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

Loaging GT1 programs to RAM

Post by gesari » 22 May 2019, 08:02

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: 268
Joined: 13 May 2018, 08:26

Re: Loaging GT1 programs to RAM

Post by marcelk » 22 May 2019, 09:22

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: 31
Joined: 11 Apr 2019, 07:15
Location: Valladolid, Spain
Contact:

Re: Loaging GT1 programs to RAM

Post by gesari » 22 May 2019, 20:40

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