A2osX/.Docs/.HELLOWORLD.S.txt

97 lines
2.6 KiB
Plaintext
Raw Normal View History

2019-03-19 01:11:03 +00:00
NEW
2019-06-13 15:30:28 +00:00
AUTO 3,1 Enable MASM3 auto line num
2020-03-10 07:24:08 +00:00
.LIST OFF
.OP 65C02 Target CPU, must = CPU header level
.OR $2000 usually $2000, any value > $100 ok
.TF root/helloworld
2019-03-19 01:11:03 +00:00
*--------------------------------------
2020-03-10 07:24:08 +00:00
.INB INC/MACROS.I
.INB INC/A2OSX.I
2019-03-19 01:11:03 +00:00
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
2020-03-10 07:24:08 +00:00
.DUMMY
.OR ZPBIN
2019-03-19 01:11:03 +00:00
ZS.START
* MyPtr .BS 2
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
2020-03-10 07:24:08 +00:00
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.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 Segment Size
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
2019-03-19 01:11:03 +00:00
*--------------------------------------
* Relocation Table
2019-10-03 06:25:27 +00:00
*--------------------------------------
2020-03-10 07:24:08 +00:00
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
2019-03-19 01:11:03 +00:00
* 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
2020-03-10 07:24:08 +00:00
.DA 0
2019-03-19 01:11:03 +00:00
*--------------------------------------
* Called once at process creation
* Put code for loading LIB here
*--------------------------------------
CS.INIT clc
2019-06-13 15:30:28 +00:00
rts
2019-03-19 01:11:03 +00:00
*--------------------------------------
* Called until exit with CS
* if RUN exits with CC, RN entered again
*--------------------------------------
CS.RUN
* Put your code here
2020-03-10 07:24:08 +00:00
>LDYA L.MSG.HELLO
>SYSCALL PutS
.8 lda #0 Exit Code = Success
sec QUIT Process
rts
.9 lda #E.SYN Exit Code = Error
sec QUIT Process
rts
2019-03-19 01:11:03 +00:00
*--------------------------------------
* Called if option S.PS.F.EVENT enabled in Header
* Timer Event : every 10th seconds
*--------------------------------------
CS.DOEVENT sec
2020-03-10 07:24:08 +00:00
rts
2019-03-19 01:11:03 +00:00
*--------------------------------------
* Called once, when RUN exited with CS
* Put code for unloading LIB here
*--------------------------------------
CS.QUIT clc
2020-03-10 07:24:08 +00:00
rts
2019-03-19 01:11:03 +00:00
*--------------------------------------
CS.END
*--------------------------------------
* Initialized DATA
*--------------------------------------
* Put your constant here :
MSG.HELLO .AZ "Hello World"
*--------------------------------------
2020-03-10 07:24:08 +00:00
* Per Process DATA segment (0 filled before INIT)
2019-03-19 01:11:03 +00:00
*--------------------------------------
2020-03-10 07:24:08 +00:00
.DUMMY
.OR 0
2019-03-19 01:11:03 +00:00
DS.START
2020-03-10 07:24:08 +00:00
DS.END .ED
2019-03-19 01:11:03 +00:00
*--------------------------------------
MAN
2020-03-10 08:31:01 +00:00
SAVE ROOT/HELLOWORLD.S
2019-03-19 01:11:03 +00:00
ASM