A2osX/INC/MACROS.I.txt

452 lines
7.3 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
2015-03-15 22:00:40 +00:00
PREFIX /A2OSX.BUILD
2015-03-14 21:48:35 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
.MA DEBUG
.70 bit $C000
bpl .70
sta $C010
.EM
*--------------------------------------
* SYSCALLs Macros
*--------------------------------------
.MA SYSCALL
ldx #]1
jsr A2osX.SYSCALL
.EM
*--------------------------------------
.MA MLICALL
ldx #]1
.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 KMLICALL
ldx #]1
.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 Kernel.MLICALL
.EM
*--------------------------------------
.MA DRVCALL
ldy ]1
ldx #]2
jsr A2osX.DRVCALL
.EM
*--------------------------------------
.MA LIBLOADP
>PUSHW ]1
ldx #SYS.LoadLib
jsr A2osX.SYSCALL
.EM
*--------------------------------------
.MA LIBLOADA
ldx #SYS.LoadLibA
jsr A2osX.SYSCALL
.EM
*--------------------------------------
.MA LIBCALL
ldy ]1
ldx #]2
jsr A2osX.LIBCALL
.EM
*--------------------------------------
* LOCAL SEGMENT Manipulation Macros
*--------------------------------------
.MA ADDLOCAL
pha
lda R.LS
dec R.SP
sta (R.SP)
lda R.SP
sec
sbc #]1
sta R.SP
sta R.LS
pla
.EM
*--------------------------------------
.MA REMLOCAL
php
pha
lda R.SP
clc
adc #]1
sta R.SP
lda (R.SP)
inc R.SP
sta R.LS
pla
plp
.EM
*--------------------------------------
.MA LDAL
ldy #]1
lda (R.LS),y
.EM
*--------------------------------------
.MA ADCL
ldy #]1
adc (R.LS),y
.EM
*--------------------------------------
.MA SBCL
ldy #]1
adc (R.LS),y
.EM
*--------------------------------------
.MA STAL
ldy #]1
sta (R.LS),y
.EM
*--------------------------------------
.MA LDYAL
ldy #]1
lda (R.LS),y
pha
iny
lda (R.LS),y
ply
.EM
*--------------------------------------
.MA STYAL
phy
ldy #]1+1
sta (R.LS),y
dey
pla
sta (R.LS),y
tay
.EM
*--------------------------------------
.MA INCL
ldy #]1
lda (R.LS),y
inc
sta (R.LS),y
.EM
*--------------------------------------
.MA INCLW
ldy #]1
lda (R.LS),y
inc
bne .71
sta (R.LS),y
iny
lda (R.LS),y
inc
.71 sta (R.LS),y
.EM
*--------------------------------------
.MA DECL
ldy #]1
lda (R.LS),y
dec
sta (R.LS),y
.EM
*--------------------------------------
.MA DECLW
ldy #]1
lda (R.LS),y
bne .72
pha
iny
lda (R.LS),y
dec
sta (R.LS),y
dey
pla
.72 dec
sta (R.LS),y
.EM
*--------------------------------------
* D.STACK PUSH/PULL Macros
*--------------------------------------
.MA PUSHA
dec R.SP
sta (R.SP)
.EM
*--------------------------------------
.MA PULLA
lda (R.SP)
inc R.SP
.EM
*--------------------------------------
.MA PUSHYA
dec R.SP
sta (R.SP)
pha
tya
dec R.SP
sta (R.SP)
pla
.EM
*--------------------------------------
.MA PULLYA
lda (R.SP)
inc R.SP
tay
lda (R.SP)
inc R.SP
.EM
*--------------------------------------
.MA PUSHBI
dec R.SP
lda #]1
sta (R.SP)
.EM
*--------------------------------------
.MA PUSHB
.DO ]#=2
dec R.SP
lda ]1,]2
sta (R.SP)
.ELSE
dec R.SP
lda ]1
sta (R.SP)
.FIN
.EM
*--------------------------------------
.MA PULLB
.DO ]#=2
lda (R.SP)
sta ]1,]2
inc R.SP
.ELSE
lda (R.SP)
sta ]1
inc R.SP
.FIN
.EM
*--------------------------------------
.MA PUSHWI
dec R.SP
lda /]1
sta (R.SP)
dec R.SP
lda #]1
sta (R.SP)
.EM
*--------------------------------------
.MA PUSHW
dec R.SP
lda ]1+1
sta (R.SP)
dec R.SP
lda ]1
sta (R.SP)
.EM
*--------------------------------------
.MA PULLW
lda (R.SP)
sta ]1
inc R.SP
lda (R.SP)
sta ]1+1
inc R.SP
.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 CSTRING
.AS "]1"
.HS 00
.EM
*--------------------------------------
.MA PSTRING
.DA #.74-.73
.73 .AS "]1"
.74 .AS ""
.EM
MAN
SAVE INC/MACROS.I