Demo: Assembly Scrolling Layer0 with Layer 1 HUD.

jdifelici

New Member
Sep 24, 2019
21
22
3
FB posts seem to get lost quickly so posting here. Here is animated gif demo of some layer0 scrolling (32x32 map size) underneath a layer1 (64x32 map size) HUD. This is a demo now, but I want to work it into an eventual game like lunar lander, but once you land you can mine for ore and such. No custom fonts at the moment, but it gives an assembly example for two layers and smooth scrolling -- NOTE: the animated GIF isn't the smoothest,m but it looks better on the emulator. ALso, attached is a ZIP file with the PRG file and the assembly source code. I'm not sure how to do one of those GIT Pulls for the X16 demo area, so if someone is feeling the need, go ahead and put it on the X16 demo repo if they want it.

SimpleLayerScrollDemo.gif
 

Attachments

jdifelici

New Member
Sep 24, 2019
21
22
3
Okay, now I have a lunar lander sprite and it's flame which toggles on and off when the keyboard is pressed.

ScrollLayerDemo3.gif

However, it takes a full keypress to toggle the flame on then off (using $FFE4 to get key when it's not 0). I'd like to have it so that the flame stays on while a key is held down and turns off when released. Any thoughts on that? Also, it seems I have to JMP to the original $0314 interrupt routine after I'm done with my interrupt stuff for FFE4 to work. However, this also slows things down as you can see by the terrain drawing getting pushed into the middle of the screen instead of staying off-screen -- it always starts and stays offscreen until a key is pressed.
Thanks for any help.
 

Wertyloo

Member
Sep 15, 2019
62
4
8
do you people, already develop the hw-tricks-needed part of your software to a hw,that is not a final version yet?
or they finalized while the 2nd youtubevid was out?
 

jdifelici

New Member
Sep 24, 2019
21
22
3
I don't really understand your question, but the moon lander game is all from scratch and I'm just following the documentation released for each revision released. I've had to change the code as I've been developing it a couple of times because of register changes and such. But the changes have been minor compared to learning how to create/code this up.
 
  • Like
Reactions: MonstersGoBoom
May 22, 2019
409
211
43
I'd suggest asking Mike ( @mjallison ) if the keyboard kernel code is going to report "key up" events from the keyboard.

The way PS/2 works is that keys report an event when they are pressed, when they repeat, and when they are released. So you would handle this in your program by listening for the PS/2 key UP event for the key you are tracking.

Or use the joystick code (which is currently mapped to some keys in the emulator) and don't use the keyboard for press and hold types of events.
 

ZeroByte

New Member
Sep 28, 2019
3
1
3
Okay, now I have a lunar lander sprite and it's flame which toggles on and off when the keyboard is pressed.

View attachment 294

However, it takes a full keypress to toggle the flame on then off (using $FFE4 to get key when it's not 0). I'd like to have it so that the flame stays on while a key is held down and turns off when released. Any thoughts on that? Also, it seems I have to JMP to the original $0314 interrupt routine after I'm done with my interrupt stuff for FFE4 to work. However, this also slows things down as you can see by the terrain drawing getting pushed into the middle of the screen instead of staying off-screen -- it always starts and stays offscreen until a key is pressed.
Thanks for any help.
 

ZeroByte

New Member
Sep 28, 2019
3
1
3
However, it takes a full keypress to toggle the flame on then off (using $FFE4 to get key when it's not 0). I'd like to have it so that the flame stays on while a key is held down and turns off when released. Any thoughts on that? Also, it seems I have to JMP to the original $0314 interrupt routine after I'm done with my interrupt stuff for FFE4 to work. However, this also slows things down as you can see by the terrain drawing getting pushed into the middle of the screen instead of staying off-screen -- it always starts and stays offscreen until a key is pressed.
Thanks for any help.
I suggest that you look into the new X16 Kernal routine GETJOY. The emulator supports the keyboard as a joystick, and in r32 it now reports as its own "NES" style device ID.

This API should treat the keyboard as a joystick, returning 0 for button pressed, 1 for button not pressed.

I haven't used it myself, so I can't offer anything more specifically helpful off the top of my head. When I wrote a game for C64 in assembly, I read the key matrix directly and banked out the Kernal, so I don't personally have any experience with Kernal calls.

Using the GETJOY api will probably speed things up enough to get rid of your scrolling problem.
 
  • Like
Reactions: BruceMcF

jdifelici

New Member
Sep 24, 2019
21
22
3
Okay, here is a new update. I have now put in actual game loop logic that can switch game "Stages" in and out with stage Init()/Update()/Render() methods for each stage. The game still doesn't do much, but it now has a title screen (Title-stage), and the lander scrolling demo (Lander-stage). The game also uses the GETJOY method and the "Up-Arrow" key is used to turn on the Lander's thrust flame.

Next items on the list are to: 1) create a "lander-init" stage that will pre-create the terrain instead of just having it random. The terrain data will be stored in $A000 banks. 2) Make the lander process left/right arrow keys to move over the terrain (instead of just auto-scroll right), and then make lander descend with main thrust effects to slow down.

Here is the current GIF (and code at https://github.com/yignoth/x16-pminer.git).gif_LanderDemo-v3.gif
 
  • Like
Reactions: Mike and tomseago

jdifelici

New Member
Sep 24, 2019
21
22
3
Okay, here is an update. Some tile modifications, a new planet miner/lander image and left and right vector thrusters control movement Left and Right. There is a main vertical thrust, but don't have gravity in yet. Executable and code found at: https://github.com/yignoth/x16-pminer.git
The GIF image has frames removed and rescaled (for size reasons) so the lander doesn't really move that fast in the game.

gif_LanderDemo-v4.gif
 
  • Like
Reactions: Schlowski
May 22, 2019
409
211
43
Okay, here is an update. Some tile modifications, a new planet miner/lander image and left and right vector thrusters control movement Left and Right. There is a main vertical thrust, but don't have gravity in yet. Executable and code found at: https://github.com/yignoth/x16-pminer.git
The GIF image has frames removed and rescaled (for size reasons) so the lander doesn't really move that fast in the game.
Keep this up, and you’ll have the first legit, complete video game for the Commander.