Page 1 of 1
Listing to be fixed
Posted: Fri Jan 03, 2025 10:21 pm
by saver71
Hello to all.
I have typed a listing from an Italian magazine, but I find a problem: the joystick does not work.
Can you help me?
I attach the original listing, PRG and TXT files.
Thanks in advance and happy new year!
- ufo.rar
- (787.34 KiB) Downloaded 98 times
Re: Listing to be fixed
Posted: Fri Jan 03, 2025 11:45 pm
by Endurion
The problem seems to be that the values returned from PEEK(37137) have the lowest bit set, so they result in 370 and 366 for Q, instead of the expected 369 and 365.
I do not know enough about the VIC20 when this bit gets set. It seems to be set even when starting the game in VICE. With VICE a clear start has the expected values, but with this game not.
Re: Listing to be fixed
Posted: Sat Jan 04, 2025 1:57 am
by srowe
It's a common fault in programs, they expect other bits of the VIA registers to be in a certain state.
See
here for other examples. Does running
SYS65017 help?
Re: Listing to be fixed
Posted: Sat Jan 04, 2025 7:06 am
by Endurion
From what I can see that does the trick.
Re: Listing to be fixed
Posted: Sat Jan 04, 2025 7:12 am
by saver71
Yes! Thank you both so much!
There is one more problem: the UFO never shoots down the plane. The instructions say that once the plane is hit three times it falls to the ground, but this does not happen.
Re: Listing to be fixed
Posted: Sat Jan 04, 2025 7:39 am
by Endurion
In line 750 you need to have a Cbm-J after the red color (instead of the space). The code checks for this character.
Once you do that the player ship can be hit.
Re: Listing to be fixed
Posted: Sat Jan 04, 2025 9:10 am
by saver71
Thanks. Should I also change lines 840 and 870?
Last bug: when the plane lands it is not drawn in full. It seems like a line is missing.
Once this is fixed the program is fine.
Re: Listing to be fixed
Posted: Sat Jan 04, 2025 11:00 pm
by saver71
Okay, I solved it.
I also changed lines 840 and 870 because they drew the plane landing badly.
I then added a change so that the plane, landing, was drawn correctly.
Original line:
Code: Select all
910 printleft$(h$,h+4)"{right*9}{space*12}":return
My change:
Code: Select all
900 ifh=15thenreturn
910 printleft$(h$,h+4)"{right*9}{space*12}":return
Thank you both so much.
I will mention you once the program is released.
Re: Listing to be fixed
Posted: Mon Jan 06, 2025 11:07 pm
by saver71
I take advantage of your kindness to ask for further help. In another program, called Grand Prix, some details are not displayed as they should. In the screenshot I attach, you can see that the colon and the traffic light (top right) appear redefined. It is likely that there are some typing errors on my part since the magazine scan is often not perfectly legible. In any case, I attach the original listing and the TXT file so that you can check. Many thanks in advance.

- grand_prix_screenshot.png (4.89 KiB) Viewed 2152 times
Re: Listing to be fixed
Posted: Tue Jan 07, 2025 1:36 am
by Endurion
Found a few typos in line 250, and 360. That fixed the gameplay, but the broken chars are still there.
I noticed that the custom chars seem to be placed very close to the code/screen RAM. Stopping the program and typing on the screen modifies the start light chars already.
Edit: How can .prg be an invalid extension in this board (tsk tsk)
Edit2: I noticed that the load address is $0801. Is that correct for VIC20? I mean, LOAD xx, 8 fixes that, but still...
Re: Listing to be fixed
Posted: Tue Jan 07, 2025 3:42 am
by saver71
Hi!
I made some changes to lines 260 and 350, so they're not actually typos.
260: I changed to GR=0 because with -1 you were doing an extra lap.
360: I added PRINT"{HOME}GIRI"GR so that it displays the number of laps at the beginning of the program, whereas before it was displayed after 1 lap.
Any idea how to display : and SHIFT + Q correctly?
Re: Listing to be fixed
Posted: Tue Jan 07, 2025 10:44 am
by Endurion
One typo is in 270, the POKE at the end is supposed to be for 7698. That fixes the ; and shows a start countdown.
Looking for the other char..
Edit: Holy shit! The author is using the character data overlapping with the screen RAM. The content of the playfield is used as source for the starting light. In that part of the screen there are no $00 value bytes however, only blanks ($20) or arrow left ($1f). The $20 is resulting in the little pixels at the top.
You could of course place a @ in line 600 (like in the screenshot), which would fix the display, but now you have a @ on the track.

- gb_shot.png (6.23 KiB) Viewed 2044 times
Not sure if there's enough memory to place the char data somewhere else.
Edit #2: Munged some other place for the additional char. That is NOT the proper listing anymore, but modified line 170, 290 and 300 to use the init and use the new char. Added 172 as char definition for the light.
Re: Listing to be fixed
Posted: Tue Jan 07, 2025 1:28 pm
by saver71
Endurion wrote: ↑
One typo is in 270, the POKE at the end is supposed to be for 7698. That fixes the ; and shows a start countdown.
Perfect, thank you.
Endurion wrote: ↑
Edit #2: Munged some other place for the additional char. That is NOT the proper listing anymore, but modified line 170, 290 and 300 to use the init and use the new char. Added 172 as char definition for the light.
Great idea. I had the same idea, but you beat me to it. Since it's always better to avoid changing lines, I thought I'd add two more:
Code: Select all
161 fori=7376to7383:reada:pokei,a:next
162 data0,126,255,255,255,255,255,126
So we have the traffic light exactly as the program author had planned.
Thank you so much Endurion!