English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 27 May 2024, 21:33   #61
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,368
Quote:
Originally Posted by field3d View Post
@Don_Adan If I hdr that change I receive the error ‘error 23: undefined symbol <Dx>’ Apparently Dx is not recognized.
This comment suggests that you need to practice a lot in asm.

Don't take it the wrong way. D0 - D7 are data registers. Dx would be a variable if declared.

Last edited by jotd; 27 May 2024 at 23:06.
jotd is online now  
Old 27 May 2024, 22:15   #62
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
Quote:
Originally Posted by jotd View Post
Barfly has in-line opt directives (start of file). It is the historical assembler used by Bert and many others on the amiga. All slaves have a "IFD BARFLY" section with "BOPT" directives, one of them trying to add (pc) to addresses.

But that's bad practice. As you end up doing things like move.l d0,addr and hope that the optimizer adds (pc)...
Ah! Thanks for explaining that. That explains why the Pool of Radiance slave got away with this given that it has this Barfly legacy.
copse is offline  
Old 28 May 2024, 00:41   #63
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 50
I see but for example in this case the affected parts are this ones:

HTML Code:
_CD32_Common_Held						;Used for Pause button
		move.l		joy1(pc),d1
		lea		_held_button(pc),a1
		btst.l		d2,d1
		beq		.NotPressed
		btst.l		d2,(a1)
		bne		.clrkey
		bset.l		d2,(a1)
		move.b		d3,d0
		bra		.exit
The lines are the ones with error only when compile and I removed the .l and can compile but that part how you changed these lines form that code?

HTML Code:
btst.l		d2,(a1)
and

HTML Code:
bset.l		d2,(a1)
field3d is offline  
Old 28 May 2024, 00:57   #64
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 50
I made this test could figure to work?

HTML Code:
_CD32_Common_Held                     
        move.l      joy1(pc),d1
        lea         _held_button(pc),a1
        btst.l      d2,d1
        beq         .NotPressed
        
        move.l      (a1),d0           
        btst.l      d2,d0             
        bne         .clrkey
        
        move.l      (a1),d0           
        bset.l      d2,d0             
        move.l      d0,(a1)           
        
        move.b      d3,d0
        bra         .exit
field3d is offline  
Old 28 May 2024, 01:31   #65
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
Quote:
Originally Posted by field3d View Post
The lines are the ones with error only when compile and I removed the .l and can compile but that part how you changed these lines form that code?

HTML Code:
btst.l		d2,(a1)
and

HTML Code:
bset.l		d2,(a1)
I think the size is implicit and it is okay to remove it. My understanding is that the source operand is modulo 8 for byte accesses and modulo 32 for longword accesses. The size of the access is determined by the destination operand, only Dn (data register direct) destinations are longword values for purpose of testing the modulo 32 bit number. All other destination operand types are 8 bit references and modulo 8 presumably (manual states this for bset but not for btst).

If that is correct then "move.l (a1), d0; btst d2, d0" tests the longword at a1 and "btst d2, (a1)" tests the byte at a1. Hopefully someone will double check my logic.

Last edited by copse; 28 May 2024 at 01:38.
copse is offline  
Old 28 May 2024, 01:48   #66
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
Since I no longer trust anything I have not seen run myself, I ran it through an m68k simulator (https://asm-editor.specy.app/):

Code:
lea $2000, a1
move.l #$FF000000, (a1)+
move.l #1, d1
lea $2000, a1
btst d1, (a1)               ; N flag zero after this line (all flags zero)
move.l (a1), d0
btst d1, d0                 ; N and Z flags set after this line (others zero)
The simulator rejected btst.l and would not compile it. This if correct shows that btst/bset "dn, (an)" is a byte access and btst/bset "dn, dm" is a longword access.
copse is offline  
Old 28 May 2024, 06:11   #67
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 50
Oh excellent idea the simulator. I think is fine now.
field3d is offline  
Old 28 May 2024, 11:18   #68
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,039
Something like this:

Code:
_CD32_Common_Held						;Used for Pause button
		move.l		joy1(pc),d1
		lea		_held_button(pc),a1
    move.l (a1),d0
		btst.l		d2,d1
		beq		.NotPressed
 ;		btst.l		d2,(a1)
    btst d2,d0
		bne		.clrkey
 ;		bset.l		d2,(a1)
 bset d2,d0
 move.l d0,(a1)
		move.b		d3,d0
		bra		.exit
.NotPressed
;	bclr		d2,(a1)
 bclr d2,d0
 move.l d0,(a1)
.clrkey		moveq		#0,d0
.exit		rts
You must remember that all bits related instructions works for 8 bits in memory, and for 32 bits in register.
Then bclr is also affected, not only btst, bset or bchg.
Of course this is next bug in original code.
Don_Adan is offline  
Old 28 May 2024, 15:30   #69
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,039
Quote:
Originally Posted by jotd View Post
This comment suggests that you need to practice a lot in asm.

Don't take it the wrong way. D0 - D7 are data registers. Dx would be a variable if declared.
Right, but seems that he can learn fast enough.
Also new look at old code can be useful.
I dont expected that many bugs exists in some WHDload slaves.
For me joypad code and second fire code cant works correctly.
If same code was reused in other slaves, then more slaves can be affected.
Don_Adan is offline  
Old 28 May 2024, 15:46   #70
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,368
newest slaves with joypad code works properly since 2020 at least. He just picked an old one.
jotd is online now  
Old 28 May 2024, 16:03   #71
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,039
For this game, no new slave, since 2011 year
I dont have joypad for tests.
But I remember some threads on EAB about strange working joypad buttons.
Don_Adan 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
PPC crashes when WHDload is started Hedeon project.WHDLoad 5 15 May 2012 14:32
n00b guide to getting whdload started please? DoneYone project.ClassicWB 18 06 August 2009 14:40
Need a little help getting started... stevecole New to Emulation or Amiga scene 20 18 April 2009 21:30
Getting started!! thequeenfan New to Emulation or Amiga scene 14 18 December 2003 23:46
Getting started again The Shadow New to Emulation or Amiga scene 1 07 April 2002 22:42

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 08:01.

Top

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