Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

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]

Topic Posted by  Date 
Cause of Error Bod/STAX Jul,31.2012-15:39
  Re: Cause of Error sqward Jul,31.2012-16:58
  Re: Cause of Error ggn Jul,31.2012-21:19
    Re: Cause of Error Bod/STAX Aug,01.2012-01:01
      Re: Cause of Error Bod/STAX Aug,01.2012-12:45
        Re: Cause of Error ggn Aug,02.2012-10:06
          Re: Cause of Error Bod/STAX Aug,02.2012-21:53
            Re: Cause of Error Defjam Aug,03.2012-15:31
              Re: Cause of Error spiny Aug,05.2012-11:57


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

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.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson