Jump to content

Burgers again


atari2600land

287 views

So I got back to working on my Hamburger game for the Commodore 64. I figured "I have nothing else better to do, so why not work on it some more?" So that's what I did. I got to the point where everything is almost okay. The fry went in front of the lettuce only once instead of shooting it out of the screen.

 

I hope I got rid of a nasty bug I introduced in the game somehow where simply pressing fire kills the lettuce without the burger firing a shot. I put in a bit of code that I think made the flicker disappear.

wait:
  lda $D012    ; load 255 into A
  cmp  #$FF   ; look if current rasterline equals 255
  bne wait    ; if no, goto wait
  rts         ; if yes, return from subroutine

If I call this, it acts like a "drawscreen" where it will draw the screen and stop everything until it's done. I think this is the reason why there was burger flickering and stuff. I got this code from a Commodore 64 tutorial and I thought I might as well try it. I had to speed everything back up since it slowed down the game, but I think it's not very noticeable now.

 

The power went out for a few seconds last night. Enough to shut the computer and TV down and made it so I had to reset all the clocks. My TV was a blurry psychedelic colored crap, so I had to turn it off and turn it back on, and fortunately that fixed it. I can't turn the TV off because it does that if I do. So when I go to sleep, I mute it.

 

Someone's car alarm is going off. It makes me wonder why they put them on cars if nobody cares that it's going off. I'm not jumping into action and seeing if someone is trying to break into someone's car. Because just like that it quit.

 

I had a hard time trying to go to sleep last night. I finally fell asleep at around 8:30pm or so. Woke up at 7 or so, and, after taking my pills, I felt really sleepy so I went back to sleep. Woke up at 12:30p.m. or so.

3 Comments


Recommended Comments

You can shave off a few cycles by inverting the code:

 

wait: LDA #$FF

loop: CMP $D012

BNE loop

RTS

 

Edit: Perhaps $F0 would work as well, which would let you use BCC instead of BNE and leave the routine as soon as the raster line is at $F0 or higher, instead of hitting exactly $FF which I believe you might miss every now and then.

 

Something else you might be interested in is setting up an entire raster interrupt routine, which would be useful for things like scrolling part of the screen at a given line, change background colour etc. Often you can prepare data in the main program and once you're ready for the interrupt, set a flag that the raster interrupt routine would check and perform its magic. I'm not sure how much it would help you, but it would allow bullets to move perfectly smooth, trigger collisions by setting flags which the main program then can act upon and so on. It is not trivial to get a such routine running, but there are code examples on the net (or I could provide you some example code) if you think you would benefit from this.

Edited by carlsson
Link to comment

This is what I have so far. I would like to put some sound effects in the game. I believe I'm not using channel 2 in the game. How would I "trigger" a sound to be played only once? And would it have to be stored at $3000, $3400, etc.? How far can I go up if I keep doing that? Because this is where the sounds are so far:

   org $3000 
music: 
#incbin "song6f.bin"

   org $3400 
music1: 
#incbin "burgerslevel1.bin"

 

I think I'm going to get the Kung Fu cartridge for my Commodore 64 so I can test this out. And I'll try your code tomorrow.

burger_2023_07_03.zip

Link to comment

You can place routines almost anywhere in memory, though most music programs assemble the routine at an even page so $3000 and $3400 would be good if each routine/song is 1K or less. Actually if you're using the same player routine, you could include it once and submit a parameter through the accumulator to select which sub-song to play. Then it is up to the player if it is looping or ending when the music has ended.

 

For other, simpler sound effects you would do something similar but you probably don't need a full player routine for those.

 

I'll have a look at your code later in the week (Thursday - Friday at earliest).

Link to comment
Guest
Add a comment...

×   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...