Hi.
Found this nice and small SDL2 gigatron emulator (in directory emulator - main repo is FPGA implementation here):
https://github.com/hsnaves/gigatron
This is coded by Humberto Silva Naves. Nice and clean coding style!
Works excellent!
I am trying to implement loading of a gt1 file. But got stuck. It loads segments, but then error?
If someone is willing to have a look at the code, zipped directory with altered files is attached with test files.
(I just want to have a small emulator to test new gt1 files with. I know there are more working ones out there )
( So no real sense here, just trying to improve understanding of loading of gt1 files and emulator loop etc.)
Thx, Peter
Nice, clean, little SDL2 emlator
Forum rules
Be nice. No drama.
Be nice. No drama.
Nice, clean, little SDL2 emlator
- Attachments
-
- emulator.zip
- (75.19 KiB) Downloaded 330 times
Re: Nice, clean, little SDL2 emlator
Some more updates:
pc - program counter was reset to 0. Needs to be set to loaded gt1 file. This has been changed now.
But there must be more to start executing vCPU program in memory?
Hmm.. just thinking.. maby this pc ist the one from the 'inner loop', not the vCPU one?
And maybe there es some SYS_ call one needs to issue, to start a loaded vCPU program?
-
maze4.gt1 with just 68 bytes loads correctly (but doesn't run/start). arecibo64.gt1 causes error at load:
(file size is 1601 bytes - wants to load 0x8a = 138 bytes from pos 1490 -> 1628 bytes??)
gt1 loading code is taken from Gigatron Mac.
But what if hiAdress is 0? How to differentiate between end of segments=gt1 following hiStart+loStart?
Thx, Peter
pc - program counter was reset to 0. Needs to be set to loaded gt1 file. This has been changed now.
But there must be more to start executing vCPU program in memory?
Hmm.. just thinking.. maby this pc ist the one from the 'inner loop', not the vCPU one?
And maybe there es some SYS_ call one needs to issue, to start a loaded vCPU program?
-
maze4.gt1 with just 68 bytes loads correctly (but doesn't run/start). arecibo64.gt1 causes error at load:
(file size is 1601 bytes - wants to load 0x8a = 138 bytes from pos 1490 -> 1628 bytes??)
Code: Select all
Writing 0xf0 bytes starting at address 0x5e9f
gt1Bytes Pos: 1490
Writing 0x8a bytes starting at address 0x0299
Error parsing GT1 file!
But what if hiAdress is 0? How to differentiate between end of segments=gt1 following hiStart+loStart?
Code: Select all
/* Gt1File :=
n * ( <hiAddress>
+ <loAddress>
+ <segmentSize & 255>
+ segmentSize * <dataByte> )
+ <0>
+ <hiStart>
+ <loStart>
EOF */
- Attachments
-
- emulator.zip
- (72.03 KiB) Downloaded 331 times
Re: Nice, clean, little SDL2 emlator
You can use program gt1dump (in the Utils directory) to look at GT1 files.
Also: only the first segment can have hiAddress=0. Otherwise it means that the GT1 file is ending with an exec address.
See function. GMem::load() in https://github.com/lb3361/gigatron-rom/ ... z/gt1z.cpp
Also: only the first segment can have hiAddress=0. Otherwise it means that the GT1 file is ending with an exec address.
See function. GMem::load() in https://github.com/lb3361/gigatron-rom/ ... z/gt1z.cpp
Re: Nice, clean, little SDL2 emlator
Thx!
gt1dump to the rescue
This was/is the problem:
This should be loading 256 bytes at 0x500!
This error must be also within Gigatron Mac! I just have deleted the huge xcode installation, because I thought, I never will need this again
(So maybe have to download 6GB and install 300000 file again..)
A quick fix was in gigatron.c at line 289:
Don't know, if this has other side effects.
--
Now the issue remains, that starting this loaded gt1 program does not work right now.
I think, the pc I am right now changing is NOT the vCPU pc, but the inner loop pc?
So how is such a gt1 program started, after it has been placed into ram?
This is NOT enough:
We will see..
Best, Peter
gt1dump to the rescue
This was/is the problem:
Code: Select all
Writing 39 bytes starting at address 0x0200
gt1Bytes Pos: 42
Writing 0 bytes starting at address 0x0500
This error must be also within Gigatron Mac! I just have deleted the huge xcode installation, because I thought, I never will need this again
(So maybe have to download 6GB and install 300000 file again..)
A quick fix was in gigatron.c at line 289:
Code: Select all
int segmentSize = gt1Bytes[pos] & 255;
if (segmentSize == 0) segmentSize = 256;
--
Now the issue remains, that starting this loaded gt1 program does not work right now.
I think, the pc I am right now changing is NOT the vCPU pc, but the inner loop pc?
So how is such a gt1 program started, after it has been placed into ram?
This is NOT enough:
Code: Select all
void gigatron_reset(struct gigatron_state *gs, int zero_ram, int pc)
{
//gs->pc = 0;
gs->pc = pc;
Best, Peter
- Attachments
-
- arecibo64.txt
- (8.74 KiB) Downloaded 334 times
Re: Nice, clean, little SDL2 emlator
Its done.
(Of course, the pc was the wrong pc)
Now one can simply drop a gt1 file on the emu window and it is loaded.
Before new gt1 file can be loaded, a reset is mandatory (Press PgUp until reset)!
Now also available here: https://github.com/petersieg/gigatron_emulator
Have fun, Peter
(Of course, the pc was the wrong pc)
Now one can simply drop a gt1 file on the emu window and it is loaded.
Before new gt1 file can be loaded, a reset is mandatory (Press PgUp until reset)!
Now also available here: https://github.com/petersieg/gigatron_emulator
Have fun, Peter
- Attachments
-
- emulator.zip
- (108.64 KiB) Downloaded 325 times