2018-11-23 07:03:26 +00:00
|
|
|
|
NEW
|
2019-04-10 07:45:09 +00:00
|
|
|
|
AUTO 3,1
|
2018-11-23 07:03:26 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2019-04-01 06:07:56 +00:00
|
|
|
|
* Uses: 12 ZP
|
2018-11-23 07:03:26 +00:00
|
|
|
|
* M32.ACC .BS 4
|
|
|
|
|
* M32.ARG .BS 4
|
|
|
|
|
* M32.TMP .BS 4
|
|
|
|
|
*--------------------------------------
|
2019-04-01 06:07:56 +00:00
|
|
|
|
M32.Add ldx #4
|
|
|
|
|
ldy #0
|
2018-11-23 22:40:33 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
clc ARG+ACC->ACC
|
2018-11-23 07:03:26 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
.1 lda M32.ARG,y
|
|
|
|
|
adc M32.ACC,y
|
|
|
|
|
sta M32.ACC,y
|
2018-11-23 22:40:33 +00:00
|
|
|
|
iny
|
|
|
|
|
dex
|
2019-04-01 06:07:56 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc
|
2018-11-23 07:03:26 +00:00
|
|
|
|
rts if CS, Overflow
|
|
|
|
|
*---------------------------------------
|
2019-04-01 06:07:56 +00:00
|
|
|
|
M32.Sub ldx #4
|
|
|
|
|
|
|
|
|
|
ldy #0
|
2018-11-23 22:40:33 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
sec ARG-ACC->ACC
|
|
|
|
|
|
|
|
|
|
.1 lda M32.ARG,y
|
|
|
|
|
sbc M32.ACC,y
|
|
|
|
|
sta M32.ACC,y
|
2018-11-23 22:40:33 +00:00
|
|
|
|
iny
|
|
|
|
|
dex
|
2019-04-01 06:07:56 +00:00
|
|
|
|
bne .1
|
2019-02-21 11:34:28 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-02-21 11:34:28 +00:00
|
|
|
|
|
2018-11-23 07:03:26 +00:00
|
|
|
|
bcs .8 if CC, Overflow
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-04-01 06:07:56 +00:00
|
|
|
|
M32.Mul ldx #3 ARG*ACC->ACC
|
2018-11-23 07:03:26 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
.1 lda M32.ACC,x
|
|
|
|
|
sta M32.TMP,x
|
|
|
|
|
stz M32.ACC,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldx #32
|
|
|
|
|
|
|
|
|
|
.2 lsr M32.TMP+3
|
|
|
|
|
ror M32.TMP+2
|
|
|
|
|
ror M32.TMP+1
|
|
|
|
|
ror M32.TMP
|
|
|
|
|
|
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
lda M32.ARG
|
|
|
|
|
adc M32.ACC
|
|
|
|
|
sta M32.ACC
|
|
|
|
|
|
|
|
|
|
lda M32.ARG+1
|
|
|
|
|
adc M32.ACC+1
|
|
|
|
|
sta M32.ACC+1
|
2018-11-23 07:03:26 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
lda M32.ARG+2
|
|
|
|
|
adc M32.ACC+2
|
|
|
|
|
sta M32.ACC+2
|
2018-11-23 07:03:26 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
lda M32.ARG+3
|
|
|
|
|
adc M32.ACC+3
|
|
|
|
|
sta M32.ACC+3
|
|
|
|
|
|
|
|
|
|
.3 asl M32.ARG
|
|
|
|
|
rol M32.ARG+1
|
|
|
|
|
rol M32.ARG+2
|
|
|
|
|
rol M32.ARG+3
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
|
2018-11-23 07:03:26 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-04-01 06:07:56 +00:00
|
|
|
|
M32.Mod sec
|
|
|
|
|
.HS 90 BCC
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
M32.Div clc
|
|
|
|
|
php
|
|
|
|
|
|
|
|
|
|
stz M32.TMP ARG/ACC->ACC
|
|
|
|
|
stz M32.TMP+1
|
|
|
|
|
stz M32.TMP+2
|
|
|
|
|
stz M32.TMP+3
|
|
|
|
|
|
|
|
|
|
ldx #32
|
|
|
|
|
|
|
|
|
|
.1 asl M32.ARG
|
|
|
|
|
rol M32.ARG+1
|
|
|
|
|
rol M32.ARG+2
|
|
|
|
|
rol M32.ARG+3
|
|
|
|
|
|
|
|
|
|
rol M32.TMP
|
|
|
|
|
rol M32.TMP+1
|
|
|
|
|
rol M32.TMP+2
|
|
|
|
|
rol M32.TMP+3
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
lda M32.TMP
|
|
|
|
|
sbc M32.ACC
|
|
|
|
|
pha
|
|
|
|
|
lda M32.TMP+1
|
|
|
|
|
sbc M32.ACC+1
|
|
|
|
|
pha
|
|
|
|
|
lda M32.TMP+2
|
|
|
|
|
sbc M32.ACC+2
|
2018-11-24 18:20:48 +00:00
|
|
|
|
pha
|
2019-04-01 06:07:56 +00:00
|
|
|
|
lda M32.TMP+3
|
|
|
|
|
sbc M32.ACC+3
|
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
pla
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
dex
|
2018-11-24 18:20:48 +00:00
|
|
|
|
bne .1
|
2019-04-01 06:07:56 +00:00
|
|
|
|
bra .3
|
2018-11-24 18:20:48 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
.2 sta M32.TMP+3
|
|
|
|
|
pla
|
|
|
|
|
sta M32.TMP+2
|
|
|
|
|
pla
|
|
|
|
|
sta M32.TMP+1
|
|
|
|
|
pla
|
|
|
|
|
sta M32.TMP
|
2018-11-24 18:20:48 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
inc M32.ARG bit0 always 0 because of .1 asl
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.3 plp
|
|
|
|
|
ldx #3
|
2018-11-24 18:20:48 +00:00
|
|
|
|
|
2018-11-24 22:25:33 +00:00
|
|
|
|
ldy #M32.ARG+3
|
2019-04-01 06:07:56 +00:00
|
|
|
|
bcc .4
|
|
|
|
|
ldy #M32.TMP+3
|
|
|
|
|
clc
|
2018-11-24 22:25:33 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
.4 lda $0,y
|
|
|
|
|
sta M32.ACC,x
|
2018-11-24 22:25:33 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
2019-04-01 06:07:56 +00:00
|
|
|
|
bpl .4
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
M32.ACC2ARG ldx #3 ACC->ARG
|
|
|
|
|
|
|
|
|
|
.1 lda M32.ACC,x
|
|
|
|
|
sta M32.ARG,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
M32.Cmp ldx #4
|
2018-11-24 22:25:33 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
ldy #0
|
2018-11-24 22:25:33 +00:00
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
.1 lda M32.ARG,y
|
|
|
|
|
sbc M32.ACC,y
|
|
|
|
|
sta M32.ACC,y
|
2018-11-24 22:25:33 +00:00
|
|
|
|
iny
|
|
|
|
|
dex
|
2019-04-01 06:07:56 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2018-11-24 22:25:33 +00:00
|
|
|
|
bcc .5 CC if ACC < ARG
|
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
lda M32.ACC
|
|
|
|
|
ora M32.ACC+1
|
|
|
|
|
ora M32.ACC+2
|
|
|
|
|
ora M32.ACC+3 Z if ACC = ARG
|
2018-11-24 22:25:33 +00:00
|
|
|
|
|
|
|
|
|
bne .4
|
|
|
|
|
|
2018-11-27 16:22:15 +00:00
|
|
|
|
lda #%010 010 ACC = ARG
|
2018-11-24 22:25:33 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2018-11-27 16:22:15 +00:00
|
|
|
|
.4 lda #%100 100 ACC > ARG
|
2018-11-24 22:25:33 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2018-11-27 16:22:15 +00:00
|
|
|
|
.5 lda #%001 001 ACC < ARG
|
2018-11-24 22:25:33 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-23 07:03:26 +00:00
|
|
|
|
MAN
|
2019-04-10 07:45:09 +00:00
|
|
|
|
SAVE USR/SRC/SHARED/X.M32.S
|
2019-02-21 11:34:28 +00:00
|
|
|
|
LOAD USR/SRC/BIN/SH.S
|
2018-11-27 14:03:26 +00:00
|
|
|
|
ASM
|