Listing to be fixed

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
saver71
Vic 20 Hobbyist
Posts: 105
Joined: Tue Mar 17, 2009 12:16 pm
Location: Sassari, Italy
Occupation: Networker

Listing to be fixed

Post 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
Endurion
Vic 20 Newbie
Posts: 14
Joined: Tue Oct 22, 2024 12:25 pm
Website: https://www.georg-rottensteiner.de

Re: Listing to be fixed

Post 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.
C64Studio: x86/x64 - ARM --- C64Studio WIP: x86/x64 - ARM
User avatar
srowe
Vic 20 Scientist
Posts: 1471
Joined: Mon Jun 16, 2014 3:19 pm

Re: Listing to be fixed

Post 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?
Endurion
Vic 20 Newbie
Posts: 14
Joined: Tue Oct 22, 2024 12:25 pm
Website: https://www.georg-rottensteiner.de

Re: Listing to be fixed

Post by Endurion »

From what I can see that does the trick.
C64Studio: x86/x64 - ARM --- C64Studio WIP: x86/x64 - ARM
User avatar
saver71
Vic 20 Hobbyist
Posts: 105
Joined: Tue Mar 17, 2009 12:16 pm
Location: Sassari, Italy
Occupation: Networker

Re: Listing to be fixed

Post 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.
Endurion
Vic 20 Newbie
Posts: 14
Joined: Tue Oct 22, 2024 12:25 pm
Website: https://www.georg-rottensteiner.de

Re: Listing to be fixed

Post 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.
C64Studio: x86/x64 - ARM --- C64Studio WIP: x86/x64 - ARM
User avatar
saver71
Vic 20 Hobbyist
Posts: 105
Joined: Tue Mar 17, 2009 12:16 pm
Location: Sassari, Italy
Occupation: Networker

Re: Listing to be fixed

Post 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.
User avatar
saver71
Vic 20 Hobbyist
Posts: 105
Joined: Tue Mar 17, 2009 12:16 pm
Location: Sassari, Italy
Occupation: Networker

Re: Listing to be fixed

Post 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.
User avatar
saver71
Vic 20 Hobbyist
Posts: 105
Joined: Tue Mar 17, 2009 12:16 pm
Location: Sassari, Italy
Occupation: Networker

Re: Listing to be fixed

Post 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
grand_prix_screenshot.png (4.89 KiB) Viewed 2154 times
grand_prix.rar
(713.64 KiB) Downloaded 112 times
Endurion
Vic 20 Newbie
Posts: 14
Joined: Tue Oct 22, 2024 12:25 pm
Website: https://www.georg-rottensteiner.de

Re: Listing to be fixed

Post 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...
Attachments
vic20-gp.zip
(1.58 KiB) Downloaded 92 times
C64Studio: x86/x64 - ARM --- C64Studio WIP: x86/x64 - ARM
User avatar
saver71
Vic 20 Hobbyist
Posts: 105
Joined: Tue Mar 17, 2009 12:16 pm
Location: Sassari, Italy
Occupation: Networker

Re: Listing to be fixed

Post 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?
Endurion
Vic 20 Newbie
Posts: 14
Joined: Tue Oct 22, 2024 12:25 pm
Website: https://www.georg-rottensteiner.de

Re: Listing to be fixed

Post 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
gb_shot.png (6.23 KiB) Viewed 2046 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.
Attachments
vic20-gp.zip
(1.6 KiB) Downloaded 118 times
C64Studio: x86/x64 - ARM --- C64Studio WIP: x86/x64 - ARM
User avatar
saver71
Vic 20 Hobbyist
Posts: 105
Joined: Tue Mar 17, 2009 12:16 pm
Location: Sassari, Italy
Occupation: Networker

Re: Listing to be fixed

Post 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. :wink:
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!

grand prix.rar
(1.53 KiB) Downloaded 109 times
Post Reply