English Amiga Board


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

 
 
Thread Tools
Old 02 June 2024, 15:44   #141
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,850
The Vampire V4 support Emutos so I guess one could write an Atari app that hit the Amiga hardware is that also disabled?
kamelito is offline  
Old 02 June 2024, 21:46   #142
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
Yes. When IRA detects an Atari executable it will disable Amiga hardware symbols.

Theoretically I could make that an option, but who would ever seriously write Atari software, which only runs under EmuTOS on Amiga hardware?
phx is offline  
Old 02 June 2024, 22:25   #143
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,374
IRA often detects wrongly Atari executables, ... then deletes the binary file probably because noone should use Atari.
jotd is offline  
Old 02 June 2024, 23:13   #144
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
Fixed long ago. The -binary option always has priority now.
phx is offline  
Old 04 June 2024, 08:19   #145
hop
Registered User
 
hop's Avatar
 
Join Date: Apr 2019
Location: UK
Posts: 249
Quote:
Originally Posted by phx View Post
During a long weekend (starting on Thursday) I found the motivation to implement loading of Atari TOS executables in IRA.
I'll grab your changes when I get some time and check you haven't broken Amiga

I may consider a quick look into Atari support for Aira if it would be of use to anyone in the community. I know nothing about the platform though, other than 68000 + AY chip + something called TOS!

Quote:
Originally Posted by phx View Post
Formatting is really broken in EAB since some time (maybe on non-Windows systems only?)
I can only see a single "P" in the first three CODE boxes unfortunately. Browsing in Windows 10 Chrome.
hop is offline  
Old 04 June 2024, 15:28   #146
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
Quote:
Originally Posted by hop View Post
I may consider a quick look into Atari support for Aira if it would be of use to anyone in the community.
It shouldn't be too much work. Call vasm with
-Ftos
instead of
-Fhunkexe
to generate the output. Autodetection of OS functions should be even easier, as you have a definite
trap
vector for BIOS, XBIOS and GEMDOS calls. The top word on the stack is the function code.
Quote:
I can only see a single "P" in the first three CODE boxes unfortunately.
The single character was intended, because otherwise the code-block, which I used to separate paragraphs, would disappear.
Quote:
Browsing in Windows 10 Chrome.
It's a Firefox problem with Preview Post.
phx is offline  
Old 04 June 2024, 19:47   #147
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,850
@Hop, Atari support would be great.

Last edited by kamelito; 04 June 2024 at 21:30.
kamelito is offline  
Old 05 June 2024, 20:55   #148
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,850
@PHX it looks like that IRA does not support disassembly of *.library (I suppose then that its the same for devices) I tried directly into Airforce not the command line is that right? if yes why not?

Welcome to Aira Force V0.6.2

ira exited with code 0

ERROR: Invalid symbol name "LIBFUNC_$A"

ERROR: Failed to add symbol: SYMBOL LIBFUNC_$A $0003D1D0

ERROR: Failed to parse config directive on line 25: SYMBOL LIBFUNC_$A $0003D1D0

Last edited by kamelito; 07 June 2024 at 13:27.
kamelito is offline  
Old 19 June 2024, 13:45   #149
hop
Registered User
 
hop's Avatar
 
Join Date: Apr 2019
Location: UK
Posts: 249
I have found that ira can generate duplicate labels for jump tables with base address. This prevents the disassembled code from assembling. I've struggled to fix this locally and would be very grateful for any help.

Please find below a minimal repro.

Source code JumpTableBug.s:

Code:
; Minimal repro for jump table with base address label bug

	SECTION S_0,CODE

	moveq	#0,d0
	move.b	Status(PC),d0

	add.w	d0,d0 ; word offset
	move.w	CJumpTable(pc,d0.w),d0
	jmp	CJumpTable(pc,d0.w)

; C compilers often generate jump tables with entries relative to table address +2
CJumpTable: ; word sized elements
	dc.w	Red-(CJumpTable+2)
	dc.w	Green-(CJumpTable+2)
	dc.w	Blue-(CJumpTable+2)
;--------------------------------------------------------

Red:	
	move.w	#$f00,$dff180
	rts

Green:	
	move.w	#$0f0,$dff180
	rts

Blue:	
	move.w	#$00f,$dff180
	rts

Status:
	dc.b	2

	END
Assemble with vasm:

Code:
vasmm68k_mot -Fhunkexe -kick1hunks -no-opt -pic -wfail -warncomm -o JumpTableBug JumpTableBug.s
Process with ira config file JumpTableBug.cnf

Code:
MACHINE 68000
ENTRY $00000000
OFFSET $00000000
SYMBOL Status $00000034
SYMBOL CJumpTable $00000010
SYMBOL Red $00000016
SYMBOL Green $00000020
SYMBOL Blue $0000002A
CODE $00000000 - $00000010
JMPW $10 - $16 @ $12
CODE $00000016 - $00000034
END
with command line

Code:
ira -a -label=1 -radix=0 -compat=bi -config JumpTableBug
This generated JumpTableBug.asm has duplicate
CJumpTable
label, and table entries which don't reference the named symbol as expected:

Code:
; IRA V2.11 (Jun 19 2024) (c)1993-1995 Tim Ruehsen
; (c)2009-2024 Frank Wille, (c)2014-2019 Nicolas Bastien

COLOR00		EQU	$DFF180




	SECTION S_0,CODE

SECSTRT_0:
	MOVEQ	#0,D0			;00: 7000
	MOVE.B	Status(PC),D0		;02: 103a0030
	ADD.W	D0,D0			;06: d040
	MOVE.W	CJumpTable(PC,D0.W),D0	;08: 303b0006
	JMP	CJumpTable(PC,D0.W)	;0c: 4efb0002
CJumpTable:
CJumpTable:
	DC.W	(Red)-(LAB_10+2)	;10: 0004
	DC.W	(Green)-(LAB_10+2)	;12: 000e
	DC.W	(Blue)-(LAB_10+2)	;14: 0018
Red:
	MOVE.W	#$0f00,COLOR00		;16: 33fc0f0000dff180
	RTS				;1e: 4e75
Green:
	MOVE.W	#$00f0,COLOR00		;20: 33fc00f000dff180
	RTS				;28: 4e75
Blue:
	MOVE.W	#$000f,COLOR00		;2a: 33fc000f00dff180
	RTS				;32: 4e75
Status:
	DC.L	$02000000		;34
	END
I've managed to fix this, but I'm not happy with it. The fix results in two labels: the named symbol + the automatically generated label. I'm also not sure if there are any side effects. The patch is:

1. Modify
WriteLabel2
to pass
ira->p2labind
to
GetSymbol
instead of
index

2. Modify the final call to
GetSymbol
in
GetLabel
to pass
r
instead of
r2


This produces this, which isn't ideal, and I'm also concerned about side-effects:

Code:
...
	MOVE.W	CJumpTable(PC,D0.W),D0	;08: 303b0006
	JMP	CJumpTable(PC,D0.W)	;0c: 4efb0002
CJumpTable:
LAB_10:
	DC.W	(Red)-(CJumpTable+2)	;10: 0004
	DC.W	(Green)-(CJumpTable+2)	;12: 000e
	DC.W	(Blue)-(CJumpTable+2)	;14: 0018
Red:
...
Many thanks for any advice.

Last edited by hop; 19 June 2024 at 13:51. Reason: Clarity
hop is offline  
Old 19 June 2024, 16:51   #150
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
Quote:
Originally Posted by hop View Post
The fix results in two labels: the named symbol + the automatically generated label.
That would be ok.

Quote:
I'm also not sure if there are any side effects. The patch is:

1. Modify
WriteLabel2
to pass
ira->p2labind
to
GetSymbol
instead of
index
I would definitely expect side effects here. Because I did the change from
ira->p2labind
to
index
last December to fix something. It was done with this commit-log:
Code:
Bug fixes:
- Fixed TRAP_nn symbols for address range $80 to $bc.
- Instructions with PC-relative references outside of the current section
  are no longer ignored but generated with a constant displacement.
New features:
- Option -LABEL=<n> lets you select the label-style.
  0: original style with 4-digit continuous index: LAB_NNNN
  1: use hexadecimal address in label: LAB_ADDR
- Option -RADIX=<n> select the radix for displacements and equates.
  0: use hex for values >= 10, decimal for the rest (including negatives)
  10: print as decimal
  16: print as hexadecimal, except -9 to 9, which is printed decimal
Quote:
Many thanks for any advice.
I have no good advice yet. These label issues are complex and I also need some debug time, because it is not my code.
But it must have something to do with symbols. Because with automatic labels the issue doesn't occur.
phx is offline  
Old 19 June 2024, 17:50   #151
hop
Registered User
 
hop's Avatar
 
Join Date: Apr 2019
Location: UK
Posts: 249
Quote:
Originally Posted by phx View Post
That would be ok.


I would definitely expect side effects here. Because I did the change from
ira->p2labind
to
index
last December to fix something. It was done with this commit-log:
Code:
Bug fixes:
- Fixed TRAP_nn symbols for address range $80 to $bc.
- Instructions with PC-relative references outside of the current section
  are no longer ignored but generated with a constant displacement.
New features:
- Option -LABEL=<n> lets you select the label-style.
  0: original style with 4-digit continuous index: LAB_NNNN
  1: use hexadecimal address in label: LAB_ADDR
- Option -RADIX=<n> select the radix for displacements and equates.
  0: use hex for values >= 10, decimal for the rest (including negatives)
  10: print as decimal
  16: print as hexadecimal, except -9 to 9, which is printed decimal
I have no good advice yet. These label issues are complex and I also need some debug time, because it is not my code.
But it must have something to do with symbols. Because with automatic labels the issue doesn't occur.
Thanks very much. I am not familiar with this code either so it is slow going for me. It looks like that change in December may only result in the same label being written twice, but I may be wrong. It would be good to know why it was required. I'll debug too thanks.
hop is offline  
Old 24 June 2024, 20:22   #152
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,850
@PHX Archon do have many sections, Archon 2 even more. The code section are code is IRA able to disassemble code section as code by default ? I suppose that most C generated ASM contains code in code section. Doing it manually is cumbersome.
kamelito 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
ira for Windows jotd Coders. General 63 12 December 2023 10:53
New tutorial on sprites Yragael Coders. Tutorials 8 04 September 2023 21:00
Debugging messages in serial (small tutorial, mainly for cross-dev) alkis Coders. Asm / Hardware 7 22 February 2016 14:16
68020 to 68000 code convertion using Ira and PhxAss gulliver Coders. Asm / Hardware 18 12 April 2014 01:09
Looking for IRA v1.07 or newer :-) voxel request.Apps 7 30 July 2008 01:39

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:30.

Top

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