A2osX/.Docs/.HELLOWORLD.Z.txt
2020-07-23 18:48:45 +02:00

93 lines
2.6 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 (HL) TODO .....Z80 jmp table
.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
SAVE root/helloworld.z