Gigatron Clone Ideas
Forum rules
Be nice. No drama.
Be nice. No drama.
Re: Gigatron Clone Ideas
Sounds consistent with the two known failures we've been talking about.
Re: Gigatron Clone Ideas
I was close, but it is the last jump in the image trampoline page. E.g.
The issue here is the trampoline returns at the end of the page. That causes the program counter to increment the page when it dispatches the trampoline instruction. It hits the page above causing the pixel displacement. It starts to do Jupiter and things work until it trampolines to a jump or branch instruction in the page above. That's when it gets stuck.
This is an artifact of the design, not necessarily a bug. The fix would be to back off the picture trampoline code so that return jump doesn't happen at the end of the page. There is room to do this since that code is padded with a NOP or two to fit at the end. The assembler could check for this condition and raise an error. It only appears in the image trampoline pages prior to ROM5.
Code: Select all
0dfd 1406 ld $06,y
0dfe fe00 bra ac
0dff e0bc jmp y,$bc
This is an artifact of the design, not necessarily a bug. The fix would be to back off the picture trampoline code so that return jump doesn't happen at the end of the page. There is room to do this since that code is padded with a NOP or two to fit at the end. The assembler could check for this condition and raise an error. It only appears in the image trampoline pages prior to ROM5.
Re: Gigatron Clone Ideas
Code: Select all
--- a/Core/ROMv3.asm.py
+++ b/Core/ROMv3.asm.py
@@ -2241,11 +2241,11 @@ def trampoline3a():
ld([sysArgs+6]) #22
adda(1) #23
bra(AC) #24
- bra(250) #25 trampoline3b
+ bra(256-7) #25 trampoline3b
def trampoline3b():
"""Read 3 bytes from ROM page (continue)"""
- while pc()&255 < 256-6:
+ while pc()&255 < 256-7:
nop()
st([sysArgs+1]) #27
C('Trampoline for page $%02x00 reading (continue)' % (pc()>>8))
@@ -2254,6 +2254,8 @@ def trampoline3b():
ld(hi('txReturn'), Y) #30
bra(AC) #31
jmp(Y,'txReturn') #32
+ nop()
+ C('Avoid end of page return at $%04x' % (pc()-1))
Code: Select all
--- a/ROMv3.lst
+++ b/ROMv3.lst
@@ -3078,7 +3078,7 @@ packedParrot: 0d00 0000 ld $00 ;Pixels for packedParrot line 0
0d7c 012a ld [$2a]
0d7d 8001 adda $01
0d7e fe00 bra ac
- 0d7f fcfa bra $0dfa
+ 0d7f fcf9 bra $0df9
0d80 0000 ld $00 ;Pixels for packedParrot line 1
0d81 0000 ld $00
0d82 0000 ld $00
@@ -3173,13 +3173,13 @@ packedParrot: 0d00 0000 ld $00 ;Pixels for packedParrot line 0
0df6 0005 ld $05
0df7 0000 ld $00
0df8 0200 nop
- 0df9 0200 nop
- 0dfa c225 st [$25] ;Trampoline for page $0d00 reading (continue)
- 0dfb 012a ld [$2a]
- 0dfc 8002 adda $02
- 0dfd 1406 ld $06,y
- 0dfe fe00 bra ac
- 0dff e0bc jmp y,$bc
+ 0df9 c225 st [$25] ;Trampoline for page $0d00 reading (continue)
+ 0dfa 012a ld [$2a]
+ 0dfb 8002 adda $02
+ 0dfc 1406 ld $06,y
+ 0dfd fe00 bra ac
+ 0dfe e0bc jmp y,$bc
+ 0dff 0200 nop ;Avoid end of page return at $0dff
0e00 0000 ld $00 ;Pixels for packedParrot line 2
0e01 0000 ld $00
0e02 0000 ld $00
Re: Gigatron Clone Ideas
OK, I've had a better look at this, single stepping native code on ROMv4 in both SW emulation and on real Gigatron hardware and I can't see an issue at all with the original code or the original circuit timing.
If I had to guess, there seems to be a race condition between the JMP instruction and incrementing PC into the next page for both the original FPGA design and yours.
Right now without more information, I don't think your change to the trampoline is a valid one; of course I am only speculating here based on the experiments I have just performed, so please feel free to correct me.
Spitballing: It seems that your HW is overwriting the currently fetched trampoline pixel with the first LD instruction in the next page and for the last scanline of Jupiter the X register is being corrupted from the first instruction of SYS_RacerUpdateVideoX_40.
Can you single step the native code on your HW? That might be an interesting experiment.
If I had to guess, there seems to be a race condition between the JMP instruction and incrementing PC into the next page for both the original FPGA design and yours.
Right now without more information, I don't think your change to the trampoline is a valid one; of course I am only speculating here based on the experiments I have just performed, so please feel free to correct me.
Spitballing: It seems that your HW is overwriting the currently fetched trampoline pixel with the first LD instruction in the next page and for the last scanline of Jupiter the X register is being corrupted from the first instruction of SYS_RacerUpdateVideoX_40.
Can you single step the native code on your HW? That might be an interesting experiment.
Re: Gigatron Clone Ideas
Thanks for taking a look @at67. I was actually thinking how you could "fix" this issue by connecting ~PL to the CEP input of the upper two counters. I took a closer look at the Gigatron schematic and this is exactly what Marcel has done {insert facepalm}. Yes, I totally missed that when I transcribed the schematic. I guess the FPGA design did the same thing
For reference, this is what was happening.
I'll update my design to fix this when I get to the Rev.3 board.
For reference, this is what was happening.
Code: Select all
ROM IR
---- ----
0DFF bra ac ;AC=XX
;—clk— PC low=XX, PC high increments (U4 TC is high)
0EXX jmp y ;same code but jumped to wrong page
;—clk— PC low=$BC, PC high=Y ($06)
06BC ld d ;instruction loaded from wrong page
;—clk—
06BD ld y ;back to SYS_Read3_40
Re: Gigatron Clone Ideas
Schweet! Fixed the FPGA code by adding if(cu_pl_n) to the PC increment. Tested on ROMv3/v4/vX0. (Love those DIP switches!)
Re: Gigatron Clone Ideas
Good job!
P.S. I have been switching between three ROM's with the press of one button since 2018
https://forum.gigatron.io/viewtopic.php?p=172#p172