A2osX/INC/MACROS.I.txt
Rémy GIBERT bae3f91aab 0.9
2017-01-12 18:43:45 +01:00

294 lines
4.9 KiB
Plaintext
Raw 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.

PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
.MA DEBUG
:1 bit $C000
bpl :1
sta $C010
.EM
*--------------------------------------
.MA DEBUGOA
bit $C061
bpl :2
:1 bit $C000
bpl :1
sta $C010
:2 .EQ *
.EM
*--------------------------------------
* SYSCALLs Macros
*--------------------------------------
.MA SYSCALL
ldx #SYS.]1
jsr A2osX.SYSCALL
.EM
*--------------------------------------
.MA MLICALL
ldx #]1
.DO ]1=MLIALLOCIRQ
lda #2
.FIN
.DO ]1=MLIDEALLOCIRQ
lda #1
.FIN
.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
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 A2osX.MLICALL
.EM
*--------------------------------------
.MA LIBCALL
ldy ]1
ldx #]2
jsr A2osX.LIBCALL
.EM
*--------------------------------------
* D.STACK PUSH/PULL Macros
*--------------------------------------
.MA PUSHA
dec pStack
sta (pStack)
.EM
*--------------------------------------
.MA PULLA
lda (pStack)
inc pStack
.EM
*--------------------------------------
.MA PUSHYA
dec pStack
sta (pStack)
tya
dec pStack
sta (pStack)
.EM
*--------------------------------------
.MA PULLYA
lda (pStack)
inc pStack
tay
lda (pStack)
inc pStack
.EM
*--------------------------------------
.MA PUSHAX
pha
txa
dec pStack
sta (pStack)
pla
dec pStack
sta (pStack)
.EM
*--------------------------------------
.MA PULLAX
lda (pStack)
inc pStack
pha
lda (pStack)
inc pStack
tax
pla
.EM
*--------------------------------------
.MA PUSHBI
dec pStack
lda #]1
sta (pStack)
.EM
*--------------------------------------
.MA PUSHB
.DO ]#=2
dec pStack
lda ]1,]2
sta (pStack)
.ELSE
dec pStack
lda ]1
sta (pStack)
.FIN
.EM
*--------------------------------------
.MA PULLB
.DO ]#=2
lda (pStack)
sta ]1,]2
inc pStack
.ELSE
lda (pStack)
sta ]1
inc pStack
.FIN
.EM
*--------------------------------------
.MA PUSHWI
dec pStack
lda /]1
sta (pStack)
dec pStack
lda #]1
sta (pStack)
.EM
*--------------------------------------
.MA PUSHW
dec pStack
lda ]1+1
sta (pStack)
dec pStack
lda ]1
sta (pStack)
.EM
*--------------------------------------
.MA PULLW
lda (pStack)
sta ]1
inc pStack
lda (pStack)
sta ]1+1
inc pStack
.EM
*--------------------------------------
.MA POP
lda pStack
clc
adc ]1
sta pStack
.EM
*--------------------------------------
* 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
*--------------------------------------
.MA CSTR
.AS "]1"
.HS 00
.EM
*--------------------------------------
.MA PSTR
.DA #:1-*-1
.AS "]1"
:1 .EQ *
.EM
MAN
SAVE /A2OSX.DEV/INC/MACROS.I