| Other BBSes » |
Atari coding BBS
|Re: Cause of Error|
Posted by: Bod/STAX
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
x set 0
rept 25 ; total number of bullets possible onscreen
x set x+sprite_size ;sprite size=size of data structure
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
; now do any other stuff to set up bullet data structure here using
; similar addressing
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]