A2osX/INC/MACROS.I.txt

376 lines
6.3 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
2015-03-14 21:48:35 +00:00
*--------------------------------------
.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
*--------------------------------------
.MA DEBUGOA
bit $C061
bpl :1
>DEBUG
:1 .EQ *
.EM
2015-03-14 21:48:35 +00:00
*--------------------------------------
* SYSCALLs Macros
*--------------------------------------
.MA SLEEP
jsr A2osX.SLEEP
.EM
2015-03-14 21:48:35 +00:00
*--------------------------------------
.MA SYSCALL
ldx #SYS.]1
jsr A2osX.SYSCALL
2015-03-14 21:48:35 +00:00
.EM
*--------------------------------------
.MA LIBCALL
ldy ]1
ldx #]2
jsr A2osX.LIBCALL
.EM
2015-03-14 21:48:35 +00:00
*--------------------------------------
.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
.DO ]1=MLIATALK
lda #1
.FIN
2015-03-14 21:48:35 +00:00
.DO ]1=MLIREADBLOCK
lda #3
.FIN
.DO ]1=MLIWRITEBLOCK
lda #3
.FIN
.DO ]1=MLICREATE
lda #7
.FIN
.DO ]1=MLIDESTROY
lda #1
.FIN
.DO ]1=MLIRENAME
2015-03-14 21:48:35 +00:00
lda #2
.FIN
.DO ]1=MLISETFILEINFO
lda #7
.FIN
.DO ]1=MLIGETFILEINFO
lda #10
.FIN
.DO ]1=MLIONLINE
lda #2
.FIN
.DO ]1=MLISETPREFIX
lda #1
.FIN
.DO ]1=MLIGETPREFIX
lda #1
.FIN
.DO ]1=MLIOPEN
lda #3
.FIN
.DO ]1=MLINEWLINE
lda #3
.FIN
.DO ]1=MLIREAD
lda #4
.FIN
.DO ]1=MLIWRITE
lda #4
.FIN
.DO ]1=MLICLOSE
lda #1
.FIN
.DO ]1=MLIFLUSH
lda #1
.FIN
.DO ]1=MLISETMARK
lda #2
.FIN
.DO ]1=MLIGETMARK
lda #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
jsr GP.MLICall
2015-03-14 21:48:35 +00:00
.EM
*--------------------------------------
.MA ROMCALL
ldx #ROM.]1
jsr A2osX.ROMCALL
.EM
2015-03-14 21:48:35 +00:00
*--------------------------------------
* Global DATA Segment Access
*--------------------------------------
.MA LEA.G
clc
lda pData
adc #]1
tay
lda pData+1
adc /]1
.EM
*--------------------------------------
.MA PUSHEA.G
>LEA.G ]1
>PUSHYA
.EM
2018-01-15 06:50:44 +00:00
*--------------------------------------
.MA PUSHB.G
ldy #]1
lda (pData),y
>PUSHA
.EM
*--------------------------------------
.MA PUSHW.G
ldy #]1+1
lda (pData),y
>PUSHA
dey
lda (pData),y
>PUSHA
.EM
2018-06-14 15:31:36 +00:00
*--------------------------------------
.MA PUSHL.G
ldy #]1+4
:1 dey
lda (pData),y
>PUSHA
cpy #]1
bne :1
.EM
*--------------------------------------
.MA PULLL.G
ldy #]1
:1 >PULLA
sta (pData),y
iny
cpy #]1+4
bne :1
.EM
*--------------------------------------
.MA PUSHF.G
ldy #]1+5
:1 dey
lda (pData),y
>PUSHA
cpy #]1
bne :1
.EM
*--------------------------------------
.MA PULLF.G
ldy #]1
:1 >PULLA
sta (pData),y
iny
cpy #]1+5
bne :1
.EM
*--------------------------------------
.MA LDA.G
ldy #]1
lda (pData),y
.EM
*--------------------------------------
.MA STZ.G
ldy #]1
lda #0
sta (pData),y
.EM
*--------------------------------------
.MA STA.G
ldy #]1
sta (pData),y
.EM
2017-10-04 15:12:03 +00:00
*--------------------------------------
.MA ORA.G
ldy #]1
ora (pData),y
.EM
*--------------------------------------
.MA CMP.G
ldy #]1
cmp (pData),y
.EM
*--------------------------------------
.MA ADC.G
ldy #]1
adc (pData),y
.EM
*--------------------------------------
.MA SBC.G
ldy #]1
sbc (pData),y
.EM
*--------------------------------------
.MA DEC.G
>LDA.G ]1
dec
sta (pData),y
.EM
*--------------------------------------
.MA INC.G
>LDA.G ]1
inc
sta (pData),y
.EM
*--------------------------------------
.MA INCW.G
>INC.G ]1
bne :1
iny
lda (pData),y
inc
sta (pData),y
:1 .EQ *
.EM
*--------------------------------------
.MA LDYA.G
>LDA.G ]1
pha
iny
lda (pData),y
ply
.EM
*--------------------------------------
.MA STYA.G
phy
ldy #]1+1
sta (pData),y
dey
pla
sta (pData),y
.EM
*--------------------------------------
* STACK PUSH/PULL
2015-03-14 21:48:35 +00:00
*--------------------------------------
2015-06-03 18:30:57 +00:00
.MA PUSHA
dec pStack
2015-06-03 18:30:57 +00:00
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
>PUSHA
2015-06-03 18:30:57 +00:00
tya
>PUSHA
2015-03-14 21:48:35 +00:00
.EM
*--------------------------------------
2015-06-03 18:30:57 +00:00
.MA PULLYA
>PULLA
2015-06-03 18:30:57 +00:00
tay
>PULLA
2015-03-14 21:48:35 +00:00
.EM
*--------------------------------------
.MA PUSHBI
lda #]1
>PUSHA
2015-03-14 21:48:35 +00:00
.EM
*--------------------------------------
.MA PUSHB
.DO ]#=2
lda ]1,]2
>PUSHA
2015-03-14 21:48:35 +00:00
.ELSE
lda ]1
>PUSHA
2015-03-14 21:48:35 +00:00
.FIN
.EM
*--------------------------------------
.MA PULLB
.DO ]#=2
>PULLA
2015-03-14 21:48:35 +00:00
sta ]1,]2
.ELSE
>PULLA
2015-03-14 21:48:35 +00:00
sta ]1
.FIN
.EM
*--------------------------------------
.MA PUSHWI
lda /]1
>PUSHA
2015-03-14 21:48:35 +00:00
lda #]1
>PUSHA
2015-03-14 21:48:35 +00:00
.EM
*--------------------------------------
.MA PUSHW
lda ]1+1
>PUSHA
2015-03-14 21:48:35 +00:00
lda ]1
>PUSHA
2015-03-14 21:48:35 +00:00
.EM
*--------------------------------------
.MA PULLW
>PULLA
2015-03-14 21:48:35 +00:00
sta ]1
>PULLA
2015-03-14 21:48:35 +00:00
sta ]1+1
.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
ldy ]1,]2
lda ]1+1,]2
2015-03-14 21:48:35 +00:00
.ELSE
ldy ]1
lda ]1+1
2015-03-14 21:48:35 +00:00
.FIN
.EM
*--------------------------------------
.MA STYA
.DO ]#=2
sta ]1+1,]2
tya
sta ]1,]2
.ELSE
sta ]1+1
sty ]1
.FIN
.EM
*--------------------------------------
* General Strings Macros
*--------------------------------------
.MA PSTR
.DA #:1-*-1
.AS "]1"
:1 .EQ *
2015-03-14 21:48:35 +00:00
.EM
MAN
SAVE /A2OSX.BUILD/INC/MACROS.I