bwinkel67 wrote: ↑Fri Dec 15, 2023 12:58 am
After that I'll see if I can use Andrew's sprite technique to write a game. Might do it in C though. Might look at PETSCII Robots, though that requires the whole screen to scroll.
Scrolling the whole screen on an unexpended QL requires some routine in assembly - BASIC or C are too slow for this, even when compiled.
It depends upon the C compiler and how you write the code, including how you order the instructions, just as you would in assembler. If your C compiler is dumb and effectively de-optimises your code then you're in trouble.
Andrew wrote: ↑Fri Dec 15, 2023 10:59 am
On a QL with Gold Card or SuperGoldCard or Q68 or better - it is doable in BASIC or C.
Creating something like PETSCII Robots is quite possible, but i guess it requires a different approach than the one I used in Santa animation. Maybe using UDGs is the better approach, as I experimented here: https://www.qlforum.co.uk/viewtopic.php?p=43120#p43120
Given that PETSCII Robots was originally designed to use UDG characters on the PET then it makes sense and is appropriate to use them on a QL port.
Made some progress. Can you see the blinking Christmas lights?
Grinch_small.gif (551.6 KiB) Viewed 1012 times
Small GIF.
So a few more things to tinker with...maybe a shade closing, a room light going on or off inside a building. Then I'll include the zip file with the BASIC and all the sprites.
Ok, here is the final version. It has a bunch of random things happening. You have Christmas lights, you have window lights, and you have window shades. Also, the Grinch doesn't always launch all bombs. I also got rid of the weird mouth on the Grinch since it looked bad.
When running it, it will ask for which device, then whether you need to load Turbo Toolkit or if you wan to rerun it (the latter you can do once Turbo Toolkit is loaded).
Nice work, bwinkel67!
i have some remarks:
- line 150: device should end with an underscore
- add a speed variable and add line 545 Pause speed (otherwise it is too fast to run in QPC or even on GC/SGC)
- line 1390 STOP never gets executed (which is rather a good thing, it should't be inside the procedure BLINKLIGHTS)
- lines 1420, 1430, 1440 never get executed and the memory is not released (because of the loop from lines 570-590 the only way to end the program is by terminating it with CTRL-SPACE)
Andrew wrote: ↑Mon Dec 18, 2023 2:31 pm
- line 150: device should end with an underscore
Oops, typo.
Andrew wrote: ↑
- add a speed variable and add line 545 Pause speed (otherwise it is too fast to run in QPC or even on GC/SGC)
GC sholdn't be a problem as that's what I'm sort of running it on (i.e. 4x). Don't these have a slowdown mechansim?
Andrew wrote:
- line 1390 STOP never gets executed (which is rather a good thing, it should't be inside the procedure BLINKLIGHTS)
That was for debugging, in case my variable GOTO went astray.
Andrew wrote: ↑
- lines 1420, 1430, 1440 never get executed and the memory is not released (because of the loop from lines 570-590 the only way to end the program is by terminating it with CTRL-SPACE)
I kept searching for the GOTO that would go to these...but in the end, just left them in.
bwinkel67 wrote: ↑Mon Dec 18, 2023 8:34 pm
I kept searching for the GOTO that would go to these...but in the end, just left them in.
Now I noticed a problem: at line 280 you allocate memory using RESPR - Memory allocated using RESPR cannot later be released
So change line 280 to:
280 grinch=ALCHP(6400): backgrd=ALCHP(3200):bomb=ALCHP(84)
And add line
547 if code(inkey$(1))>26 then goto 1410
so any keypress will stop the animation and the program and the memory will be deallocated