2018-11-26 19:54:46 +00:00
|
|
|
|
NEW
|
|
|
|
|
PREFIX
|
2019-03-21 05:31:59 +00:00
|
|
|
|
AUTO 4,1 Enable MASM3 auto line num
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02 Target CPU, must = CPU header level
|
|
|
|
|
.OR $2000 usualy $2000, any value > $100 ok
|
|
|
|
|
.TF <PATH TO BINARY> e.g. BIN/MYPROG
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
2019-03-21 05:31:59 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Zero Page Segment, up to 32 bytes
|
|
|
|
|
*--------------------------------------
|
2019-03-21 05:31:59 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
2018-12-04 13:20:35 +00:00
|
|
|
|
ZS.START
|
2018-11-26 19:54:46 +00:00
|
|
|
|
* MyPtr .BS 2
|
2019-01-18 16:06:44 +00:00
|
|
|
|
ZS.END .ED
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
2019-03-21 05:31:59 +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 SegmentSize
|
|
|
|
|
.DA #16 Stack Size
|
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
|
|
|
|
.DA 0
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
2019-03-21 05:31:59 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
2018-11-26 19:54:46 +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.Test .DA Msg.Test
|
2019-03-21 05:31:59 +00:00
|
|
|
|
|
|
|
|
|
.DA 0
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called once at process creation
|
|
|
|
|
* Put code for loading LIB here
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT clc
|
2019-03-21 05:31:59 +00:00
|
|
|
|
rts
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called until exit with CS
|
|
|
|
|
* if RUN exits with CC, RN entered again
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN
|
|
|
|
|
|
|
|
|
|
* Put your code here
|
2019-03-21 05:31:59 +00:00
|
|
|
|
* >LDYA L.MSG.Test Load EFFECTIVE address
|
|
|
|
|
* >SYSCALL puts Call API to print a string
|
2018-11-26 19:54:46 +00:00
|
|
|
|
|
2019-03-21 05:31:59 +00:00
|
|
|
|
.8 lda #0 Exit Code = Succes
|
|
|
|
|
sec QUIT Process
|
|
|
|
|
rts
|
2018-11-26 19:54:46 +00:00
|
|
|
|
|
2019-03-21 05:31:59 +00:00
|
|
|
|
.9 lda #E.SYN Exit Code = Succes
|
|
|
|
|
sec QUIT Process
|
|
|
|
|
rts
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called if option S.PS.F.EVENT enabled in Header
|
|
|
|
|
* Timer Event : every 10th seconds
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT sec
|
2019-03-21 05:31:59 +00:00
|
|
|
|
rts
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called once, when RUN exited with CS
|
|
|
|
|
* Put code for unloading LIB here
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT clc
|
2019-03-21 05:31:59 +00:00
|
|
|
|
rts
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Initialized DATA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
|
|
|
|
|
* Put your constant here :
|
|
|
|
|
* MSG.TEST .AZ "Test Message"
|
|
|
|
|
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Per Process DATA segement (0 filled before INIT)
|
|
|
|
|
*--------------------------------------
|
2019-03-21 05:31:59 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2018-11-26 19:54:46 +00:00
|
|
|
|
DS.START
|
|
|
|
|
DS.END
|
2019-03-21 05:31:59 +00:00
|
|
|
|
.ED
|
2018-11-26 19:54:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2019-03-21 05:31:59 +00:00
|
|
|
|
SAVE USR/SRC/BIN<MYPROG.S> Save this source file
|
2018-11-26 19:54:46 +00:00
|
|
|
|
ASM
|