02 February 2016, 16:24 | #1 |
Registered User
Join Date: Feb 2016
Location: Homeless
Posts: 61
|
Calling OS Functions?
How are OS Functions called on Amiga? I've found a bunch of webpages that are describing the OS functions, but not how to actually invoke them. I would guess that there might be some function table in ROM or RAM, to be called via JSR opcodes? Or is that stuff done via TRAP opcodes or whatever?
For example, what exactly is happening inside of this source code, http://eab.abime.net/showpost.php?p=936606&postcount=2 ? Can somebody point me to a good place for downloading those include .i files? And/or some text document that describes the OS functions from low-level view (so one wouldn't need to deal with .i files at all)? What are those CALLDOS, CALLEXEC, CALLINT macros/pseudo instructions doing? Are they defined in one of the .i files? And, that will probably sound stupid: Where is that OS located at all? I am currently only owning an Amiga with 4 game discs, but without workbench disk. So I am not even sure if I'm already having an amiga OS or not. I know that my amiga is having that 256Kbyte kernel ROM, but I've no idea if that ROM is containing a fully-fledged OS, or if it's merely containing some basic low-level stuff (eg. like IBM/PC BIOSes, which are merely allowing to access discs by track/side/sector numbers, but not by filenames). Ie. is the workbench disk some required part of the OS, or is it just containing a collection of optional utilities (like a text editor and a file manager)? |
02 February 2016, 17:41 | #2 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
Library calls are offsets (negative numbers) on the library base. Library base of the library call you'd like to make must be at register a6. Library base is a pointer that gets returned from Exec's OpenLibrary call. How do you get ExecBase though? You get it from a fixed position $0000 0004.
Most of the core libraries live in ROM. So, in your line of thought, the workbench disks contain mainly "user-land" programs. There are a few exceptions of libraries that would probably should be considered core-OS, like asl.library or math*.library(ies). The CALLINT, CALLDOS are macros and defined in the OS's *.i files (inlucde files for assembly). For example, CALLINT does the following Code:
CALLINT MACRO move.l _IntuitionBase,a6 jsr _LVO\1(a6) ENDM Function is a negative offset on a6, for example OpenScreen is Code:
_LVOOpenScreen EQU -198 |
02 February 2016, 18:19 | #3 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
System call include: LVOs.zip Os documentation: http://amigadev.elowar.com/ The NDK contains all include files for assembly language and C. System call include is just the plain LVOs for assembly language. NDK is for everything up to AOS 3.9, and the documentation for everything up to AOS 3.5. The NDK also contains documentation, but the website is more extensive. In ROM and on-disk. The ROM part is the kernel, some graphics routines, dos, the gui, and some other things (this is basically a complete, but basic OS). The disk part contains extra libraries, utilities, command line commands, etc, etc. |
|
02 February 2016, 20:53 | #4 |
Registered User
Join Date: Feb 2016
Location: Homeless
Posts: 61
|
Many thanks for the replies and links!
CALLINT looks like provoking jokes about intuitive function naming (I was assuming that it would stand for "integer call"). Anyways, I've now got the overall idea how to call OS functions. For the documentation of the actual functions, the elowar page seems to consist of hundreds of small text snippets (which is a bit hard to read/navigate). The "Autodocs" folder in the NDK package looks a bit more inviting to me. It's quite a bunch of stuff though : - / maybe I'll better focus on trying to emulate the hardware, and ignore the OS part for now. |
02 February 2016, 22:40 | #5 |
Registered User
Join Date: Apr 2015
Location: Kandel, Germany
Posts: 17
|
You do not need those LVO-Includes: the LVOs can be linked in from amiga.lib or small.lib.
This is what a HelloWorld.asm looks like which must be linked against amiga.lib/small.lib Code:
XDEF _main XDEF _SysBase XDEF _DOSBase XREF _AbsExecBase XREF _LVOOpenLibrary XREF _LVOCloseLibrary XREF _LVOOutput XREF _LVOWrite include "dos/dos.i" _main: ; store SysBase movea.l _AbsExecBase,a6 move.l a6,_SysBase ; open dos.library lea DOSName,a1 moveq #LIBRARY_MINIMUM,d0 movea.l _SysBase,a6 jsr _LVOOpenLibrary(a6) move.l d0,_DOSBase beq .fail ; fetch stdout to d1 movea.l _DOSBase,a6 jsr _LVOOutput(a6) move.l d0,d1 ; say hello move.l #Hello,d2 moveq #HelloLen,d3 movea.l _DOSBase,a6 jsr _LVOWrite(a6) ; close dos.library movea.l _DOSBase,a1 movea.l _SysBase,a6 jsr _LVOCloseLibrary(a6) clr.l _DOSBase .ok: moveq #RETURN_OK,d0 rts .fail: moveq #RETURN_FAIL,d0 rts cnop 0,4 _SysBase: dc.l 0 _DOSBase: dc.l 0 Hello: dc.b 'Hello World!',10 HelloLen equ *-Hello DOSName: DOSNAME end |
03 February 2016, 09:27 | #6 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calling assembler functions from C | Nosferax | Coders. C/C++ | 41 | 25 March 2020 12:55 |
Replacing OS4 functions for OS3.x | arti | Coders. C/C++ | 25 | 17 December 2018 16:03 |
functions benchmark | wawa | Coders. System | 2 | 15 April 2013 18:55 |
How do the non-i/o functions work? | mikro | project.WHDLoad | 3 | 03 November 2011 14:33 |
CD32 blue button functions differently | oldpx | support.WinUAE | 6 | 09 August 2004 13:43 |
|
|