English Amiga Board


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

 
 
Thread Tools
Old 04 July 2017, 20:49   #1
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Basic/System include files

I'm just getting my feet wet in assembler programming, and this is my 'goodbye world' example:

Code:
mainloop:
     btst #6,$bfe001   ; u wot m8?! test what where now?
     bne mainloop
     rts
Although I do understand what this does (now), this would be much more readable (especially within a couple of months) if you could just write:
Code:
btst io_bit_lmb,cia_a
Surely there's a universally agreed upon way (set of include files) that allow us to write just that, but I can't seem to find it.
Can somebody please point me in the right direction?
TIA!
guy lateur is offline  
Old 04 July 2017, 21:38   #2
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
From my point of view I prefer raw version, because I write down this very few lines so many times (as many as sys 49152 on c64 ). And that was also my very first time with amiga asm so is not possible to forget this.
Of course if you have ndk then you can use names from hardware/cia.i
Code:
btst #CIAB_GAMEPORT0,_ciaa+ciapra
Asman is offline  
Old 04 July 2017, 22:20   #3
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Excellent pointer, thank you! I must have come across this file, though, having searched the ndk directory for files containing bfe001. I must have been put off by it only appearing in the comments, at first sight.

So how/where does _ciaa get its value? Is it here:
Code:
XREF _ciaa
What is XREF, and how does it work?
guy lateur is offline  
Old 05 July 2017, 09:40   #4
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
There are at least two ways to obtain _ciaa. First you can do it in your source code
Code:
_ciaa		equ	$bfe001 ; or just _ciaa = $bfe001
Second you can use xref and link object with amiga.lib. Short example for vasm and vlink, cross assembling on win. Let assume that you have following code in file lmb.s
Code:
       xref _ciaa ; _ciaa is defined somewhere else 
lmb:    btst #6,_ciaa
        bne.b lmb
        rts
First you must create object.
Code:
vasm  -Fvobj lmb.s -o lmb.o
Then you must link it with amiga.lib (there is definition of _ciaa)
Code:
vlink -bamigahunk -Bstatic -s -LC:/vbcc/targets/m68k-amigaos/lib -lamiga -o lmb lmb.o
-- edit

xdef and xref are used to share symbols/labels between objects. So if you use xref label/symbol then somewhere must be xdef label/symbol. For example
Code:
;file1.s
        xdef _ciaa
_ciaa = $bfe001
Code:
;file2.s
       xref _ciaa

lmb:   btst #6,_ciaa

Last edited by Asman; 05 July 2017 at 09:52. Reason: adding short info about xdef/xref
Asman is offline  
Old 05 July 2017, 11:51   #5
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Thank you, Asman, for taking the time to explain this, I really appreciate this.

I'm still using AsmPro on real hardware, ATM. Do you think I can do this linking to amiga lib too?

I'll be having my holidays soon, so hopefully I'll be able to check out that cross compilation route soon, as it seems a lot easier to work like that..
guy lateur is offline  
Old 05 July 2017, 12:26   #6
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Yes you can use AsmPro v1.17 and WL command or just choose from menu WriteLink. And then use linker.

I checked also Asm-One v1.49 RC2 and WL is broken.
Barfly is ok .
Asman is offline  
Old 05 July 2017, 12:53   #7
guy lateur
Registered User
 
guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
Thanks, I'll check that out!
guy lateur 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
MACRO68 & include files Shadowfire request.Apps 11 17 February 2023 23:27
Edit system-configuration files VresiBerba New to Emulation or Amiga scene 7 12 April 2017 15:38
How does one create Blitz Basic compatible anim files? earok Coders. Blitz Basic 6 06 February 2017 16:54
[bug] FS-UAE-Launcher fails with files that include special characters luttztfz support.FS-UAE 1 08 December 2013 21:45
Include files needed Galahad/FLT support.Apps 2 03 September 2007 20:11

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 10:07.

Top

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