Hey SamuraiCrow I have issue with the code you gave me....
« on: August 09, 2021, 05:01:27 AM »
ReplyQuoteModifyModify
First, I would like to thank you in advance for all the help you are giving me. So in this regard, thank you. Sorry to disturb you or further waste your time, I typed the code and I am facing issues with it. Please, bare with me.
For this code:
Load "dh1:amos/code/test/level0.dat", 16
Bank Code ROR.w 16, 5
Bank Code xor.w 16, $a55a
For Height=0 to 49
For Width=0 to 49
offset=Leek((Height*49+Width)*4+Start(16))
LEVELGETCARD$(Width, Height)=Peek$(12001+Start(16) + Offset)==> this line always spit out syntax error for some reason. No matter what I do, it spits out syntax error. The error is on peek$. For some reason, it is happy to return to value if it is typed like this:
_retVal=Peek(12001+Start(16)+Offset) instead of Peek$. Which is why the line below this sentence works great. I am not sure what to do here.
LEVEL(Width, Height)=Peek(Start(16)+9604+(49*Height+Width))
Next Width
---------------------------
For this line of code:
Reserve as work bank 16, (StringLength+12001+3) And Not 3
There is no such thing as bank 16. if I type Reserve As Work BANK 16, (StringLength+12001+3) And Not 3 as you can see, I have capitlized it. Meaning BANK is invalid and will give me syntax error. If I removed bank after Reserve As Work then it compiles.
This line of code:
Poke$(start(16)+offset),VarPtr(LevelGetCard$(Width,Height))+2
gives me type mismatch. It doesn't like VarPtr with string LevelGetCard$ and nor does it like +2 after it. How do I go about resolving this issue.
There is no such thing as Bank after Erase. It have to be Erase 16. Is this correct? Once I ran the code...it produces horribles gibberish graphics effects in the screen and resulted in full fledge crash. What advice do you have. I cannot save or load because it results in destructive jibberish in the screen followed by crashing.
Here are the codes again below:
reading
Load "dh1:amos/code/test/level0.dat", 16
Bank Code ROR.w 16, 5
Bank Code xor.w 16, $a55a
For Height=0 to 49
For Width=0 to 49
offset=Leek((Height*49+Width)*4+Start(16))
LEVELGETCARD$(Width, Height)=Peek$(12001+Start(16) + Offset)
LEVEL(Width, Height)=Peek(Start(16)+9604+(49*Height+Width))
Next Width
Next Height
Erase Bank 16
writing
StringLength=0
For Height=0 to 49
For Width=0 to 49
LevelGetCard$(width, height)=LevelGetCard$(width,height)+Chr$(0)
StringLength=StringLength+Len(LevelGetCard$(width,height))
Next width
Next Height
Reserve as work bank 16, (StringLength+12001+3) And Not 3
Offset=12001
For Height=0 to 49
for Width=0 to 49
Poke$(start(16)+offset),VarPtr(LevelGetCard$(Width,Height))+2
Loke Start(16)+(49*Height+Width)*4,offset
offset=offset+Len(LevelGetCard$(Width,Height))
Poke start(16)+(49*height+width)+9604, level(width,height)
Next Width
Next Height
Bank Code xor.w 16, $a55a
Bank Code ROL.w 16, 5
save"dh1:amos/code/test/level0.dat",16
Erase bank 16