View Single Post
Old 30 August 2014, 19:07   #23
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Quote:
Originally Posted by saimon69 View Post
What i wonder however is why that game run at so crappy 6FPS? OK, st port is not that better, but i wonder if is due to "processor fatigue" or bad programming... maybe the original team DID use the z80->68k tool to convert the code and is not optimized
In my opinion that was bad programming. Lets focus on example from game. Very simple one. Just set colors.

Offset $f4 from BT.PRG
Code:
	move.l	#ColorsTable,a0		;20c (ColorsTable offset $ad20)
	move.w	#2,d0			;8c
	trap	#3			;38c
					;sum 66c
handling of trap is stored in AEXEC.PRG (offset $392).
Code:
	move.l	a6,-(sp)		;12c
	move.w	#$2000,sr		;12c
	lsl.w	#2,d0			;10c
	move.l	#FncTable,a6		;20c
	add.w	d0,a6			;8c
	move.l	(a6),a6			;12c
	jsr	(a6)			;16c
	move.l (sp)+,a6			;12c
	rts				;16c
					;sum 118c

FncTable:

	dc.l ScreensClearLines
	dc.l SwapScreenPointers
	dc.l SetColors
	...
And the last we have SetColors (offset $90c in AEXEC.PRG)
Code:
	move.l a0,someLabel	;20c
	move.l #$dff180,a1	;12c
	move.w #15,d1		;8c
.loop:	move.w (a0)+,d0		;8c
	add.w d0,d0		;4c
	add.w #$111,d0		;8c
	move.w d0,(a1)+		;8c
	dbf d1,.loop		;10c taken (12c not taken - one time )
	rts			;16c
				;sum 666c = 40 + 38*15 + 40 + 16
So total is 850c for such simple routine, which should be take 180c or about 400c when we use typical approach with dbf.
Code:
	move.l	#$dff180,a1		;12c
	move.l	#ColorsTable,a0		;20c
	movem.l	(a0),d0-d7		;76c
	movem.l	d0-d7,(a1)		;72c
					;sum 180c
----------------
EDIT

I just checked Atari ST file EXEC.PRG and setColors looks like

Code:
SetColors:	move.w	#1,(someLabel).l
.wait:	tst.w	(someLabel).l
	bne.b	.wait
	move.l	#$FFFF8240,a1
	move.w	#15,d1
.loop:	move.w	(a0)+,d0
	move.w	d0,(a1)+
	dbra	d1,.loop
	rts
Faster then Amiga version - but still slow as hell.

Edit2: Just to be sure, trap and handling of trap is same as in on Amiga, mean total cycles counts will be 66 + 118 + about 500 = about 700 cycles.

Last edited by Asman; 30 August 2014 at 21:26.
Asman is offline  
 
Page generated in 0.08993 seconds with 11 queries