Unpublished games from Italian VIC users, circa 1982-83?

Discussion, Reviews & High-scores

Moderator: Moderators

User avatar
vicist
Vic 20 Afficionado
Posts: 352
Joined: Tue Oct 09, 2012 5:26 am
Location: Sheffield, UK

Re: Unpublished games from Italian VIC users, circa 1982-83?

Post by vicist »

I typed pic-man in from scratch and it seems to work ok.
I did have to make a change to line 230 where the FOR - NEXT loop includes a HEX number (1E20) and swapped it for the decimal 7712.
I also changed line 20140 so that the main program would load from disk (,8).
If you find anything that doesn't work properly, let me know.

picman.zip
(3.78 KiB) Downloaded 64 times
Also made a single file .prg
pic-man.prg.zip
(2.47 KiB) Downloaded 63 times
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Unpublished games from Italian VIC users, circa 1982-83?

Post by srowe »

vicist wrote: Sun Feb 16, 2020 6:19 am I did have to make a change to line 230 where the FOR - NEXT loop includes a HEX number (1E20) and swapped it for the decimal 7712.
"1E20" doesn't necessarily mean a hex number, in BASIC is represents 10 to the power 20.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Unpublished games from Italian VIC users, circa 1982-83?

Post by Mike »

BASIC V2 doesn't recognize hex values, as srowe already wrote. The literal constant 1E20 is parsed as one times ten to the power of 20.

Code: Select all

230 FORDD=PEEK(7593)/10TO1E20STEP.01*2^LV
240 GOSUB650:FORM=0TO3:POKEFNS(M),V%(M):POKEFNC(M),1:GOSUB320
250 POKEFNS(M),40:POKEFNC(M),0:NEXTM,DD:GOTO230
In the context of the FOR loop in charge, 1E20 is so large, that the FOR loop will actually never terminate. Not just because it would take ages to do so. DD ultimately becomes so large that the step size ".01*2^LV" is normalized to 0 before the addition takes place. Then DD stays put.

It's anyway bad practice to use non-integer step sizes in FOR loops. This easily leads to lots of accumulated rounding error in the loop variable, up to the point that it misses the supposed end-of-range. Try this:

Code: Select all

1 FOR T=1 TO 10 STEP 0.1:PRINT T:NEXT
RUN
Note the obvious rounding errors. And 10 is not printed.

This issue isn't specific to CBM floats. You will encounter similar problems with *any* other floating point system, even when they're based on BCD floats.

You'll get the correct result like thus:

Code: Select all

1 FOR X=10 TO 100:T=X/10:PRINT T:NEXT
RUN
This includes an intermediary assignment to T, should those values be needed elsewhere (not just in PRINT).
musuruan
Vic 20 Newbie
Posts: 6
Joined: Sun Feb 09, 2020 5:22 am

Re: Unpublished games from Italian VIC users, circa 1982-83?

Post by musuruan »

vicist wrote: Sun Feb 16, 2020 6:19 am I typed pic-man in from scratch and it seems to work ok.
I did have to make a change to line 230 where the FOR - NEXT loop includes a HEX number (1E20) and swapped it for the decimal 7712.
I also changed line 20140 so that the main program would load from disk (,8).
If you find anything that doesn't work properly, let me know.
Thank you very much! I found the errors I made. BTW, there are some harmless mistypes in your version.

I still have a doubt about line 520. The last char inside mid$ first parameter seems a "9" (and not a "@") to me.
User avatar
vicist
Vic 20 Afficionado
Posts: 352
Joined: Tue Oct 09, 2012 5:26 am
Location: Sheffield, UK

Re: Unpublished games from Italian VIC users, circa 1982-83?

Post by vicist »

musuruan wrote: Sun Feb 16, 2020 2:06 pm The last char inside mid$ first parameter seems a "9" (and not a "@") to me.
I think you are right. This is the value of the last tone when you get caught by a ghost and it does sound better.

I don't know what happened to line 230.
When I first run the program it wouldn't stop producing a new line for the maze. I changed it to 7712 from 1e20 to see what would happen and it seemed to work. It must have been a fluke because somehow, line 230 has reverted back to '1e20' and it works fine. :roll:
Post Reply