home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff384.lzh
/
NorthC
/
Example2.LZH
/
mini-hello
/
crt1.asm
< prev
next >
Wrap
Assembly Source File
|
1990-08-30
|
1KB
|
76 lines
; (c) 1990 S.Hawtin.
; Permission is granted to copy this file provided
; 1) It is not used for commercial gain
; 2) This notice is included in all copies
; 3) Altered copies are marked as such
;
; No liability is accepted for the contents of the file.
;
;
; Minimal startup routine for NorthC programs, does not support
; memory allocation, command line arguments, Amiga Libraries, and
; is very prone to falling over in an untidy heap. Start from
; "crt0.asm" if you want to do any real messing with startup
; routines.
;
INCLUDE clibs:clibdefs.i
section ONE,CODE
XREF __main
XREF dosLib
;
; Define entry point
;
XDEF start
start:
;
; Open DOS library
;
move.l #dosname,a1
clr d0
call exec,OpenLibrary
move.l d0,dosLib
beq error_exit
;
; Set up file handles
;
call dos,Input
move.l d0,__stdin
beq error_exit
call dos,Output
move.l d0,__stdout
beq error_exit
jsr __main
;
; If _main returns fall through to a normal (0) exit
;
move.l #0,a0
a0_exit:
move.l a0,-(sp) ; Hide the return code
move.l dosLib,a1 ; Close the exec library
call exec,CloseLibrary
move.l (sp)+,a0 ; Send the return to the caller
rts
error_exit:
move.l #0,a0
bra a0_exit
;
section TWO,data
;
; DOS Library name
dosname dc.b 'dos.library',0
section THREE,bss
xdef __stdin,__stdout
__stdin ds.l 1 ;input file handle
__stdout ds.l 1 ;output file handle
END