Jump to content
IGNORED

RAM Combat


Recommended Posts

I wanted to take a stab at making a RAM based game, so I decided to try to do Combat. Right now, it is two player, and the tanks fire automatically. When you hit your opponent's tank, your tank gets larger, and your opponent's gets smaller. There are several bytes free, so let me know if you have suggestions! The tanks can only move vertically, I am not sure If I can make them move horizontally in only 128 bytes.

Archive_6.zip

Link to comment
Share on other sites

I saved a few bytes here and there, 16 bytes free total. I am going to try using the fire button to fire rather than automatic firing.

 

I have found it useful since I make no use of the stack, to use the stack pointer as an extra 'register'. In initialization, set the SP to any byte you will use frequently in your game loop, and when you want to access that number, do a tsx, and x contains the value :) I hope this helps other people doing RAM based games.

 

Wickeycolumbus nice to see you joining the RAM game fun icon_smile.gif

 

Just on a sidenote, such games would also qualify for my compo, if they match the theme =)

 

Thanks Kojote! I want to enter the contest, but I have not yet come up with a good idea for a puzzle game.

RAMCombat2.zip

Link to comment
Share on other sites

Welcome to the club Wickey!

 

BTW: For checking collision registers, you should use BIT, which will save some bytes. For the joysticks, you can load SWCHA into A and then use repeated LSRs.

 

Also think about looping instead of repeating similiar code for both players.

Link to comment
Share on other sites

I am not quite sure I understand what you are saying. How would I LSR what I am ANDing?

  lda SWCHA
 lsr
 bcc .skipRightUp
 ...
.skipRightUp
 lsr
 bcc .skipRightDown
 ...
.skipRightDown
 ...

I think you got the idea. :)

 

Works also with ASL e.g. if you are only interested into the left player joystick.

Link to comment
Share on other sites

I am not quite sure I understand what you are saying. How would I LSR what I am ANDing?

  lda SWCHA
 lsr
 bcc .skipRightUp
 ...
.skipRightUp
 lsr
 bcc .skipRightDown
 ...
.skipRightDown
 ...

I think you got the idea. :)

 

Works also with ASL e.g. if you are only interested into the left player joystick.

 

Cool, thanks. Saved 4 bytes :)

 

Horizontal movement is next! (hopefully)

RAMCombat4.zip

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

I had some time to work on this today. I decided to drop horizontal movement and use the button to fire instead. I only need to free 4 more bytes so I can include the M1/PF collision detection, let me know if you see anywhere I can free some bytes!

 

EDIT: Now I only need 2 more bytes :)

Archive_12.zip

Edited by Wickeycolumbus
Link to comment
Share on other sites

Hi Wickey,

 

Maybe something like this?

 

   ldx   #1
.loopCollisions:
  lda  CXMOP,X
  bpl  .skipIncrement
  inc  P0_End,X
  dec  P1_End,X
  lsr  AUDV0; will this work?
.skipIncrement
  dex
  bpl  .loopCollisions
; X=$FF, so no need for TSX below

 

I'm using your LSR AUDV0 in there. My question is does that work? It's great if it does.

 

I did not check if you got your ram lined up like this already. I couldn't get your code to compile, so it's untested. There was a branch out of range (easy fix), but a deeper problem with some label mismatch in the "sprite positioning" routine. I was using the non-mac assembly file here.

Edited by Omegamatrix
Link to comment
Share on other sites

Hi Wickey,

 

Maybe something like this?

 

   ldx   #1
.loopCollisions:
  lda  CXMOP,X
  bpl  .skipIncrement
  inc  P0_End,X
  dec  P1_End,X
  lsr  AUDV0; will this work?
.skipIncrement
  dex
  bpl  .loopCollisions
; X=$FF, so no need for TSX below

 

I'm using your LSR AUDV0 in there. My question is does that work? It's great if it does.

 

I did not check if you got your ram lined up like this already. I couldn't get your code to compile, so it's untested. There was a branch out of range (easy fix), but a deeper problem with some label mismatch in the "sprite positioning" routine. I was using the non-mac assembly file here.

 

That will not work because of these two lines:

 

   inc  P0_End,X
  dec  P1_End,X

 

P0_End, P1_End, P0_Y, and P1_Y are a few bytes apart (this saves 4 bytes) :( I think I may have come up with a solution though. The lsr AUDV0 works BTW, but you have to clear AUDV0 every frame.

Link to comment
Share on other sites

That will not work because of these two lines:

 

   inc  P0_End,X
  dec  P1_End,X

 

P0_End, P1_End, P0_Y, and P1_Y are a few bytes apart (this saves 4 bytes) :(

 

Oh well, I tried. :lol:

 

The lsr AUDV0 works BTW, but you have to clear AUDV0 every frame.

 

I wonder though if it it is reading INPT1, and then writing it back into AUDV0? If the value from the register is being loaded from memory, shifted, and then put it back into the memory? INPT1 is what is read when you try to read AUDV0, according to the memory map.

Edited by Omegamatrix
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...