Created
July 31, 2019 08:30
-
-
Save devlead/362fe2dc048bd6fe18c5e1041a6018bd to your computer and use it in GitHub Desktop.
Amiga HelloWorld
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExecBase = 4 ;location of the exec.lib | |
OpenLib = -552 ;offset to the openLibrary function | |
OpenLibVersion = 34 ;minimum version to use | |
CloseLib = -414 ;offset to closeLibrary function | |
PutString = -948 ;offset to putStr() function | |
MOVE.L #OpenLibVersion,D0 ;place version of lib in data reg 0 | |
LEA DosName,A1 ;place dos.lib name into add reg 1 | |
MOVE.L ExecBase,A6 ;point to exec.lib's jump table | |
JSR OpenLib(A6) ;make the jump from exec.lib jump table | |
TST.L D0 ;check to see if D0 equals zero (fail) | |
BEQ.B NoLibError ;branch to the NoLibError routinue | |
MOVE.L D0,A6 ;addr reg 6 = base addr of dos lib | |
MOVE.L #DisplayString,D1 ;data reg 1 = 'Hello World' | |
JSR PutString(A6) ;make the jump from dos.lib jump table | |
MOVE.L A6,A1 ;base addr of dos lib moved to addr reg 1 | |
MOVE.L ExecBase,A6 ;exec.lib addr move to addr reg 6 | |
JSR CloseLib(A6) ;make jump from the exec.lib jump table | |
NoLibError: CLR.L D0 ;clear the register to zero | |
RTS ;quit | |
DosName: DC.B "dos.library",0 ;zero-terminated ASCII lib name | |
DisplayString: DC.B "Hello World",10, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment