|
Atari coding BBS
Re: Cause of Error |
Posted by: Bod/STAX
|
Aug,01.2012-01:01
|
My first thought was that for some reason the code is jumping into the OS or inadvertently I've forgot to add an offset to an instruction (I.E. move.w #0,$4 instead of move.w #0,$4(a0)) but can't find anything like this.
This is some example code from the game of how a bullet is set-up.
status equ 0
x1 equ 2
y2 equ 4 ; etc, etc...
sprite_size equ 86 ; total structure size
set_up_bullet:
x set 0
moveq #0,d0
rept 25 ; total number of bullets possible onscreen
lea bullet_struct+x,a0
move.w status(a0),d0
add.w d0,d0
add.w d0,d0
let .lookup(pc),a1
add.w d0,a1
move.l (a1),a1
jsr (a1)
x set x+sprite_size ;sprite size=size of data structure
endr
return: rts
.lookup
dc.l set_up ; dead (free structure)
dc.l return ; being born
dc.l return ; alive
dc.l return ; dying
set_up: move.w #1,status(a0) ; structure now used
move.w plr_struct+x1,x1(a0) ; set bullet x/y
move.w plr_struct+y1,y1(a0)
; now do any other stuff to set up bullet data structure here using
; similar addressing
move.l (sp)+,pop
rts
pop dc.l 0
bullet_struct ds.b sprite_size*25
This code scans all bullet data structures until it finds a free one.
The only thing from this code that I could see as a possible problem is the
move.l (sp)+,pop instruction which is to remove the address stored by the jsr (a1) from the stack so I don't fill all remaining data structures with bullets and just set up one data structure each time the fire button is pressed and thus exiting the bullet set-up routine. I do this quite a bit in my game with other routines.
Also to clarify I don't use any OS calls in the game.
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|