[TI ASM] Asm Help

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Guest

Post by Guest »

Or if you want to save 2 bytes:

Code: Select all

ld hl,MarioSprite
ld (TempSprite + 2),hl
....
....
...

TempSprite:
ld ix, 0
call ionlargeSprite
call ionfastcopy
[\code]
Spengo
Calc Master
Posts: 1116
Joined: Sat 15 Jan, 2005 3:56 am
Location: ooga booga land
Contact:

Post by Spengo »

I have given up on that ezasm stuff. From now on, I will just use z80. My game looks pretty good right now, but I have a problem.

Code: Select all

--mirage header and other stuff--
main_loop:
	halt
	halt				
  	bcall(_grbufclr)		
  	ld   a,(rowd)		
  	ld   l,a			
  	ld   a,60			
  	cp   l			
  	jp   z,nextd			
	ld   a,(x)
  	ld   b,8			
  	ld   a,(rowd)		
  	ld   l,a			
  	ld   a,(pixd)			
  	ld   ix,enemy			
  	call isprite
  	ld   a,(rowd)
	inc a
	inc a
  	ld   (rowd),a
  	ld   a,(rowe)
  	ld   l,a
  	ld   a,60
  	cp   l
  	jp   z,nexte
  	ld   b,8
  	ld   a,(rowe)
  	ld   l,a
  	ld   a,(pixe)
  	ld   ix,enemy2
  	call isprite
  	ld   a,(rowe)
	inc a
  	ld   (rowe),a
  	ld   a,(rowf)
  	ld   l,a
  	ld   a,60
  	cp   l
  	jp   z,nextf
  	ld   b,8
  	ld   a,(rowf)
  	ld   l,a
  	ld   a,(pixf)
  	ld   ix,enemy
--repeat, repeat and then the other stuff--
[\code]
this be a portion of my main loop. I don't know why, but there are wierd jumps in game speed. o_O It runs normally, and then there will be a strange jump and it kicks up to a higher speed and then back to normal again. It didn't do this without the 'halt's in there, but without them, the game runs much too fast. Can anyone either tell me how to stop the jumps or another way to slow down the game?
bananas... o.o
Spengo
Calc Master
Posts: 1116
Joined: Sat 15 Jan, 2005 3:56 am
Location: ooga booga land
Contact:

Post by Spengo »

Sorry for the double post, but do more people respond if I make a new topic? Asm Help seemed like a good place to put this.
bananas... o.o
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

This piece of code doesn't help much in understanding the problem. All I see is that you use a long piece of copypaste spaghetti code instead of a loop. Why? You should also clean it up a bit, like turning

Code: Select all

     ld   a,(rowd)
     ld   l,a
     ld   a,60
     cp   l
     jp   z,nextd
into

Code: Select all

     ld   a,(rowd)       
     cp   60
     jp   z,nextd
etc.

But most importantly you should draw the sprites in a loop. We can't even see the labels you are jumping to, so what do you expect?
Spengo
Calc Master
Posts: 1116
Joined: Sat 15 Jan, 2005 3:56 am
Location: ooga booga land
Contact:

Post by Spengo »

They go to a thing that looks like this which places a new enemy at the top and makes the game more random.

Code: Select all

nextb:
  	bcall(_grbufclr)
  	ld   a,0
  	ld   (rowb),a
  	ld   b,96
  	call irandom
 	ld   (pixb),a
  	jp   main_loop
There is also the move controls(duh) in the main loop. But this is not my problem. the problem is in the Halt things at the beginning or the main loop. Whenever I put 3 or more, it crashes the calc. It also makes the game jumpy for some reason. Please help me figure out what is wrong or find another way to slow the game down.
bananas... o.o
Post Reply