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.
Also made a single file .prg
Unpublished games from Italian VIC users, circa 1982-83?
Moderator: Moderators
- Mike
- Herr VC
- Posts: 4888
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Unpublished games from Italian VIC users, circa 1982-83?
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.
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:
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:
This includes an intermediary assignment to T, should those values be needed elsewhere (not just in PRINT).
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
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
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
Re: Unpublished games from Italian VIC users, circa 1982-83?
Thank you very much! I found the errors I made. BTW, there are some harmless mistypes in your version.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.
I still have a doubt about line 520. The last char inside mid$ first parameter seems a "9" (and not a "@") to me.
Re: Unpublished games from Italian VIC users, circa 1982-83?
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.