Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
Phibrizzo
Posts: 73 Joined: 09 Nov 2022, 22:46
Post
by Phibrizzo » 03 Apr 2023, 13:27
Hello
Its me again...
This is my new game named LoGo. It is clone game based on similar game from ZX Spectrum.
Goal: try arrange a displayed pattern. Put tiles on big arena. If new tiles is colse another then first tile change color.
Usage:
- Coursors - move soursor
- A button - put tile
- B button - undo move (you can undo all moves)
- START - twice - restart game
Game:
http://blabla.ppa.pl/ftp/usr/Phibrizzo/ ... o/LoGo.gt1
Sources:
http://blabla.ppa.pl/ftp/usr/Phibrizzo/ ... Go_src.lha
Enjoy
I have one question: i used SYS_SetMemory function for fill areas.
But a have noise on the screen. Source is like that:
Code: Select all
; Fill area
_ORG #$30DC
LDWI #$0B03 ; SYS_SetMemory
STW #$22
LD @L ; color
ST #$25 ; copy value
_LAB #1
LD @l ; lenght filled area
ST #$24 ; copy count (c)
LDW @d
STW #$26 ; destination address on screen (c)
SYS #54
INC @D ; destination address H byte
LD @h ; height filled area
SUBI #1
ST @h
BNE #1
RET
The function is called many times fron the another loops.
Do I do something incorrectly?
at67
Site Admin
Posts: 651 Joined: 14 May 2018, 08:29
Post
by at67 » 03 Apr 2023, 22:58
Phibrizzo wrote: ↑ 03 Apr 2023, 13:27
But a have noise on the screen. Source is like that:
What kind of noise do you have?
1) Screen flicker?
2) Sync timing issues?
3) Random pixels?
Can you provide a screenshot or video?
Phibrizzo
Posts: 73 Joined: 09 Nov 2022, 22:46
Post
by Phibrizzo » 04 Apr 2023, 14:50
Propably point 1 and 2.
On game is too fast then a wrote little test program. What i mean and how it work is on the short video (sorry no youtube).
The program draws filled squares in random places.
On the video in first seconds is how it work on emulator, rest on real hardware.
http://blabla.ppa.pl/ftp/usr/Phibrizzo/ ... s_test.mp4
at67
Site Admin
Posts: 651 Joined: 14 May 2018, 08:29
Post
by at67 » 04 Apr 2023, 17:27
That looks to me like sync issues, meaning you've broken the firmware's video timing. I'd check all your SYS calls, make sure all the args/regs are correct and that you are calling the correct cycle count.
e.g. in your assembler do you do something like this for the cycle operand to the SYS opcode?
Code: Select all
if((operand & 0x0001) || operand < 28 || operand > 284)
{
fprintf(stderr, "Assembler::sysHelper() : '%s:%d' : SYS operand '%d' must be an even constant in [28, 284]\n", filename.c_str(), lineNumber, operand);
return uint8_t(operand);
}
return uint8_t((270 - operand / 2) & 0x00FF);
Full explanation is here:
https://github.com/kervinck/gigatron-ro ... ctions.txt
lb3361
Posts: 368 Joined: 17 Feb 2021, 23:07
Post
by lb3361 » 04 Apr 2023, 19:40
I believe at67 is right because I can see this in the disassembled code:
Code: Select all
30e7 5e 24 ST sysArgs+0 |^$|
30e9 21 87 LDW vLAC+3 |!.|
30eb 2b 26 STW sysArgs+2 |+&|
30ed b4 36 SYS -80 |46|
30ef 93 88 INC vT2 |..|
30f1 1a 8b LD vT3+1 |..|
30f3 e6 01 SUBI 1 |f.|
The second byte of the SYS opcode is definitely wrong. It should be a negative signed byte (i.e. 0x80-0xff).
That can certainly desynchronize the video.
My recipe is:
Code: Select all
def SYS(op):
if op & 1 != 0 or op < 0 or op >= 284:
error(f"illegal argument {op} for SYS opcode")
op = min(0, 14 - op // 2) & 0xff
emit(0xb4, op)
Phibrizzo
Posts: 73 Joined: 09 Nov 2022, 22:46
Post
by Phibrizzo » 05 Apr 2023, 12:43
Yes, Your'e right both.
I read this documentatoin few times, but it was for me a like black magic (maybe barrier laungage). Now is all clear.
I corrected it on game. This same link.
And fixed my compiler.
Thanks a lot