English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Contest

 
 
Thread Tools
Old 06 July 2019, 20:20   #1141
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by ross View Post
This is my 16-bit real-time flip routine that I've inserted in Lionheart:

Code:
init16bitfliplut
    lea fliplut,a0
    moveq   #0,d3
.k  moveq   #7,d2
    move.b  d3,d0
.l  add.b   d0,d0
    roxr.b  #1,d1
    dbf     d2,.l
    move.b  d1,(a0)+
    addq.b  #1,d3
    bne.b   .k
    rts
Code:
flip16bit
    subq.w  #1,d0
    lea     1(a0),a3
.l  move.b  (a3),d3
    move.b  fliplut(pc,d3.l),-(sp)
    move.b  (a0),d3
    move.w  (sp)+,d2
    move.b  fliplut(pc,d3.l),d2
    move.w  d2,(a1)+
    addq.l  #2,a0
    addq.l  #2,a3
    dbra    d0,.l
    rts

fliplut	ds.b	256
EDIT: of course d3=0 at flip16bit() entrance

I haven't tested your code Ross but it looks like it breaks the stack?
mcgeezer is offline  
Old 06 July 2019, 20:29   #1142
saimon69
J.M.D - Bedroom Musician
 
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,596
Quote:
Originally Posted by mcgeezer View Post
I don't think so because it looks like Contra was already released on the Amiga.

[ Show youtube player ]

Geezer
That was Super Contra - the sequel - and you WANT to forget that version


I think he means the first game of the serie, that in europe was called Gryzor
[ Show youtube player ]
saimon69 is offline  
Old 06 July 2019, 20:45   #1143
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
Quote:
Originally Posted by mcgeezer View Post
I haven't tested your code Ross but it looks like it breaks the stack?
Nah It's the 'famous' 68k family stack trick.

This instruction
move.b  fliplut(pc,d3.l),-(sp)
actually do:
subq.l #2,sp

move.b fliplut(pc,d3.l),(sp)

to keep the stack aligned to even addresses.

On pure 68k is faster than the shift instructions.
ross is offline  
Old 07 July 2019, 00:09   #1144
lmimmfn
Registered User
 
Join Date: May 2018
Location: Ireland
Posts: 691
Quote:
Originally Posted by saimon69 View Post
That was Super Contra - the sequel - and you WANT to forget that version


I think he means the first game of the serie, that in europe was called Gryzor
[ Show youtube player ]
Correct yes Gryzor, there's no decent Contra game on the Amiga and I think mcgeezer engine is perfect for the side scrolling sections but admit a bit of work for 3D and vertical sections.
A proper Contra game on the Amiga would be amazing.
lmimmfn is offline  
Old 07 July 2019, 00:31   #1145
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by lmimmfn View Post
Correct yes Gryzor, there's no decent Contra game on the Amiga and I think mcgeezer engine is perfect for the side scrolling sections but admit a bit of work for 3D and vertical sections.
A proper Contra game on the Amiga would be amazing.
The current code for Rygar contains 23,253 lines of assembler (not including tables or blank lines). I've stated on a few occasions that I don't like coding during the summer months but I want Rygar completed properly before I think about taking on any other projects, it has been a long project done in my spare time... often to the detriment of family time though and I have a young little boy who is growing up fast.

Prior to doing Rygar I was going to make game dev tutorials and the likelihood is that is what I will do because of the lesser impact on my free time, I'll still feel I'll be giving to the Amiga community and helping people which I enjoy.

I'm not 100% what the tutorials will cover yet but they'll probably be taking the game engines I have created with Bomb Jack and Rygar and teaching anyone who is interested around how they work so that they can be adapted enabling people to convert games themselves while also learning the Amiga internal...but most importantly passing on all the little game design tricks I picked up from converting these games.

So in summary... I'll not be coding any other games in the short term as I don't have the time but I'll be sticking around.

Geezer
mcgeezer is offline  
Old 07 July 2019, 01:05   #1146
lmimmfn
Registered User
 
Join Date: May 2018
Location: Ireland
Posts: 691
I understand completely mcgeezer, and likewise I hate coding in the summer.
What I mentioned was only a suggestion, absolutely not to take away from your current work on Rygar and I apologise if it came across as such.
lmimmfn is offline  
Old 07 July 2019, 10:14   #1147
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by lmimmfn View Post
I understand completely mcgeezer, and likewise I hate coding in the summer.
What I mentioned was only a suggestion, absolutely not to take away from your current work on Rygar and I apologise if it came across as such.
Absolutely no offence taken at all and it certainly didn't come across as detracting me from Rygar. In my response I'm just trying to put around some context why I wouldn't take on another big project as opposed to just saying "no - not doing it".

It's all good.
mcgeezer is offline  
Old 07 July 2019, 15:15   #1148
spud
Registered User
 
Join Date: May 2010
Location: London, UK
Posts: 268
@mcgeezer and @ross thanks for posting your sprite-flipping code, that'll be really useful for me!
spud is offline  
Old 07 July 2019, 16:22   #1149
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by spud View Post
@mcgeezer and @ross thanks for posting your sprite-flipping code, that'll be really useful for me!
You are welcome, I actually ditched my reverse byte generator in favour of Ross', but kept my longword reverse code, Ross's generator has a slight error in that d1 needs to be 0 on entry. (I'm sure he won't mind me showing it).

Here is the code now in Rygar.

Code:
; Input d1=longword
; Output d1=longword reversed
REVERSE_LONGWORD:
	movem.l	d0/d2/d3/a0,-(a7)
	lea	BYTE_REVERSE_TAB(a4),a0
	moveq	#8,d3

; Do first 3 bytes
	rept	3
	moveq	#0,d0
	move.b	d1,d0
	move.b	(a0,d0),d2
	lsr.l	d3,d1
	lsl.l	d3,d2
	endr

; Final byte but without shift
	moveq	#0,d0
	move.b	d1,d0
	move.b	(a0,d0),d2
	move.l	d2,d1
	movem.l	(a7)+,d0/d2/d3/a0
	rts
	
; Ross's code to generate a byte swap table
; Conisderably more efficient and smaller than my effort.
GENERATE_BYTE_SWAP_TABLE:
	movem.l	d0-d3/a0,-(a7)
	moveq	#0,d1
	lea     BYTE_REVERSE_TAB(a4),a0
	moveq   #0,d3
.k:	moveq   #7,d2
	move.b  d3,d0
.l:	add.b   d0,d0
	roxr.b  #1,d1
	dbf     d2,.l
	move.b  d1,(a0)+
	addq.b  #1,d3
	bne.b   .k
	movem.l	(a7)+,d0-d3/a0
	rts
mcgeezer is offline  
Old 07 July 2019, 16:54   #1150
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,039
Quote:
Originally Posted by mcgeezer View Post
You are welcome, I actually ditched my reverse byte generator in favour of Ross', but kept my longword reverse code, Ross's generator has a slight error in that d1 needs to be 0 on entry. (I'm sure he won't mind me showing it).

Here is the code now in Rygar.

Code:
; Input d1=longword
; Output d1=longword reversed
REVERSE_LONGWORD:
	movem.l	d0/d2/a0,-(a7)
	lea	BYTE_REVERSE_TAB(a4),a0
;	moveq	#8,d3

       moveq #0,d0    ; +
; Do first 3 bytes
	rept	3
;	moveq	#0,d0
	move.b	d1,d0
	move.b	(a0,d0),d2
	lsr.l	#8,d1
	lsl.l	#8,d2
	endr

; Final byte but without shift
;	moveq	#0,d0
	move.b	d1,d0
	move.b	(a0,d0),d2
	move.l	d2,d1
	movem.l	(a7)+,d0/d2/a0
	rts
	
; Ross's code to generate a byte swap table
; Conisderably more efficient and smaller than my effort.
GENERATE_BYTE_SWAP_TABLE:
	movem.l	d0-d3/a0,-(a7)
	moveq	#0,d1
	lea     BYTE_REVERSE_TAB(a4),a0
	moveq   #0,d3
.k:	moveq   #7,d2
	move.b  d3,d0
.l:	add.b   d0,d0
	roxr.b  #1,d1
	dbf     d2,.l
	move.b  d1,(a0)+
	addq.b  #1,d3
	bne.b   .k
	movem.l	(a7)+,d0-d3/a0
	rts
A few bytes shortest version. No d3 needed.
Don_Adan is offline  
Old 07 July 2019, 17:10   #1151
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by Don_Adan View Post
A few bytes shortest version. No d3 needed.
d0 needs to be 0 on the Reverse Longword sub, I know it only too well because I had an over flow when I called it and it took me a while to find the problem. I was finding that any sprite above 255 would not flip because d0 was set to >$100 and therefore the lookup wasn't working.
mcgeezer is offline  
Old 07 July 2019, 17:30   #1152
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,039
Quote:
Originally Posted by mcgeezer View Post
d0 needs to be 0 on the Reverse Longword sub, I know it only too well because I had an over flow when I called it and it took me a while to find the problem. I was finding that any sprite above 255 would not flip because d0 was set to >$100 and therefore the lookup wasn't working.
In this routine? Only byte is modified. Or Im blind.
Don_Adan is offline  
Old 07 July 2019, 17:48   #1153
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,039
You can use this code, if you want, and if it works.


Code:
; Input d1=longword
; Output d1=longword reversed
REVERSE_LONGWORD:
	movem.l	d0/a0,-(a7)
	lea	BYTE_REVERSE_TAB(a4),a0

	moveq	#0,d0
	move.b	d1,d0
	move.b	(a0,d0.w),d1
	ror.w	#8,d1
	move.b	d1,d0
	move.b	(a0,d0.w),d1
        swap    d1
	move.b	d1,d0
	move.b	(a0,d0.w),d1
	ror.w   #8,d1
	move.b	d1,d0
	move.b	(a0,d0.w),d1
	movem.l	(a7)+,d0/a0
	rts
Don_Adan is offline  
Old 07 July 2019, 18:35   #1154
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
Quote:
Originally Posted by mcgeezer View Post
You are welcome, I actually ditched my reverse byte generator in favour of Ross', but kept my longword reverse code, Ross's generator has a slight error in that d1 needs to be 0 on entry. (I'm sure he won't mind me showing it).
No, D1 can be any value, all preceding bit in .b position are destroyed.
Why do you think it should be 0?
ross is offline  
Old 07 July 2019, 18:35   #1155
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by Don_Adan View Post
In this routine? Only byte is modified. Or Im blind.
Yes because if d0 is greater than $FF then the move.b (a0,d0),d1 will over run past the look up table.

I fixed it by simply setting d0=0, I didn't try it but I guess I could have fixed it by doing move.b (a0,d0.b),d1.

Geezer
mcgeezer is offline  
Old 07 July 2019, 19:00   #1156
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by Don_Adan View Post
In this routine? Only byte is modified. Or Im blind.
Quote:
Originally Posted by ross View Post
No, D1 can be any value, all preceding bit in .b position are destroyed.
Why do you think it should be 0?
My bad - you are as always right... ... for some reason I misinterpreted the roxr.b in that it would rotate the bits back in to the msb of the byte.

The actual first run always produces 0 of the correct before it is pushed onto the LUT.

I'll get my coat.
mcgeezer is offline  
Old 07 July 2019, 19:11   #1157
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
Quote:
Originally Posted by mcgeezer View Post
Stop damaging that innocent wall
ross is offline  
Old 07 July 2019, 19:15   #1158
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 5,021
I think it's kind of "Impossible Mission" to find fault with ross
malko is offline  
Old 07 July 2019, 19:36   #1159
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
Quote:
Originally Posted by malko View Post
I think it's kind of "Impossible Mission" to find fault with ross
Only colossal failures or nothing
ross is offline  
Old 07 July 2019, 19:53   #1160
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Quote:
Originally Posted by ross View Post
Only colossal failures or nothing
Yeah we know; *cough* Shadow Warriors fixed music 4th stage / trained version
DamienD is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Entry: Rygar AGA Edition mcgeezer Coders. Entries 75 28 February 2019 20:41
On the Ball - World Cup Edition AGA djcasey request.Old Rare Games 4 25 January 2013 12:39
On The Ball League Edition AGA , Player Manager 2 StarEye Games images which need to be WHDified 11 22 January 2010 18:21
The Vague #1 AGA-RTG edition is released ! kas1e Amiga scene 12 30 October 2007 00:27
On The Ball: World Cup Edition AGA CodyJarrett request.Old Rare Games 11 27 May 2003 06:14

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:30.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.15270 seconds with 14 queries