A2osX/.Docs/.HELLOWORLD.Z.txt

93 lines
2.5 KiB
Plaintext
Raw Normal View History

2020-03-10 07:24:08 +00:00
NEW
AUTO 3,1 Enable MASM3 auto line num
.LIST OFF
.OP Z80 Target CPU, must = CPU header level
.OR $2000 usually $2000, any value > $100 ok
.TF root/helloworldz
*--------------------------------------
.INB INC/A2OSX.I
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
* MyPtr .BS 2
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START ccf
jp (.1)
.DA #$80 Z80
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
* Add any address you want be relocated by loader
* Usefull if you have to pass EFFECTIVE address to an API call...
L.MSG.HELLO .DA MSG.HELLO
.DA 0
*--------------------------------------
* Called once at process creation
* Put code for loading LIB here
*--------------------------------------
CS.INIT ccf
ret
*--------------------------------------
* Called until exit with CS
* if RUN exits with CC, RN entered again
*--------------------------------------
CS.RUN
ld de,(L.MSG.HELLO)
ld a,SYS.PutS
call A2osX.ZCALL
.8 ld a,0 Exit Code = Success
scf QUIT Process
ret
.9 ld a,E.SYN Exit Code = Error
scf QUIT Process
ret
*--------------------------------------
* Called if option S.PS.F.EVENT enabled in Header
* Timer Event : every 10th seconds
*--------------------------------------
CS.DOEVENT scf
ret
*--------------------------------------
* Called once, when RUN exited with CS
* Put code for unloading LIB here
*--------------------------------------
CS.QUIT scf
ret
*--------------------------------------
CS.END
*--------------------------------------
* Initialized DATA
*--------------------------------------
* Put your constant here :
MSG.HELLO .AZ "Z80 Hello World"
*--------------------------------------
* Per Process DATA segement (0 filled before INIT)
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.END .ED
*--------------------------------------
MAN
2020-03-10 08:31:01 +00:00
SAVE ROOT/HELLOWORLD.Z