English Amiga Board


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

 
 
Thread Tools
Old 25 June 2024, 08:18   #1
Yulquen74
Registered User
 
Join Date: May 2013
Location: Kleppe / Norway
Posts: 269
accessing ROM/libraries from Assembler

I have an assembler book which explains well how to use some parts of

DOS and intuition, but what about other libraries and devices?


Meaning which arguments a function takes and where to put them,
what you get in return and how that data is formatted?


Theres a lot of information out there which is useful if you are using C language, including official ROM kernals, but where do you look if you
want to do it in assembler?
Yulquen74 is offline  
Old 25 June 2024, 08:36   #2
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,853
Have a look at the autodocs
http://amigadev.elowar.com/
The RKM examples have also been reworked in ASM, this could help.
http://aminet.net/search?query=Rkm+asm
kamelito is offline  
Old 25 June 2024, 08:51   #3
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,317
Quote:
Originally Posted by Yulquen74 View Post
Meaning which arguments a function takes and where to put them,
what you get in return and how that data is formatted?
That information is all included in the autodocs which come with the official NDK. You can also use tools like FD2PRAGMA (In Aminet) to convert the fd files containing the function definitions to assembler includes.
Thomas Richter is offline  
Old 25 June 2024, 09:49   #4
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,853
There is also this forum for help etc
https://developer.amigaos3.net/forum
kamelito is offline  
Old 26 June 2024, 21:26   #5
Yulquen74
Registered User
 
Join Date: May 2013
Location: Kleppe / Norway
Posts: 269
While the NDK contains lots of useful information, I still struggle with getting all the pieces.

I wish to open the timer.device to use the GetSysTime function.

The code below was written by alkis in another thread on EAB, and parts of it does what I need prior to running GetSysTime.

Can someone please explain the stuff I added as comments to the above? I just want to understand what is going on.


Code:
       incdir  /opt/amiga/gcc6/m68k-amigaos/ndk-include/
        include devices/timer.i
        include exec/execbase.i ;for ThisTask
        include dos/dosextens.i ;for pr_Result2
        include lvo/exec_lib.i
        include lvo/timer_lib.i

; Create message Port
	move.l	$4.w,a6
        move.l  ThisTask(a6),a5  ; what is this? arg for CreateMsgPort? ndk does not mention a5.
	jsr	_LVOCreateMsgPort(a6)

; Create IORequest
        move.l  d0,d7
	move.l	d0,a0
	moveq	#IOTV_SIZE,d0
	jsr	_LVOCreateIORequest(a6)
	move.l	d0,a4   ; pointer to iorequest structure?

; Open timer.device
	move.l	d0,a1
	lea	tdname(pc),a0
	moveq	#0,d0
	moveq	#0,d1
	jsr	_LVOOpenDevice(a6)

        move.l	IO_DEVICE(a4),a6  ; is this the base address for timer library? what is IO_DEVICE def, and does a4 still contain pointer to iorequest?
	lea	eval(pc),a0
        lea	eval2(pc),a3
        jsr	_LVOReadEClock(a6)
        move.l  a3,a0
        jsr	_LVOReadEClock(a6)
        move.l  d0,d6
        move.l  $4.w,a6
;Close device
        move.l a4,a1
        jsr     _LVOCloseDevice(a6)


;Free IORequest
        move.l  a4,a0
        jsr     _LVODeleteIORequest(a6)

;Free MsgPort
        move.l  d7,a0
        jsr     _LVODeleteMsgPort(a6)

        move.l  eval+4,d1
        move.l  eval2+4,d3
        move.l  eval,d0
        move.l  eval2,d2
        sub.l   d1,d3
        subx.l  d0,d2
        move.l  d6,pr_Result2(a5)
        move.l  d3,d0
        rts


eval:
        dc.l 0,0
eval2:  dc.l 0,0
tdname: TIMERNAME
Yulquen74 is offline  
Old 26 June 2024, 22:13   #6
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,066
1. a5=ThisTask, probably a leftover. Typically used to check if started from WB or CLI (task->pr_CLI != 0?), but this is not done here.
2. ptr to IORequest struct, yes.
3. timer device (not library) base, yes. Since a device is *not* opened the same way you open a library, it's done via IORequest and OpenDevice() instead (it's filled in upon success).
a/b is online now  
Old 26 June 2024, 23:12   #7
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 724
1. a5 is used to save E_freq at pr_Result2(a5) near the end
alkis is offline  
Old Yesterday, 04:01   #8
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,679
The NDK alone is not ideal; you should also get the RKRMs if you want complete tutorial-style documentation, the autodocs are more of a quick reference.
Minuous is online now  
Old Yesterday, 07:56   #9
Yulquen74
Registered User
 
Join Date: May 2013
Location: Kleppe / Norway
Posts: 269
Thanks!
Yulquen74 is offline  
Old Yesterday, 11:36   #10
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,066
Quote:
Originally Posted by alkis View Post
1. a5 is used to save E_freq at pr_Result2(a5) near the end
Thanks for correction, not sure how I missed that. Could play my too old for this card, or go for eye recalibration needed after watching a full screen of weird scrollers for too long .
a/b is online now  
Old Yesterday, 17:18   #11
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 724
Quote:
Originally Posted by a/b View Post
Thanks for correction, not sure how I missed that. Could play my too old for this card, or go for eye recalibration needed after watching a full screen of weird scrollers for too long .
Bro, if we are playing the too old card, then I needed way more time than I'll admit to understand my code.
alkis 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
I really need some help understanding libraries etc CaptainNow Coders. AMOS 3 03 August 2022 17:43
M68K and libraries rcman Coders. Asm / Hardware 3 05 February 2020 21:03
[Pre-Orders] Kipper2K Dual-Rom / Quad-Rom - hold reset to switch Kickstart rom boards solidcore MarketPlace 25 30 November 2019 20:59
Libraries Syntrax support.Other 6 31 March 2019 15:59
[Pre-Orders] Kipper2K Dual-Rom / Quad-Rom - hold reset to switch Kickstart rom boards solidcore support.Hardware 0 08 February 2019 20:14

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

Top

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