English Amiga Board


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

 
 
Thread Tools
Old 17 December 2023, 13:45   #81
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,519
Quote:
Originally Posted by hop View Post
Does this sound like a worthwhile addition?
Quite easy to add, by testing the new option in
itoasc()
. Not sure if it will help much, as there will always be displacements which are better viewed in decimal or in hex, in similar amounts. But I can add it for a test.
Myself, I used the
-a
option in the past, and looked at the hexdump in the comment.
phx is online now  
Old 17 December 2023, 16:13   #82
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
Quite easy to add, by testing the new option in
itoasc()
. Not sure if it will help much, as there will always be displacements which are better viewed in decimal or in hex, in similar amounts. But I can add it for a test.
If you mean that you can implement this yourself, then thanks very much. If I have misunderstood you then let me know!

Quote:
Originally Posted by phx View Post
Myself, I used the
-a
option in the past, and looked at the hexdump in the comment.
I do this too. Hopefully the new option will remove this layer of indirection

Regarding CMakeLists.txt. I have tested the attached CMakeLists.txt with ira_211beta.lha on Windows (Visual Studio 2022), Linux (Ubuntu 18.04, 20.04, 22.04 and Windows WSL Ubuntu 22.04), and Mac OSX Montgomery. It works just fine. Unfortunately it looks like Amiga support for CMake is lacking, but I still think this would make a worthwhile addition to the package. Usage:

Code:
Windows: Open "x64 Native Tools Command Prompt for VS 20xx" from the Start menu. Run gensln.bat. Open generated solution with Visual Studio and build.
Linux/OSX: mkdir build && cd build && cmake .. && make
Attached Files
File Type: txt CMakeLists.txt (3.0 KB, 47 views)

Last edited by hop; 18 December 2023 at 12:23.
hop is offline  
Old 18 December 2023, 12:26   #83
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Are the TRAP equates in ira off by one and missing an entry?

From constants.c

Code:
const x_adr_t x_adrs[] = {
{"ABSEXECBASE", 0x0004},
{"BUS_ERROR",   0x0008},
{"ADR_ERROR",   0x000C},
{"ILLEG_OPC",   0x0010},
{"DIVISION0",   0x0014},
{"CHK",         0x0018},
{"TRAPV",       0x001C},
{"PRIVILEG",    0x0020},
{"TRACE",       0x0024},
{"LINEA_EMU",   0x0028},
{"LINEF_EMU",   0x002C},
{"INT_NOINI",   0x003C},
{"INT_WRONG",   0x0060},
{"AUTO_INT1",   0x0064},
{"AUTO_INT2",   0x0068},
{"AUTO_INT3",   0x006C},
{"AUTO_INT4",   0x0070},
{"AUTO_INT5",   0x0074},
{"AUTO_INT6",   0x0078},
{"NMI",         0x007C},
{"TRAP_01",     0x0080},
{"TRAP_02",     0x0084},
{"TRAP_03",     0x0088},
{"TRAP_04",     0x008C},
{"TRAP_05",     0x0090},
{"TRAP_06",     0x0094},
{"TRAP_07",     0x0098},
{"TRAP_08",     0x009C},
{"TRAP_09",     0x00A0},
{"TRAP_10",     0x00A4},
{"TRAP_11",     0x00A8},
{"TRAP_12",     0x00AC},
{"TRAP_13",     0x00B0},
{"TRAP_14",     0x00B4},
{"TRAP_15",     0x00B8},
{"CIAB_PRA",    0xBFD000},
...
Shouldn't that be:

Code:
const x_adr_t x_adrs[] = {
{"ABSEXECBASE", 0x0004},
{"BUS_ERROR",   0x0008},
{"ADR_ERROR",   0x000C},
{"ILLEG_OPC",   0x0010},
{"DIVISION0",   0x0014},
{"CHK",         0x0018},
{"TRAPV",       0x001C},
{"PRIVILEG",    0x0020},
{"TRACE",       0x0024},
{"LINEA_EMU",   0x0028},
{"LINEF_EMU",   0x002C},
{"INT_NOINI",   0x003C},
{"INT_WRONG",   0x0060},
{"AUTO_INT1",   0x0064},
{"AUTO_INT2",   0x0068},
{"AUTO_INT3",   0x006C},
{"AUTO_INT4",   0x0070},
{"AUTO_INT5",   0x0074},
{"AUTO_INT6",   0x0078},
{"NMI",         0x007C},
{"TRAP_00",     0x0080},
{"TRAP_01",     0x0084},
{"TRAP_02",     0x0088},
{"TRAP_03",     0x008C},
{"TRAP_04",     0x0090},
{"TRAP_05",     0x0094},
{"TRAP_06",     0x0098},
{"TRAP_07",     0x009C},
{"TRAP_08",     0x00A0},
{"TRAP_09",     0x00A4},
{"TRAP_10",     0x00A8},
{"TRAP_11",     0x00AC},
{"TRAP_12",     0x00B0},
{"TRAP_13",     0x00B4},
{"TRAP_14",     0x00B8},
{"TRAP_15",     0x00BC},
{"CIAB_PRA",    0xBFD000},
...
hop is offline  
Old 19 December 2023, 18:20   #84
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,519
Quote:
Originally Posted by hop View Post
If you mean that you can implement this yourself, then thanks very much
Tried that today. New option is called
-radix=n
, with n = 10 (default, decimal), 16 for hex and 0 for hex-positive, decimal-negative.
Unfortunately I realised that
itoasc()
is not called for
move
immediate addressing modes, which always call
itohex()
with a fixed number of digits (2, 4, 8). Maybe this makes sense, as, unlike displacements, you don't know whether you are dealing with a signed value.

Quote:
Regarding CMakeLists.txt. I have tested the attached CMakeLists.txt with ira_211beta.lha on Windows (Visual Studio 2022), Linux (Ubuntu 18.04, 20.04, 22.04 and Windows WSL Ubuntu 22.04), and Mac OSX Montgomery. It works just fine.
How does it work with Linux and OSX, when I only see a section for MSVC in it? (Being a Cmake noob.)

Quote:
Unfortunately it looks like Amiga support for CMake is lacking
That's already one of the major problems I have here. Why should I use something which is less portable and adds more dependencies (cmake is not standard in a development environment)?

I really like the minimalistic approach in all my portable projects: ANSI-C90 or C99 (maximum), together with a standard Makefile. Nothing is more portable!

Quote:
Originally Posted by hop View Post
Are the TRAP equates in ira off by one and missing an entry?
Indeed. Thanks. Fixed!

Current snapshot is here (verified): http://sun.hasenbraten.de/~frank/TEST/ira_211beta.lha
phx is online now  
Old 19 December 2023, 18:43   #85
zenox98
Joy Division
 
zenox98's Avatar
 
Join Date: Nov 2006
Location: East Yorkshire
Age: 60
Posts: 241
@phx
Any reason for not including a ready-built exe in your releases?
zenox98 is offline  
Old 19 December 2023, 18:51   #86
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
Tried that today. New option is called
-radix=n
, with n = 10 (default, decimal), 16 for hex and 0 for hex-positive, decimal-negative.
Unfortunately I realised that
itoasc()
is not called for
move
immediate addressing modes, which always call
itohex()
with a fixed number of digits (2, 4, 8). Maybe this makes sense, as, unlike displacements, you don't know whether you are dealing with a signed value.
Great. Are these changes supposed to be in the linked package? The contents look no different to the last one you shared.

EDIT: Sorry - my fault. The package has the changes.

Quote:
Originally Posted by phx View Post
How does it work with Linux and OSX, when I only see a section for MSVC in it? (Being a Cmake noob.)
That block you are referring to is only required to disable a specific MSVC warning. Linux and Mac build fine with the default compiler options. If we wanted to add other platform/compiler specific options, this is where they would go. (btw Professional CMake is a very good introductory read if you are ever inclined).

Quote:
Originally Posted by phx View Post
That's already one of the major problems I have here. Why should I use something which is less portable and adds more dependencies (cmake is not standard in a development environment)?

I really like the minimalistic approach in all my portable projects: ANSI-C90 or C99 (maximum), together with a standard Makefile. Nothing is more portable!
Haha. This is an interesting conundrum. CMake is quite ubiquitous in modern build environments, but unfortunately Amiga is not as well supported as Windows, Linux and Mac. I would perhaps argue that many users will be cross-compiling for Amiga and developing on a PC/Mac and will benefit from CMake support. I certainly benefitted from it when I wanted to prototype a new feature. The CMakeLists.txt will should not have to be modified unless a file is added or removed.

Quote:
Originally Posted by phx View Post
Current snapshot is here (verified): http://sun.hasenbraten.de/~frank/TEST/ira_211beta.lha
Can you please confirm that this does actually contain some new changes? It still seems to have the var = var warnings present and I can't see any additional changes since the last package.

EDIT: Sorry - my fault. The package has the changes.

Thanks very much for your support.

Last edited by hop; 19 December 2023 at 19:33.
hop is offline  
Old 19 December 2023, 19:45   #87
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
Tried that today. New option is called
-radix=n
, with n = 10 (default, decimal), 16 for hex and 0 for hex-positive, decimal-negative.
Unfortunately I realised that
itoasc()
is not called for
move
immediate addressing modes, which always call
itohex()
with a fixed number of digits (2, 4, 8). Maybe this makes sense, as, unlike displacements, you don't know whether you are dealing with a signed value.
Many thanks for this.

I've tested it and it seems to be almost working. I think there may be a problem with null-terminated strings in TEXT regions - the trailing zero ends up becoming a single $ with radix=16. Attached a repro with output in included txt file.

-radix=10
Code:
LAB_1105:
	;01105
	;DC.B	$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$45,$4e,$54,$45,$52
	;DC.B	$20,$57,$4f,$52,$4c,$44,$20,$43,$4f,$44,$45,$00
	DC.B	"           ENTER WORLD CODE",0
	DC.B	$ff			;01121
-radix=16
Code:
LAB_1105:
	;01105
	;DC.B	$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$45,$4e,$54,$45,$52
	;DC.B	$20,$57,$4f,$52,$4c,$44,$20,$43,$4f,$44,$45,$00
	DC.B	"           ENTER WORLD CODE",$
	DC.B	$ff			;01121
Attached Files
File Type: 7z Game.7z (54.5 KB, 44 views)
hop is offline  
Old 20 December 2023, 12:13   #88
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,519
Quote:
Originally Posted by zenox98 View Post
Any reason for not including a ready-built exe in your releases?
I cannot compile for any possible target platform in the world. So I only include the portable source and let the user compile!
(Especially, I don't have a development environment for Windows, if you are refering to that.)

Quote:
Originally Posted by hop View Post
I think there may be a problem with null-terminated strings in TEXT regions - the trailing zero ends up becoming a single $ with radix=16.
Indeed. There is a stupid assumption for the length of decimal numbers in the text output. Fixed.

I updated yesterday's download link with it.
phx is online now  
Old 20 December 2023, 12:29   #89
zenox98
Joy Division
 
zenox98's Avatar
 
Join Date: Nov 2006
Location: East Yorkshire
Age: 60
Posts: 241
Quote:
Originally Posted by phx View Post
I cannot compile for any possible target platform in the world. So I only include the portable source and let the user compile!
(Especially, I don't have a development environment for Windows, if you are refering to that.)
Thanks for reply.


I will investigate how to compile it for windows.
zenox98 is offline  
Old 20 December 2023, 12:39   #90
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by zenox98 View Post
I will investigate how to compile it for windows.
It's really easy. Open the x64 Native Tools Command Prompt for Visual Studio 2022 from the start menu. Change directory to the ira folder and type:

Code:
nmake -f Makefile.win32
Alternatively, use the CMakeLists.txt and gensln.bat file in the archive I shared earlier up this thread to generate native VS solution and project files and allow debug or release build config to be built easily.

Visual Studio Community edition is free and works fine.
hop is offline  
Old 20 December 2023, 12:41   #91
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
Indeed. There is a stupid assumption for the length of decimal numbers in the text output. Fixed.

I updated yesterday's download link with it.
Many thanks. This will be very convenient. I'll test ASAP.
hop is offline  
Old 22 December 2023, 11:15   #92
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
There is a stupid assumption for the length of decimal numbers in the text output. Fixed.

I updated yesterday's download link with it.
Thank you very much for the changes. I see what you've done - I thought that the hex/decimal numbering would just apply to offsets (in addressing modes), but it applies more globally, which makes sense.

The results are good, but I think one more tiny tweak could improve the readability of the output:

Code:
if (val > -10 && val < 10)
    always format as decimal
This would eliminate all the awkward looking $ on small numbers (including zeros) that coders would almost never write. For example

From:
Code:
MOVE.L	A3,$4(A4)
MOVEQ	#$0,d0
BSET	#$6,$E00(A0)
MOVEQ	#$FFFFFFFF,D0
DC.B	"graphics.library",$0
DS.L	$1
To:
Code:
MOVE.L	A3,4(A4)
MOVEQ	#0,d0
BSET	#6,$E00(A0)
MOVEQ	#-1,D0
DC.B	"graphics.library",0
DS.L	1

Last edited by hop; 22 December 2023 at 11:17. Reason: Further examples
hop is offline  
Old 23 December 2023, 00:28   #93
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,519
Quote:
Originally Posted by hop View Post
Code:
if (val > -10 && val < 10)
    always format as decimal
No problem. Please try the update: http://sun.hasenbraten.de/~frank/TEST/ira_211beta.lha
phx is online now  
Old 23 December 2023, 15:47   #94
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
That is great thanks. Should EQU values be covered by the RADIX setting too?
hop is offline  
Old 25 December 2023, 00:06   #95
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,519
Quote:
Originally Posted by hop View Post
Should EQU values be covered by the RADIX setting too?
I don't understand. Can you give an example?
phx is online now  
Old 25 December 2023, 10:58   #96
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
I don't understand. Can you give an example?
No problem. Sorry for not being clearer. Please find a minimal repro attached.

test_equ_radix: 80fc1800

Code:
ira -a -compat=bi -binary -preproc test_equ_radix
Generates

Code:
; IRA V2.11 (Dec 23 2023) (c)1993-1995 Tim Ruehsen
; (c)2009-2023 Frank Wille, (c)2014-2019 Nicolas Bastien




	ORG	$0

SECSTRT_0:
	DIVU	#$1800,D0		;0: 80fc1800
	END
Add equate to config file:

Code:
MACHINE 68000
ENTRY $00000000
OFFSET $00000000
CODE $00000000 - $00000004

; The following line results in decimal value in equate:
; TRACK_SIZE_BYTES	EQU	6144
; even if -RADIX=16 is used
EQU TRACK_SIZE_BYTES $2.W

END
Results in this output, even if -RADIX=16 option is used:

Code:
; IRA V2.11 (Dec 23 2023) (c)1993-1995 Tim Ruehsen
; (c)2009-2023 Frank Wille, (c)2014-2019 Nicolas Bastien

; Custom equates (from config file)
TRACK_SIZE_BYTES	EQU	6144




	ORG	$0

SECSTRT_0:
	DIVU	#TRACK_SIZE_BYTES,D0	;0: 80fc1800
	END
Note that the EQU value is always displayed in decimal. Perhaps the -RADIX=16 should format this value as decimal:

Code:
ira -a -compat=bi -radix=16 -config test_equ_radix
Manually modified sample output:

Code:
; IRA V2.11 (Dec 23 2023) (c)1993-1995 Tim Ruehsen
; (c)2009-2023 Frank Wille, (c)2014-2019 Nicolas Bastien

; Custom equates (from config file)
TRACK_SIZE_BYTES	EQU	$1800




	ORG	$0

SECSTRT_0:
	DIVU	#TRACK_SIZE_BYTES,D0	;0: 80fc1800
	END
Attached Files
File Type: 7z test_equ_radix.7z (537 Bytes, 40 views)
hop is offline  
Old 26 December 2023, 01:27   #97
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,519
Quote:
Originally Posted by hop View Post
Code:
; Custom equates (from config file)
TRACK_SIZE_BYTES    EQU    6144
I see. Can be done (try the update at the usual URL).

But there are two types of EQUs. The config-file definitions and the internal ones (interrupt vectors, custom chips, etc.). The latter will always be printed in hexadecimal, which is still unchanged. Should they follow the selected radix as well?
phx is online now  
Old 26 December 2023, 12:33   #98
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
I see. Can be done (try the update at the usual URL).
Thanks very much - that's looking much better. I was reluctant to use EQU before, because it often obfuscated the code with decimal!

Code:
diff --git a/Game.asm b/Game.asm
index ba9f8dc..b891fbb 100644
--- a/Game.asm
+++ b/Game.asm
@@ -1,4 +1,4 @@
-; IRA V2.11 (Dec 23 2023) (c)1993-1995 Tim Ruehsen
+; IRA V2.11 (Dec 26 2023) (c)1993-1995 Tim Ruehsen
 ; (c)2009-2023 Frank Wille, (c)2014-2019 Nicolas Bastien

        INCLUDE "hardware/custom.i"
@@ -60,8 +60,8 @@ SPR7PTH               EQU     $DFF13C
 COLOR00                EQU     $DFF180

 ; Custom equates (from config file)
-ciaicr EQU     3328
-TRACK_SIZE_BYTES       EQU     6144
+ciaicr EQU     $D00
+TRACK_SIZE_BYTES       EQU     $1800
Quote:
Originally Posted by phx View Post
But there are two types of EQUs. The config-file definitions and the internal ones (interrupt vectors, custom chips, etc.). The latter will always be printed in hexadecimal, which is still unchanged. Should they follow the selected radix as well?
This is tricky - it's a global option, but it doesn't make any sense for hardware addresses to be printed in decimal, so I think we should avoid the temptation to convert these to decimal.
hop is offline  
Old 26 December 2023, 23:56   #99
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,519
Quote:
Originally Posted by hop View Post
This is tricky - it's a global option, but it doesn't make any sense for hardware addresses to be printed in decimal, so I think we should avoid the temptation to convert these to decimal.
I think you are right. Already changed it, but reverted that change now. There is an updated source at http://sun.hasenbraten.de/~frank/TEST/ira_211beta.lha

Now I also finished my work on PC-relative references, which point outside of the originating section. Instructions are generated with constant displacements instead of
DC.W
.
phx is online now  
Old 27 December 2023, 18:23   #100
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 210
Quote:
Originally Posted by phx View Post
I think you are right. Already changed it, but reverted that change now. There is an updated source at http://sun.hasenbraten.de/~frank/TEST/ira_211beta.lha

Now I also finished my work on PC-relative references, which point outside of the originating section. Instructions are generated with constant displacements instead of
DC.W
.
There seems to be a problem with the latest changes.

Code:
diff --git a/Game.asm b/Game.asm
index b891fbb..ac62fea 100644
--- a/Game.asm
+++ b/Game.asm
@@ -1,4 +1,4 @@
-; IRA V2.11 (Dec 26 2023) (c)1993-1995 Tim Ruehsen
+; IRA V2.11 (Dec 27 2023) (c)1993-1995 Tim Ruehsen
 ; (c)2009-2023 Frank Wille, (c)2014-2019 Nicolas Bastien

        INCLUDE "hardware/custom.i"
@@ -60,8 +60,8 @@ SPR7PTH               EQU     $DFF13C
 COLOR00                EQU     $DFF180

 ; Custom equates (from config file)
-ciaicr EQU     $D00
-TRACK_SIZE_BYTES       EQU     $1800
+ciaicr EQU     $89698DC8
+TRACK_SIZE_BYTES       EQU     $89698DC8
I think I have already shared these files, but let me know if you need a repro.
hop 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 15:32.

Top

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