mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-24 14:31:05 +00:00
618 lines
10 KiB
Plaintext
618 lines
10 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
.MA DEBUG
|
||
:1 bit $C000
|
||
bpl :1
|
||
sta $C010
|
||
.EM
|
||
*--------------------------------------
|
||
.MA DEBUGOA
|
||
bit $C061
|
||
bpl :1
|
||
>DEBUG
|
||
:1 .EQ *
|
||
.EM
|
||
*--------------------------------------
|
||
* SYSCALLs Macros
|
||
*--------------------------------------
|
||
.MA SYSCALL
|
||
ldx #SYS.]1
|
||
jsr A2osX.SYSCALL
|
||
.EM
|
||
*--------------------------------------
|
||
.MA LIBCALL
|
||
ldy ]1
|
||
ldx #]2
|
||
jsr A2osX.LIBCALL
|
||
.EM
|
||
*--------------------------------------
|
||
.MA SLEEP
|
||
jsr A2osX.SLEEP
|
||
.EM
|
||
*--------------------------------------
|
||
.MA SYSCALL2
|
||
ldx #SYS.]1
|
||
jsr A2osX.SYSCALL2
|
||
.EM
|
||
*--------------------------------------
|
||
.MA MLICALL
|
||
ldx #]1
|
||
.DO ]1=MLI.ALLOCIRQ
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.DEALLOCIRQ
|
||
lda #1
|
||
.FIN
|
||
.DO ]1=MLI.ATALK
|
||
lda #1
|
||
.FIN
|
||
.DO ]1=MLI.READBLOCK
|
||
lda #3
|
||
.FIN
|
||
.DO ]1=MLI.WRITEBLOCK
|
||
lda #3
|
||
.FIN
|
||
.DO ]1=MLI.CREATE
|
||
lda #7
|
||
.FIN
|
||
.DO ]1=MLI.DESTROY
|
||
lda #1
|
||
.FIN
|
||
.DO ]1=MLI.RENAME
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.SFINFO
|
||
lda #7
|
||
.FIN
|
||
.DO ]1=MLI.GFINFO
|
||
lda #10
|
||
.FIN
|
||
.DO ]1=MLI.ONLINE
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.SETPREFIX
|
||
lda #1
|
||
.FIN
|
||
.DO ]1=MLI.GETPREFIX
|
||
lda #1
|
||
.FIN
|
||
.DO ]1=MLI.OPEN
|
||
lda #3
|
||
.FIN
|
||
.DO ]1=MLI.NEWLINE
|
||
lda #3
|
||
.FIN
|
||
.DO ]1=MLI.READ
|
||
lda #4
|
||
.FIN
|
||
.DO ]1=MLI.WRITE
|
||
lda #4
|
||
.FIN
|
||
.DO ]1=MLI.CLOSE
|
||
lda #1
|
||
.FIN
|
||
.DO ]1=MLI.FLUSH
|
||
lda #1
|
||
.FIN
|
||
.DO ]1=MLI.SETMARK
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.GETMARK
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.SETEOF
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.GETEOF
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.SETBUF
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.GETBUF
|
||
lda #2
|
||
.FIN
|
||
|
||
.DO ]1=MLI.SFINFOEX
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.GFINFOEX
|
||
lda #2
|
||
.FIN
|
||
.DO ]1=MLI.ACL
|
||
lda #2
|
||
.FIN
|
||
|
||
jsr GP.MLICall
|
||
.EM
|
||
*--------------------------------------
|
||
* FPU Entry Point
|
||
*-------------------------------------- uint16
|
||
FPU.wMUL .EQ 0
|
||
FPU.wDIV .EQ 2
|
||
FPU.wMOD .EQ 4
|
||
FPU.wADD .EQ 6
|
||
FPU.wSUB .EQ 8
|
||
|
||
FPU.wSHL .EQ 10
|
||
FPU.wSHR .EQ 12
|
||
|
||
FPU.wL .EQ 14
|
||
FPU.wLE .EQ 16
|
||
FPU.wG .EQ 18
|
||
FPU.wGE .EQ 20
|
||
|
||
FPU.wE .EQ 22
|
||
FPU.wNE .EQ 24
|
||
|
||
FPU.wAND .EQ 26
|
||
FPU.wOR .EQ 28
|
||
FPU.wxOR .EQ 30
|
||
|
||
FPU.wLAND .EQ 32
|
||
FPU.wLOR .EQ 34
|
||
*-------------------------------------- int16
|
||
FPU.iMUL .EQ 36
|
||
FPU.iDIV .EQ 38
|
||
FPU.iMOD .EQ 40
|
||
FPU.iADD .EQ 42
|
||
FPU.iSUB .EQ 44
|
||
|
||
FPU.iSHL .EQ 46
|
||
FPU.iSHR .EQ 48
|
||
|
||
FPU.iL .EQ 50
|
||
FPU.iLE .EQ 52
|
||
FPU.iG .EQ 54
|
||
FPU.iGE .EQ 56
|
||
|
||
FPU.iE .EQ 58
|
||
FPU.iNE .EQ 60
|
||
|
||
FPU.iAND .EQ 62
|
||
FPU.iOR .EQ 64
|
||
FPU.iXOR .EQ 66
|
||
|
||
FPU.iLAND .EQ 68
|
||
FPU.iLOR .EQ 70
|
||
*-------------------------------------- uint32
|
||
FPU.uMUL .EQ 72
|
||
FPU.uDIV .EQ 74
|
||
FPU.uMOD .EQ 76
|
||
FPU.uADD .EQ 78
|
||
FPU.uSUB .EQ 80
|
||
|
||
FPU.uSHL .EQ 82
|
||
FPU.uSHR .EQ 84
|
||
|
||
FPU.uL .EQ 86
|
||
FPU.uLE .EQ 88
|
||
FPU.uG .EQ 90
|
||
FPU.uGE .EQ 92
|
||
|
||
FPU.uE .EQ 94
|
||
FPU.uNE .EQ 96
|
||
|
||
FPU.uAND .EQ 98
|
||
FPU.uOR .EQ 100
|
||
FPU.uXOR .EQ 102
|
||
|
||
FPU.uLAND .EQ 104
|
||
FPU.uLOR .EQ 106
|
||
*-------------------------------------- int32
|
||
FPU.lMUL .EQ 108
|
||
FPU.lDIV .EQ 110
|
||
FPU.lMOD .EQ 112
|
||
FPU.lADD .EQ 114
|
||
FPU.lSUB .EQ 116
|
||
|
||
FPU.lSHL .EQ 118
|
||
FPU.lSHR .EQ 120
|
||
|
||
FPU.lL .EQ 122
|
||
FPU.lLE .EQ 124
|
||
FPU.lG .EQ 126
|
||
FPU.lGE .EQ 128
|
||
|
||
FPU.lE .EQ 130
|
||
FPU.lNE .EQ 132
|
||
|
||
FPU.lAND .EQ 134
|
||
FPU.lOR .EQ 136
|
||
FPU.lXOR .EQ 138
|
||
|
||
FPU.lLAND .EQ 140
|
||
FPU.lLOR .EQ 142
|
||
*-------------------------------------- float
|
||
FPU.fMUL .EQ 144
|
||
FPU.fDIV .EQ 146
|
||
FPU.fMOD .EQ 148
|
||
FPU.fADD .EQ 150
|
||
FPU.fSUB .EQ 152
|
||
|
||
FPU.fSHL .EQ 154
|
||
FPU.fSHR .EQ 156
|
||
|
||
FPU.fL .EQ 158
|
||
FPU.fLE .EQ 160
|
||
FPU.fG .EQ 162
|
||
FPU.fGE .EQ 164
|
||
|
||
FPU.fE .EQ 166
|
||
FPU.fNE .EQ 168
|
||
|
||
FPU.fAND .EQ 170
|
||
FPU.fOR .EQ 172
|
||
FPU.fXOR .EQ 174
|
||
|
||
FPU.fLAND .EQ 176
|
||
FPU.fLOR .EQ 178
|
||
*--------------------------------------
|
||
* math.h
|
||
*--------------------------------------
|
||
FPU.PWR .EQ 180
|
||
*--------------------------------------
|
||
FPU.LOG .EQ 182
|
||
FPU.SQR .EQ 184
|
||
FPU.EXP .EQ 186
|
||
FPU.COS .EQ 188
|
||
FPU.SIN .EQ 190
|
||
FPU.TAN .EQ 192
|
||
FPU.ATAN .EQ 194
|
||
|
||
FPU.SETARG .EQ 196 fadd.....
|
||
FPU.SETFAC .EQ 198 log...., PrintF
|
||
|
||
FPU.GETFAC .EQ 200 Copy FAC to (FORPNT)
|
||
FPU.FCOMP .EQ 202
|
||
|
||
FPU.LTOF .EQ 204 Float
|
||
FPU.QINT .EQ 206 lrintf
|
||
|
||
FPU.FIN .EQ 208 sscanf
|
||
FPU.FOUT .EQ 210 PrintF
|
||
*--------------------------------------
|
||
.MA FPU
|
||
ldx #FPU.]1
|
||
jsr A2osX.FPUCALL
|
||
.EM
|
||
*--------------------------------------
|
||
* 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
|
||
*--------------------------------------
|
||
.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
|
||
*--------------------------------------
|
||
.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 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
|
||
*--------------------------------------
|
||
.MA AND.G
|
||
ldy #]1
|
||
and (pData),y
|
||
.EM
|
||
*--------------------------------------
|
||
.MA ORA.G
|
||
ldy #]1
|
||
ora (pData),y
|
||
.EM
|
||
*--------------------------------------
|
||
.MA EOR.G
|
||
ldy #]1
|
||
eor (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 STZW.G
|
||
>STZ.G ]1
|
||
iny
|
||
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 DEC.G
|
||
>LDA.G ]1
|
||
dec
|
||
sta (pData),y
|
||
.EM
|
||
*--------------------------------------
|
||
.MA DECW.G
|
||
>LDA.G ]1
|
||
bne :1
|
||
dec
|
||
sta (pData),y
|
||
iny
|
||
lda (pData),y
|
||
:1 dec
|
||
sta (pData),y
|
||
.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
|
||
*--------------------------------------
|
||
.MA PUSHA
|
||
dec pStack
|
||
sta (pStack)
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PULLA
|
||
lda (pStack)
|
||
inc pStack
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHYA
|
||
>PUSHA
|
||
tya
|
||
>PUSHA
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PULLYA
|
||
>PULLA
|
||
tay
|
||
>PULLA
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHBI
|
||
lda #]1
|
||
>PUSHA
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHB
|
||
.DO ]#=2
|
||
lda ]1,]2
|
||
>PUSHA
|
||
.ELSE
|
||
lda ]1
|
||
>PUSHA
|
||
.FIN
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PULLB
|
||
.DO ]#=2
|
||
>PULLA
|
||
sta ]1,]2
|
||
.ELSE
|
||
>PULLA
|
||
sta ]1
|
||
.FIN
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHWZ
|
||
lda #0
|
||
>PUSHA
|
||
>PUSHA
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHWI
|
||
lda /]1
|
||
>PUSHA
|
||
lda #]1
|
||
>PUSHA
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHW
|
||
.DO ]#=2
|
||
lda ]1+1,]2
|
||
>PUSHA
|
||
lda ]1,]2
|
||
>PUSHA
|
||
.ELSE
|
||
lda ]1+1
|
||
>PUSHA
|
||
lda ]1
|
||
>PUSHA
|
||
.FIN
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PULLW
|
||
>PULLA
|
||
sta ]1
|
||
>PULLA
|
||
sta ]1+1
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHLZ
|
||
lda #0
|
||
ldy #3
|
||
:1 >PUSHA
|
||
dey
|
||
bpl :1
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PUSHL
|
||
ldy #3
|
||
:1 lda ]1,y
|
||
>PUSHA
|
||
dey
|
||
bpl :1
|
||
.EM
|
||
*--------------------------------------
|
||
.MA PULLL
|
||
ldy #0
|
||
:1 >PULLA
|
||
sta ]1,y
|
||
iny
|
||
cpy #4
|
||
bne :1
|
||
.EM
|
||
*--------------------------------------
|
||
.MA ENTER
|
||
>PUSHB pBase
|
||
lda pStack
|
||
inc
|
||
sta pBase
|
||
clc
|
||
sbc #]1
|
||
sta pStack
|
||
.EM
|
||
*--------------------------------------
|
||
.MA LEAVE
|
||
pha
|
||
lda pBase
|
||
dec
|
||
sta pStack
|
||
>PULLB pBase
|
||
pla
|
||
.EM
|
||
*--------------------------------------
|
||
.MA POP
|
||
.DO ]1=1
|
||
inc pStack
|
||
.FIN
|
||
.DO ]1=2
|
||
inc pStack
|
||
inc pStack
|
||
.FIN
|
||
.DO ]1=3
|
||
inc pStack
|
||
inc pStack
|
||
inc pStack
|
||
.FIN
|
||
.DO ]1>3
|
||
pha
|
||
lda #]1
|
||
:1 inc pStack
|
||
dec
|
||
bne :1
|
||
pla
|
||
.FIN
|
||
.EM
|
||
*--------------------------------------
|
||
.MA RET
|
||
>POP ]1
|
||
rts
|
||
.EM
|
||
*--------------------------------------
|
||
* General WORD Manipulation Macros
|
||
*--------------------------------------
|
||
.MA LDYAI
|
||
ldy #]1
|
||
lda /]1
|
||
.EM
|
||
*--------------------------------------
|
||
.MA LDYA
|
||
.DO ]#=2
|
||
ldy ]1,]2
|
||
lda ]1+1,]2
|
||
.ELSE
|
||
ldy ]1
|
||
lda ]1+1
|
||
.FIN
|
||
.EM
|
||
*--------------------------------------
|
||
.MA STYA
|
||
.DO ]#=2
|
||
sta ]1+1,]2
|
||
tya
|
||
sta ]1,]2
|
||
.ELSE
|
||
sty ]1
|
||
sta ]1+1
|
||
.FIN
|
||
.EM
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE inc/macros.i
|