English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 16 April 2020, 17:11   #1
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
ASM-One and XREFs

Hi,

the ASM-One manual states: "If you have used XREF or XDEF in your source, it prevents an object file from being saved [..]".


I suppose, this is the reason why I can't write an object after successfully assembling code. A little context: I am reading a book from '88 about assembly language programming for the MC68000 processor. The book provides a "shell" program for simple I/O (putc/getc, etc.). Since the book is very old and I don't have any sources, I typed the program into ASM-One. So far so good. My problem now is, that I can't write an object file. I would need that object file because I have to link it with amiga.lib. After some further reasearch, I found the statement above in the ASM-One Manual. As I understand it, an XREF is like an "external" directive in C, is that correct? Are there any other reasons why ASM-One would fail to write an object?


If anybody is interested, this is the code: https://pastebin.com/raw/KGvRbeci


Any help is appreciated!
Thanks

Last edited by desm0; 16 April 2020 at 17:37.
desm0 is offline  
Old 16 April 2020, 18:04   #2
deimos
Registered User

 
Join Date: Jul 2018
Location: France
Posts: 559
Looking at the ASM-One manual, it says that code containing XREFs or XDEFs cannot be directly executed. Is there a different compile only command that will create just an object file for you to link separately?

Edit: Bottom of page 50, WL rather than WO.

Quote:
When the program is finished and assembled, an executable
file can be created with the »WO - Write Object« command
from the Command Line or menu. (If you have used »XREF«
or »XDEF« and want to link the program together with other
programs, just save the file using »WL - Write linkfile«.
deimos is offline  
Old 16 April 2020, 18:13   #3
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by deimos View Post
Looking at the ASM-One manual, it says that code containing XREFs or XDEFs cannot be directly executed. Is there a different compile only command that will create just an object file for you to link separately?

Edit: Bottom of page 50, WL rather than WO.

Ok, WL might be exactly what I need. I will give it a try, thank you!

*edit: Just tried it. Unfortunately, same result with WL: ** No Object
desm0 is offline  
Old 16 April 2020, 18:31   #4
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,541
WL should work fine, if not either your ASM-One version is buggy or you're doing it wrong.
StingRay is offline  
Old 16 April 2020, 18:32   #5
deimos
Registered User

 
Join Date: Jul 2018
Location: France
Posts: 559
Quote:
This error is also retur-
ned if you haven't assembled the source (having edited to
much in the source after assembling it last time).
Gosh only knows what that really means, are you using a full, unrestricted version of ASM-One?
deimos is offline  
Old 16 April 2020, 18:48   #6
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by StingRay View Post
WL should work fine, if not either your ASM-One version is buggy or you're doing it wrong.

My first guess would be that I am doing something wrong. Not sure yet what exactly
desm0 is offline  
Old 16 April 2020, 18:49   #7
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by deimos View Post
Gosh only knows what that really means, are you using a full, unrestricted version of ASM-One?

I am using Asm-One v1.48 from Aminet. Should be fine. I could give another version a try though.
desm0 is offline  
Old 16 April 2020, 18:52   #8
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,541
I have tried with V1.48 and WL worked fine with your source. So I guess you're doing something wrong. Did you maybe forget to assemble before using WL?
Attached Thumbnails
Click image for larger version

Name:	010.png
Views:	66
Size:	11.0 KB
ID:	66892  
StingRay is offline  
Old 16 April 2020, 19:02   #9
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by StingRay View Post
I have tried with V1.48 and WL worked fine with your source. So I guess you're doing something wrong. Did you maybe forget to assemble before using WL?

I am an idiot. After typing WO xxx a dozen times, I forgot to assemble before WL. It works fine when done correctly Thanks!


One other question: What screen resolution are you using? My fonts are still quite ugly compared to yours. My setup: picasso96, UAEgfx, 1024x768, Winuae.
desm0 is offline  
Old 16 April 2020, 19:26   #10
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,541
Quote:
Originally Posted by desm0 View Post
After typing WO xxx a dozen times, I forgot to assemble before WL.
So my guess was correct, I should start playing the lottery.



Quote:
One other question: What screen resolution are you using? My fonts are still quite ugly compared to yours. My setup: picasso96, UAEgfx, 1024x768, Winuae.
I am using a 640x480 Picasso screen.
StingRay is offline  
Old 16 April 2020, 21:37   #11
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by StingRay View Post
So my guess was correct, I should start playing the lottery.





I am using a 640x480 Picasso screen.

Interesting. Even with the smaller resolution my fonts don't look so smooth.. But I can live with that


Unfortunately I ran into another problem, maybe someone had this before: I am linking 'amiga.lib' (downloaded it from this repo: https://github.com/kusma/amiga-dev/t...8k-amigaos/lib). The last time I did this, I was about 25ys younger, so my memory is a little hazy but I think that I linked this way:


blink file.o library path:to/amiga.lib to file.exe


This completely locks up winuae. Can't even move the mouse pointer anymore. It doesnt crash however. Do I have to link against a specific version of 'amiga.lib'? I am using blink v6.7 from Aminet.


Thanks!


PS: Your location says Berlin; Greets from Charlottenburg!

*edit

winuaelog.txt says:

42-254 [3244 224-114]: Your Amiga program just did something terribly stupid 61600043 PC=00425CD8
42-254 [3244 224-114]: 61600023 0000 0000 0000 0000 0000 0000 0000 0000
42-254 [3244 224-114]: 61600033 0000 0000 0000 0000 0000 0000 0000 0000
42-254 [3244 224-114]: 61600043 0000 0000 0000 0000 0000 0000 0000 0000
42-254 [3244 224-114]: 61600053 0000 0000 0000 0000 0000 0000 0000 0000
42-254 [3244 224-114]: 61600063 0000 0000 0000 0000 0000 0000 0000 0000
42-254 [3244 224-114]: 00425CB8 6608 0C87 FFFF FFFF 6710 2F2D FFFC 2F3C
42-254 [3244 224-114]: 00425CC8 0000 01C1 4EBA EBCE 508F 4CDF 1C84 4E5D
42-254 [3244 224-114]: 00425CD8 4E75 0000 4E55 FFF8 48E7 0018 206E 02BC
42-254 [3244 224-114]: 00425CE8 D0FC 0074 7001 2F00 7224 2F01 2F08 4EBA
42-254 [3244 224-114]: 00425CF8 E184 4FEF 000C 2840 296D 000C 0004 296D
42-254 [3244 224-114]: 00000000 2048K/1 = 2048K ID C32 Chip memory
42-254 [3244 224-114]: 00200000 8192K/1 = 8192K ID F32 Fast memory
42-254 [3244 224-114]: 00A00000 512K/0 = 512K -- F32 <none>
42-256 [3244 224-114]: 00A80000 1024K/2 = 512K ID F32 Kickstart ROM (1483A091)
42-256 [3244 224-114]: =KS ROM v3.1 (A1200) rev 40.68 (512k) [391773-01/391774-01]
42-256 [3244 224-114]: 00B80000 448K/0 = 448K -- F32 <none>
42-256 [3244 224-114]: 00BF0000 64K/0 = 64K -- CIA CIA
42-256 [3244 224-114]: 00C00000 1536K/0 = 1536K -- C32 <none>
42-256 [3244 224-114]: 00D80000 256K/0 = 256K -- C16 Gayle (low)
42-256 [3244 224-114]: 00DC0000 64K/0 = 64K -- C16 Battery backed up clock (MSM6242B)
42-256 [3244 224-114]: 00DD0000 64K/0 = 64K -- C16 Gayle (low)
42-256 [3244 224-114]: 00DE0000 64K/0 = 64K -- C16 Gayle (high)
42-256 [3244 224-114]: 00DF0000 64K/0 = 64K -- C16 Custom chipset
42-257 [3244 224-114]: 00E00000 512K/1 = 512K ID F32 Kickstart ROM (1483A091)
42-257 [3244 224-114]: =KS ROM v3.1 (A1200) rev 40.68 (512k) [391773-01/391774-01]
42-257 [3244 224-114]: 00E80000 64K/0 = 64K -- F32 Autoconfig Z2
42-257 [3244 224-114]: 00E90000 64K/1 = 64K -- F32 Filesystem autoconfig
42-257 [3244 224-114]: 00EA0000 384K/0 = 384K -- F32 <none>
42-257 [3244 224-114]: 00F00000 64K/1 = 64K -- F32 UAE Boot ROM
42-257 [3244 224-114]: 00F10000 448K/0 = 448K -- F32 <none>
42-258 [3244 224-114]: 00F80000 512K/1 = 512K ID F32 Kickstart ROM (1483A091)
42-258 [3244 224-114]: =KS ROM v3.1 (A1200) rev 40.68 (512k) [391773-01/391774-01]
42-258 [3244 224-114]: 01000000 1008M/0 = 1008M -- F32 <none>
42-258 [3244 224-114]: 40000000 32M/1 = 32M -- F32 RTG RAM
42-258 [3244 224-114]: 42000000 3024M/0 = 3024M -- F32 <none>
42-258 [3244 224-114]: FF000000 64K/0 = 64K -- F32 Autoconfig Z3
42-258 [3244 224-114]: FF010000 16320K/0 = 16320K -- F32 <none>
42-258 [3244 224-114]: CPU halted: reason = 3 PC=00425cd8
42-258 [3244 224-114]: Exception 3 (425cd8) at 425cd8 -> f80b0e!

Last edited by desm0; 16 April 2020 at 21:58.
desm0 is offline  
Old 17 April 2020, 10:20   #12
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,541
Quote:
blink file.o library path:to/amiga.lib to file.exe
This looks fine to me, linking itself shouldn't cause WinUAE to lock up. Maybe you have JIT enabled, in that case try turning off JIT.

Quote:
PS: Your location says Berlin; Greets from Charlottenburg!
Greetings from the neighbourhood (not far away from Charlottenburg).
StingRay is offline  
Old 17 April 2020, 10:46   #13
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by StingRay View Post
This looks fine to me, linking itself shouldn't cause WinUAE to lock up. Maybe you have JIT enabled, in that case try turning off JIT.



Greetings from the neighbourhood (not far away from Charlottenburg).

You were correct again I had JIT enabled the day before. Turning it off doesn't fix the problem but at least Winuae does not lock up anymore. Blink crashes. I will do some more tests with a simpler example.



Thanks!
desm0 is offline  
Old 17 April 2020, 13:08   #14
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
A general question about linking:


Does my main.s file has to contain a certain label or branch/jump in order to be linked with amiga.lib? I ripped out everything from my original .s file. Now my testcase simply contains:

Code:
move.l #0,d0
move.l #1,d1
It gets assembled, written to an object file and linked:

Code:
blink :out.o to :out.exe library :lib/amiga.lib

This however results in a guru error (8000 000B). I have tried a different amiga.lib version which results in a different error (8000 0004, which denotes an illegal instruction if I am remembering correctly). Which version of amiga.lib should I use on a WB3.1, a1200 aga setup?

Sorry if I am missing something obvious, it has been a long time
desm0 is offline  
Old 21 April 2020, 10:46   #15
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 327
Don't you need something like this at the end of your program?
Code:
moveq	#0,d0			;return 0 to the system
rts
If the above is your only code, then I'm not surprised if it shows a guru.
sparhawk is offline  
Old 23 April 2020, 22:23   #16
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by sparhawk View Post
Don't you need something like this at the end of your program?
Code:
moveq    #0,d0            ;return 0 to the system
rts
If the above is your only code, then I'm not surprised if it shows a guru.

I didn't post the return/sub instruction but it was present in the actual code.

I still have no why linking isn't possible. It is working when I don't include the XREFs and hardcode the offsets.
desm0 is offline  
Old 24 April 2020, 00:38   #17
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 49
Posts: 557
You don't have to return 0 in d0.

Amigashell interprets 0 in d0 as "all went well". Shows cmd failed with code 42 (that's from the top of my head, but something close to that) if you return with 42 in d0.

As far as I know, you can trash all registers with your program.

Well, not a7 which is stack pointer.

Last edited by alkis; 24 April 2020 at 00:46. Reason: sp clarification
alkis is offline  
Old 24 April 2020, 00:44   #18
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 49
Posts: 557
can you try linking with this one instead?
https://github.com/kusma/amiga-dev/t...dk/linker_libs

That's from the official NDK
alkis is offline  
Old 25 April 2020, 17:07   #19
desm0
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 17
Quote:
Originally Posted by alkis View Post
can you try linking with this one instead?
https://github.com/kusma/amiga-dev/t...dk/linker_libs

That's from the official NDK

I will give it a try, thanks!
desm0 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
Another ASM newbie... DanielAllsopp Coders. Asm / Hardware 28 23 August 2019 17:09
ClassicWB and ASM-One V1.48 Black.Jack support.WinUAE 5 04 January 2016 17:49
Tool to convert asm to gnu asm (gas) Asman Coders. Asm / Hardware 6 12 October 2013 12:45
Datastructures in ASM lole Coders. Asm / Hardware 8 13 October 2012 12:38
ASM Uni Course BippyM Coders. Tutorials 27 18 September 2008 10:37

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 12:19.


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