2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA DEBUG
|
2015-06-03 18:30:57 +00:00
|
|
|
|
:1 bit $C000
|
|
|
|
|
bpl :1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta $C010
|
|
|
|
|
.EM
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA DEBUGOA
|
|
|
|
|
bit $C061
|
|
|
|
|
bpl :2
|
|
|
|
|
:1 bit $C000
|
|
|
|
|
bpl :1
|
|
|
|
|
sta $C010
|
2015-12-10 18:53:30 +00:00
|
|
|
|
:2 .EQ *
|
|
|
|
|
.EM
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* SYSCALLs Macros
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA SYSCALL
|
2016-10-24 15:54:43 +00:00
|
|
|
|
ldx #SYS.]1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr A2osX.SYSCALL
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA MLICALL
|
|
|
|
|
ldx #]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DO ]1=MLIALLOCIRQ
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #2
|
|
|
|
|
.FIN
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DO ]1=MLIDEALLOCIRQ
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #1
|
|
|
|
|
.FIN
|
2017-04-28 15:04:16 +00:00
|
|
|
|
.DO ]1=MLIATALK
|
|
|
|
|
lda #1
|
|
|
|
|
.FIN
|
2015-03-14 21:48:35 +00:00
|
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#2
|
|
|
|
|
.FIN
|
|
|
|
|
.DO ]1=MLISETEOF
|
|
|
|
|
lda #2
|
|
|
|
|
.FIN
|
|
|
|
|
.DO ]1=MLIGETEOF
|
|
|
|
|
lda #2
|
|
|
|
|
.FIN
|
|
|
|
|
.DO ]1=MLISETBUF
|
|
|
|
|
lda #2
|
|
|
|
|
.FIN
|
|
|
|
|
.DO ]1=MLIGETBUF
|
|
|
|
|
lda #2
|
|
|
|
|
.FIN
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr A2osX.MLICALL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA LIBCALL
|
|
|
|
|
ldy ]1
|
|
|
|
|
ldx #]2
|
|
|
|
|
jsr A2osX.LIBCALL
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* D.STACK PUSH/PULL Macros
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.MA PUSHA
|
|
|
|
|
dec pStack
|
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.MA PULLA
|
|
|
|
|
lda (pStack)
|
|
|
|
|
inc pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.MA PUSHYA
|
|
|
|
|
dec pStack
|
|
|
|
|
sta (pStack)
|
|
|
|
|
tya
|
|
|
|
|
dec pStack
|
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.MA PULLYA
|
|
|
|
|
lda (pStack)
|
|
|
|
|
inc pStack
|
|
|
|
|
tay
|
|
|
|
|
lda (pStack)
|
|
|
|
|
inc pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.MA PUSHAX
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pha
|
2015-06-03 18:30:57 +00:00
|
|
|
|
txa
|
|
|
|
|
dec pStack
|
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pla
|
2015-06-03 18:30:57 +00:00
|
|
|
|
dec pStack
|
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.MA PULLAX
|
|
|
|
|
lda (pStack)
|
|
|
|
|
inc pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pha
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pStack)
|
|
|
|
|
inc pStack
|
|
|
|
|
tax
|
2015-03-14 21:48:35 +00:00
|
|
|
|
pla
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA PUSHBI
|
2015-06-03 18:30:57 +00:00
|
|
|
|
dec pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA PUSHB
|
|
|
|
|
.DO ]#=2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
dec pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda ]1,]2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.ELSE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
dec pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda ]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.FIN
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA PULLB
|
|
|
|
|
.DO ]#=2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta ]1,]2
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inc pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.ELSE
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta ]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inc pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.FIN
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA PUSHWI
|
2015-06-03 18:30:57 +00:00
|
|
|
|
dec pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda /]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pStack)
|
|
|
|
|
dec pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA PUSHW
|
2015-06-03 18:30:57 +00:00
|
|
|
|
dec pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda ]1+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pStack)
|
|
|
|
|
dec pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda ]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA PULLW
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta ]1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inc pStack
|
|
|
|
|
lda (pStack)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta ]1+1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inc pStack
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
2016-10-21 15:03:41 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA POP
|
|
|
|
|
lda pStack
|
|
|
|
|
clc
|
|
|
|
|
adc ]1
|
|
|
|
|
sta pStack
|
|
|
|
|
.EM
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* General WORD Manipulation Macros
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA LDYAI
|
|
|
|
|
ldy #]1
|
|
|
|
|
lda /]1
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA LDAXI
|
|
|
|
|
lda #]1
|
|
|
|
|
ldx /]1
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA LDYA
|
|
|
|
|
.DO ]#=2
|
|
|
|
|
lda ]1+1,]2
|
|
|
|
|
ldy ]1,]2
|
|
|
|
|
.ELSE
|
|
|
|
|
lda ]1+1
|
|
|
|
|
ldy ]1
|
|
|
|
|
.FIN
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA LDAX
|
|
|
|
|
.DO ]#=2
|
|
|
|
|
ldx ]1+1,]2
|
|
|
|
|
lda ]1,]2
|
|
|
|
|
.ELSE
|
|
|
|
|
ldx ]1+1
|
|
|
|
|
lda ]1
|
|
|
|
|
.FIN
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA STYA
|
|
|
|
|
.DO ]#=2
|
|
|
|
|
sta ]1+1,]2
|
|
|
|
|
tya
|
|
|
|
|
sta ]1,]2
|
|
|
|
|
.ELSE
|
|
|
|
|
sta ]1+1
|
|
|
|
|
sty ]1
|
|
|
|
|
.FIN
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.MA STAX
|
|
|
|
|
.DO ]#=2
|
|
|
|
|
sta ]1+1,]2
|
|
|
|
|
txa
|
|
|
|
|
sta ]1,]2
|
|
|
|
|
.ELSE
|
|
|
|
|
stx ]1+1
|
|
|
|
|
sta ]1
|
|
|
|
|
.FIN
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* General Strings Macros
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.MA CSTR
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.AS "]1"
|
|
|
|
|
.HS 00
|
|
|
|
|
.EM
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.MA PSTR
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.DA #:1-*-1
|
|
|
|
|
.AS "]1"
|
|
|
|
|
:1 .EQ *
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.EM
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.BUILD/INC/MACROS.I
|