2213 lines
32 KiB
Plaintext
2213 lines
32 KiB
Plaintext
#define em_bsize 2 /* must be equal to EM_BSIZE */
|
|
#define ND !defined($1)
|
|
#define D defined($1)
|
|
#define BASE 240
|
|
#define MIN (0-BASE)
|
|
#define MAX (254-em_bsize-BASE)
|
|
#define IN(x) (x>=MIN && x<=MAX)
|
|
#define IND(x) (x>=MIN && x<=(MAX-2))
|
|
|
|
/*****************************************************\
|
|
**** ****
|
|
**** 6 5 0 0 B A C K E N D T A B L E ****
|
|
**** ****
|
|
\*****************************************************/
|
|
|
|
|
|
/*
|
|
* INTEGER SIZE: 16 bits
|
|
* POINTER SIZE: 16 bits
|
|
* NO FLOATS
|
|
*/
|
|
|
|
|
|
EM_WSIZE = 2
|
|
EM_PSIZE = 2
|
|
EM_BSIZE = 2
|
|
|
|
|
|
|
|
/*********************\
|
|
* R E G I S T E R S *
|
|
\*********************/
|
|
|
|
REGISTERS:
|
|
AA = ("a",1), REG.
|
|
XX = ("x",1), REG.
|
|
AX = ("<dummy>",2,AA,XX), R16.
|
|
|
|
/* AX is a registerpair, A contains the highbyte of a word and
|
|
* X contains the lowbyte
|
|
*/
|
|
|
|
|
|
/***************\
|
|
* T O K E N S *
|
|
\***************/
|
|
|
|
TOKENS:
|
|
IMMEDIATE = {INT off;} 1 "#%[off]" /* a fake token the
|
|
* cgg needs one
|
|
*/
|
|
|
|
|
|
|
|
/***********************************\
|
|
* T O K E N E X P R E S S I O N S *
|
|
\***********************************/
|
|
|
|
TOKENEXPRESSIONS:
|
|
AAA = IMMEDIATE /* a fake tokenexpression
|
|
* the cgg needs one
|
|
*/
|
|
|
|
|
|
/***********\
|
|
* C O D E *
|
|
\***********/
|
|
|
|
CODE:
|
|
|
|
/* GROUP 1 - LOAD */
|
|
|
|
loc ($1%256)==($1/256) | |
|
|
allocate(R16)
|
|
"lda #[$1].l"
|
|
"tax"
|
|
| %[a] | |
|
|
loc | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
| %[a] | |
|
|
ldc highw(1)==loww(1) && (loww(1)%256)==(loww(1)/256) | |
|
|
allocate(R16)
|
|
"lda #[%(loww(1)%)].l"
|
|
"tax"
|
|
"jsr Push"
|
|
| %[a] | |
|
|
ldc | |
|
|
allocate(R16)
|
|
"lda #[%(highw(1)%)].h"
|
|
"ldx #[%(highw(1)%)].l"
|
|
"jsr Push"
|
|
"lda #[%(loww(1)%)].h"
|
|
"ldx #[%(loww(1)%)].l"
|
|
| %[a] | |
|
|
lol IN($1) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
| %[a] | |
|
|
lol | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Lol"
|
|
| %[a] | |
|
|
loe | |
|
|
allocate(R16)
|
|
"lda $1+1"
|
|
"ldx $1"
|
|
| %[a] | |
|
|
lil IN($1) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"jsr Loi"
|
|
| %[a] | |
|
|
lil | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Lol"
|
|
"jsr Loi"
|
|
| %[a] | |
|
|
lof $1==0 | R16 |
|
|
"jsr Loi"
|
|
| %[1] | |
|
|
lof | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Adi2"
|
|
"jsr Loi"
|
|
| %[a] | |
|
|
lal | |
|
|
allocate(R16)
|
|
"clc"
|
|
"lda #[$1].l"
|
|
"adc LB"
|
|
"tax"
|
|
"lda #[$1].h"
|
|
"adc LB+1"
|
|
| %[a] | |
|
|
lae | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
| %[a] | |
|
|
lxl $1==0 | |
|
|
allocate(R16)
|
|
"lda LB+1"
|
|
"ldx LB"
|
|
| %[a] | |
|
|
lxl $1<=255 | | /* n restricted to a max of 255 */
|
|
allocate(R16)
|
|
"ldx #[$1].l"
|
|
"jsr Lxl"
|
|
| %[a] | |
|
|
lxa $1==0 | |
|
|
allocate(R16)
|
|
"jsr Lxa1"
|
|
| %[a] | |
|
|
lxa $1<=255 | | /* n restricted to a max of 255 */
|
|
allocate(R16)
|
|
"ldx #[$1].l"
|
|
"jsr Lxa2"
|
|
| %[a] | |
|
|
loi $1==1 | R16 |
|
|
"jsr Loi1"
|
|
| %[1] | |
|
|
loi $1==2 | R16 |
|
|
"jsr Loi"
|
|
| %[1] | |
|
|
loi $1==4 | R16 |
|
|
"jsr Ldi"
|
|
| | |
|
|
loi D | R16 |
|
|
"ldy #[$1].h"
|
|
"sty NBYTES+1"
|
|
"ldy #[$1].l"
|
|
"jsr Loil"
|
|
| | |
|
|
los $1==2 | R16 |
|
|
"jsr Los"
|
|
| | |
|
|
ldl IND($1) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1+3"
|
|
"lda (LBl),y"
|
|
"pha"
|
|
"dey"
|
|
"lda (LBl),y"
|
|
"tax"
|
|
"pla"
|
|
"jsr Push"
|
|
"dey"
|
|
"lda (LBl),y"
|
|
"pha"
|
|
"dey"
|
|
"lda (LBl),y"
|
|
"tax"
|
|
"pla"
|
|
| %[a] | |
|
|
ldl | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Locaddr"
|
|
"jsr Ldo"
|
|
| | |
|
|
lde | |
|
|
allocate(R16)
|
|
"lda $1+3"
|
|
"ldx $1+2"
|
|
"jsr Push"
|
|
"lda $1+1"
|
|
"ldx $1"
|
|
| %[a] | |
|
|
ldf $1==0 | R16 |
|
|
"jsr Ldi"
|
|
| | |
|
|
ldf | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Adi2"
|
|
"jsr Ldi"
|
|
| | |
|
|
lpi | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
| %[a] | |
|
|
|
|
|
|
/* GROUP 2 - STORE */
|
|
|
|
stl IN($1) | R16 |
|
|
"ldy #BASE+1+$1"
|
|
"sta (LBl),y"
|
|
"txa"
|
|
"dey"
|
|
"sta (LBl),y"
|
|
| | |
|
|
stl | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Stl"
|
|
| | |
|
|
ste | R16 |
|
|
"sta $1+1"
|
|
"stx $1"
|
|
| | |
|
|
sil IN($1) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"jsr Sti"
|
|
| | |
|
|
sil | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Lol"
|
|
"jsr Sti"
|
|
| | |
|
|
stf $1==0 | R16 |
|
|
"jsr Sti"
|
|
| | |
|
|
stf | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Adi2"
|
|
"jsr Sti"
|
|
| | |
|
|
sti $1==1 | R16 |
|
|
"jsr Sti1"
|
|
| | |
|
|
sti $1==2 | R16 |
|
|
"jsr Sti"
|
|
| | |
|
|
sti $1==4 | R16 |
|
|
"jsr Sdi"
|
|
| | |
|
|
sti D | R16 |
|
|
"ldy #[$1].h"
|
|
"sty NBYTES+1"
|
|
"ldy #[$1].l"
|
|
"jsr Stil"
|
|
| | |
|
|
sts $1==2 | R16 |
|
|
"jsr Sts"
|
|
| | |
|
|
sdl IND($1) | R16 |
|
|
"ldy #BASE+$1"
|
|
"pha"
|
|
"txa"
|
|
"sta (LBl),y"
|
|
"iny"
|
|
"pla"
|
|
"sta (LBl),y"
|
|
"jsr Pop"
|
|
"iny"
|
|
"pha"
|
|
"txa"
|
|
"sta (LBl),y"
|
|
"iny"
|
|
"pla"
|
|
"sta (LBl),y"
|
|
| | |
|
|
sdl | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Locaddr"
|
|
"jsr Sdo"
|
|
| | |
|
|
sde | R16 |
|
|
"sta $1+1"
|
|
"stx $1"
|
|
"jsr Pop"
|
|
"sta $1+3"
|
|
"stx $1+2"
|
|
| | |
|
|
sdf $1==0 | R16 |
|
|
"jsr Sdi"
|
|
| | |
|
|
sdf | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Adi2"
|
|
"jsr Sdi"
|
|
| | |
|
|
|
|
|
|
/* GROUP 3 - INTEGER ARITHMETIC */
|
|
|
|
loc lol adi (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$2"
|
|
"clc"
|
|
"lda #[$1].l"
|
|
"adc (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"lda #[$1].h"
|
|
"adc (LBl),y"
|
|
| %[a] | |
|
|
lol loc adi | | | | loc $2 lol $1 adi $3 |
|
|
lol lol adi (IN($1) && IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1+1"
|
|
"lda (LBl),y"
|
|
"pha"
|
|
"dey"
|
|
"lda (LBl),y"
|
|
"ldy #BASE+$2"
|
|
"clc"
|
|
"adc (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"pla"
|
|
"adc (LBl),y"
|
|
| %[a] | |
|
|
lol loe adi (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"clc"
|
|
"lda (LBl),y"
|
|
"adc $2"
|
|
"tax"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"adc $2+1"
|
|
| %[a] | |
|
|
loe lol adi | | | | lol $2 loe $1 adi $3 |
|
|
loe loe adi $3==2 | |
|
|
allocate(R16)
|
|
"clc"
|
|
"lda $1"
|
|
"adc $2"
|
|
"tax"
|
|
"lda $1+1"
|
|
"adc $2+1"
|
|
| %[a] | |
|
|
loc loe adi $3==2 | |
|
|
allocate(R16)
|
|
"clc"
|
|
"lda #[$1].l"
|
|
"adc $2"
|
|
"tax"
|
|
"lda #[$1].h"
|
|
"adc $2+1"
|
|
| %[a] | |
|
|
loe loc adi | | | | loc $2 loe $1 adi $3 |
|
|
ldl adi IND($1) && $2==2 | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"clc"
|
|
"lda (LBl),y"
|
|
"iny"
|
|
"iny"
|
|
"adc (LBl),y"
|
|
"tax"
|
|
"dey"
|
|
"lda (LBl),y"
|
|
"iny"
|
|
"iny"
|
|
"adc (LBl),y"
|
|
| %[a] | |
|
|
lde adi $2==2 | |
|
|
allocate(R16)
|
|
"clc"
|
|
"lda $1"
|
|
"adc $1+2"
|
|
"tax"
|
|
"lda $1+1"
|
|
"adc $1+3"
|
|
| %[a] | |
|
|
loc adi $2==2 | R16 |
|
|
"pha"
|
|
"txa"
|
|
"clc"
|
|
"adc #[$1].l"
|
|
"tax"
|
|
"pla"
|
|
"adc #[$1].h"
|
|
| %[1] | |
|
|
lol adi IN($1) && $2==2 | R16 |
|
|
"pha"
|
|
"ldy #BASE+$1"
|
|
"clc"
|
|
"txa"
|
|
"adc (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"pla"
|
|
"adc (LBl),y"
|
|
| %[1] | |
|
|
loe adi $2==2 | R16 |
|
|
"pha"
|
|
"clc"
|
|
"txa"
|
|
"adc $1"
|
|
"tax"
|
|
"pla"
|
|
"adc $1+1"
|
|
| %[1] | |
|
|
lol lol adi IN($1) && !IN($2) && $3==2
|
|
| | | | lol $2 lol $1 adi $3 |
|
|
adi $1==2 | R16 |
|
|
"jsr Adi2"
|
|
| %[1] | |
|
|
adi $1==4 | |
|
|
allocate(R16)
|
|
"jsr Adi4"
|
|
| | |
|
|
adi ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Adi2"
|
|
| %[1] | |
|
|
loc lol sbi (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"sec"
|
|
"lda #[$1].l"
|
|
"sbc (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"lda #[$1].h"
|
|
"sbc (LBl),y"
|
|
| %[a] | |
|
|
lol loc sbi | | | | lol $1 loc 0-$2 adi $3 |
|
|
lol lol sbi (IN($1) && IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1+1"
|
|
"lda (LBl),y"
|
|
"pha"
|
|
"dey"
|
|
"lda (LBl),y"
|
|
"ldy #BASE+$2"
|
|
"sec"
|
|
"sbc (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"pla"
|
|
"sbc (LBl),y"
|
|
| %[a] | |
|
|
lol loe sbi (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"sec"
|
|
"lda (LBl),y"
|
|
"sbc $2"
|
|
"tax"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sbc $2+1"
|
|
| %[a] | |
|
|
loe lol sbi (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"sec"
|
|
"lda $2"
|
|
"sbc (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"lda $2+1"
|
|
"sbc (LBl),y"
|
|
| %[a] | |
|
|
loe loe sbi $3==2 | |
|
|
allocate(R16)
|
|
"sec"
|
|
"lda $1"
|
|
"sbc $2"
|
|
"tax"
|
|
"lda $1+1"
|
|
"sbc $2+1"
|
|
| %[a] | |
|
|
loc loe sbi $3==2 | |
|
|
allocate(R16)
|
|
"sec"
|
|
"lda #[$1].l"
|
|
"sbc $2"
|
|
"tax"
|
|
"lda #[$1].h"
|
|
"sbc $2+1"
|
|
| %[a] | |
|
|
loe loc sbi | | | | loe $1 loc 0-$2 adi $3 |
|
|
ldl sbi IND($1) && $2==2 | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1+2"
|
|
"sec"
|
|
"lda (LBl),y"
|
|
"dey"
|
|
"dey"
|
|
"sbc (LBl),y"
|
|
"tax"
|
|
"ldy #BASE+$1+3"
|
|
"lda (LBl),y"
|
|
"dey"
|
|
"dey"
|
|
"sbc (LBl),y"
|
|
| %[a] | |
|
|
lde sbi $2==2 | |
|
|
allocate(R16)
|
|
"sec"
|
|
"lda $1+2"
|
|
"sbc $1"
|
|
"tax"
|
|
"lda $1+3"
|
|
"sbc $1"
|
|
| %[a] | |
|
|
loc sbi $2==2 | R16 |
|
|
"pha"
|
|
"txa"
|
|
"sec"
|
|
"sbc #[$1].l"
|
|
"tax"
|
|
"pla"
|
|
"sbc #[$1].h"
|
|
| %[1] | |
|
|
lol sbi IN($1) && $2==2 | R16 |
|
|
"pha"
|
|
"ldy #BASE+$1"
|
|
"sec"
|
|
"txa"
|
|
"sbc (LBl),y"
|
|
"tax"
|
|
"iny"
|
|
"pla"
|
|
"sbc #[$1].h"
|
|
| %[1] | |
|
|
loe sbi $2==2 | R16 |
|
|
"pha"
|
|
"sec"
|
|
"txa"
|
|
"sbc $1"
|
|
"tax"
|
|
"pla"
|
|
"sbc $1+1"
|
|
| %[1] | |
|
|
sbi $1==2 | R16 |
|
|
"jsr Sbi2"
|
|
| %[1] | |
|
|
sbi $1==4 | |
|
|
allocate(R16)
|
|
"jsr Sbi4"
|
|
| | |
|
|
sbi ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Sbi2"
|
|
| %[1] | |
|
|
loc lol mli (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"lda #[$1].l"
|
|
"sta ARTH"
|
|
"lda #[$1].h"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[a] | |
|
|
lol loc mli | | | | loc $2 lol $1 mli $3 |
|
|
lol lol mli (IN($1) && IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[a] | |
|
|
lol loe mli (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[a] | |
|
|
loe lol mli (IN($2) && $3==2) | | | | lol $2 loe $1 mli $3 |
|
|
loe loe mli $3==2 | |
|
|
allocate(R16)
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[a] | |
|
|
loc loe mli $3==2 | |
|
|
allocate(R16)
|
|
"lda #[$1].l"
|
|
"sta ARTH"
|
|
"lda #[$1].h"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[a] | |
|
|
loe loc mli | | | | loc $2 loe $1 mli $3 |
|
|
ldl mli IND($1) && $2==2 | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[a] | |
|
|
lde mli $2==2 | |
|
|
allocate(R16)
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"lda $1+2"
|
|
"sta ARTH+2"
|
|
"lda $1+3"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[a] | |
|
|
loc mli $2==2 | R16 |
|
|
"stx ARTH"
|
|
"sta ARTH+1"
|
|
"lda #[$1].l"
|
|
"sta ARTH+2"
|
|
"lda #[$1].h"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[1] | |
|
|
lol mli IN($1) && $2==2 | R16 |
|
|
"stx ARTH"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[1] | |
|
|
loe mli $2==2 | R16 |
|
|
"stx ARTH"
|
|
"sta ARTH+1"
|
|
"lda $1"
|
|
"sta ARTH+2"
|
|
"lda $1+1"
|
|
"sta ARTH+3"
|
|
"jsr Mlinp"
|
|
| %[1] | |
|
|
lol lol mli IN($1) && !IN($2) && $3==2
|
|
| | | | lol $2 lol $1 mli $3 |
|
|
mli $1==2 | R16 |
|
|
"jsr Mli2"
|
|
| %[1] | |
|
|
mli $1==4 | |
|
|
allocate(R16)
|
|
"jsr Mli4"
|
|
| | |
|
|
mli ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Mli2"
|
|
| %[1] | |
|
|
loc lol dvi (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"lda #[$1].l"
|
|
"sta ARTH+2"
|
|
"lda #[$1].h"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
lol loc dvi (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"lda #[$2].l"
|
|
"sta ARTH"
|
|
"lda #[$2].h"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
lol lol dvi (IN($1) && IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
lol loe dvi (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"lda $2"
|
|
"sta ARTH"
|
|
"lda $2+1"
|
|
"sta ARTH+1"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
loe lol dvi (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
loe loe dvi $3==2 | |
|
|
allocate(R16)
|
|
"lda $2"
|
|
"sta ARTH"
|
|
"lda $2+1"
|
|
"sta ARTH+1"
|
|
"lda $1"
|
|
"sta ARTH+2"
|
|
"lda $1+1"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
loc loe dvi $3==2 | |
|
|
allocate(R16)
|
|
"lda #[$1].l"
|
|
"sta ARTH+2"
|
|
"lda #[$1].h"
|
|
"sta ARTH+3"
|
|
"lda $2"
|
|
"sta ARTH"
|
|
"lda $2+1"
|
|
"sta ARTH+1"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
loe loc dvi $3==2 | |
|
|
allocate(R16)
|
|
"lda #[$2].l"
|
|
"sta ARTH"
|
|
"lda #[$2].h"
|
|
"sta ARTH+1"
|
|
"lda $1"
|
|
"sta ARTH+2"
|
|
"lda $1+1"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
ldl dvi IND($1) && $2==2 | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
lde dvi $2==2 | |
|
|
allocate(R16)
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"lda $1+2"
|
|
"sta ARTH+2"
|
|
"lda $1+3"
|
|
"sta ARTH+3"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[a] | |
|
|
loc dvi $2==2 | R16 |
|
|
"stx ARTH+2"
|
|
"sta ARTH+3"
|
|
"lda #[$1].l"
|
|
"sta ARTH"
|
|
"lda #[$1].h"
|
|
"sta ARTH+1"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[1] | |
|
|
lol dvi IN($1) && $2==2 | R16 |
|
|
"stx ARTH+2"
|
|
"sta ARTH+3"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[1] | |
|
|
loe dvi $2==2 | R16 |
|
|
"stx ARTH+2"
|
|
"sta ARTH+3"
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"ldy #1"
|
|
"sty UNSIGN"
|
|
"jsr Div"
|
|
| %[1] | |
|
|
dvi $1==2 | R16 |
|
|
"jsr Dvi2"
|
|
| %[1] | |
|
|
dvi $1==4 | |
|
|
allocate(R16)
|
|
"jsr Dvi4"
|
|
| | |
|
|
dvi ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Dvi2"
|
|
| %[1] | |
|
|
rmi $1==2 | R16 |
|
|
"jsr Rmi2"
|
|
| %[1] | |
|
|
rmi $1==4 | |
|
|
allocate(R16)
|
|
"jsr Rmi4"
|
|
| | |
|
|
rmi ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Rmi2"
|
|
| %[1] | |
|
|
ngi $1==2 | R16 |
|
|
"jsr Ngi2"
|
|
| %[1] | |
|
|
ngi $1==4 | |
|
|
allocate(R16)
|
|
"lda SP+1"
|
|
"ldx SP+2"
|
|
"jsr Ngi4"
|
|
| | |
|
|
ngi ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Ngi2"
|
|
| %[1] | |
|
|
sli $1==2 | R16 |
|
|
"jsr Sli2"
|
|
| %[1] | |
|
|
sli $1==4 | R16 |
|
|
"jsr Sli4"
|
|
| | |
|
|
sli ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Sli2"
|
|
| %[1] | |
|
|
sri $1==2 | R16 |
|
|
"jsr Sri2"
|
|
| %[1] | |
|
|
sri $1==4 | R16 |
|
|
"jsr Sri4"
|
|
| | |
|
|
sri ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Sri2"
|
|
| %[1] | |
|
|
|
|
|
|
/* GROUP 4 - UNSIGNED ARITHMETIC */
|
|
|
|
loc lol adu | | | | loc $1 lol $2 adi $3 |
|
|
lol loc adu | | | | lol $1 loc $2 adi $3 |
|
|
lol lol adu | | | | lol $1 lol $2 adi $3 |
|
|
lol loe adu | | | | lol $1 loe $2 adi $3 |
|
|
loe lol adu | | | | loe $1 lol $2 adi $3 |
|
|
loe loe adu | | | | loe $1 loe $2 adi $3 |
|
|
loc loe adu | | | | loc $1 loe $2 adi $3 |
|
|
loe loc adu | | | | loe $1 loc $2 adi $3 |
|
|
ldl adu | | | | ldl $1 adi $2 |
|
|
lde adu | | | | lde $1 adi $2 |
|
|
loc adu | | | | loc $1 adi $2 |
|
|
lol adu | | | | lol $1 adi $2 |
|
|
loe adu | | | | loe $1 adi $2 |
|
|
adu | | | | adi $1 |
|
|
|
|
loc lol sbu | | | | loc $1 lol $2 sbi $3 |
|
|
lol loc sbu | | | | lol $1 loc $2 sbi $3 |
|
|
lol lol sbu | | | | lol $1 lol $2 sbi $3 |
|
|
lol loe sbu | | | | lol $1 loe $2 sbi $3 |
|
|
loe lol sbu | | | | loe $1 lol $2 sbi $3 |
|
|
loe loe sbu | | | | loe $1 loe $2 sbi $3 |
|
|
loc loe sbu | | | | loc $1 loe $2 sbi $3 |
|
|
loe loc sbu | | | | loe $1 loc $2 sbi $3 |
|
|
ldl sbu | | | | ldl $1 sbi $2 |
|
|
lde sbu | | | | lde $1 sbi $2 |
|
|
loc sbu | | | | loc $1 sbi $2 |
|
|
lol sbu | | | | lol $1 sbi $2 |
|
|
loe sbu | | | | loe $1 sbi $2 |
|
|
sbu | | | | sbi $1 |
|
|
|
|
loc lol mlu (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"lda #[$1].l"
|
|
"sta ARTH"
|
|
"lda #[$1].h"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[a] | |
|
|
lol loc mlu | | | | loc $2 lol $1 mlu $3 |
|
|
lol lol mlu (IN($1) && IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[a] | |
|
|
lol loe mlu (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[a] | |
|
|
loe lol mlu (IN($2) && $3==2) | | | | lol $2 loe $1 mlu $3 |
|
|
loe loe mlu $3==2 | |
|
|
allocate(R16)
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[a] | |
|
|
loc loe mlu $3==2 | |
|
|
allocate(R16)
|
|
"lda #[$1].l"
|
|
"sta ARTH"
|
|
"lda #[$1].h"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[a] | |
|
|
loe loc mlu | | | | loc $2 loe $1 mlu $3 |
|
|
ldl mlu IND($1) && $2==2 | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[a] | |
|
|
lde mlu $2==2 | |
|
|
allocate(R16)
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"lda $1+2"
|
|
"sta ARTH+2"
|
|
"lda $1+3"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[a] | |
|
|
loc mlu $2==2 | R16 |
|
|
"stx ARTH"
|
|
"sta ARTH+1"
|
|
"lda #[$1].l"
|
|
"sta ARTH+2"
|
|
"lda #[$1].h"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[1] | |
|
|
lol mlu IN($1) && $2==2 | R16 |
|
|
"stx ARTH"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[1] | |
|
|
loe mlu $2==2 | R16 |
|
|
"stx ARTH"
|
|
"sta ARTH+1"
|
|
"lda $1"
|
|
"sta ARTH+2"
|
|
"lda $1+1"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Mul"
|
|
| %[1] | |
|
|
lol lol mlu IN($1) && !IN($2) && $3==2
|
|
| | | | lol $2 lol $1 mlu $3 |
|
|
mlu $1==2 | R16 |
|
|
"jsr Mlu2"
|
|
| %[1] | |
|
|
mlu $1==4 | |
|
|
allocate(R16)
|
|
"jsr Mlu4"
|
|
| | |
|
|
mlu ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Mlu2"
|
|
| %[1] | |
|
|
|
|
loc lol dvu (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"lda #[$1].l"
|
|
"sta ARTH+2"
|
|
"lda #[$1].h"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
lol loc dvu (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"lda #[$2].l"
|
|
"sta ARTH"
|
|
"lda #[$2].h"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
lol lol dvu (IN($1) && IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
lol loe dvu (IN($1) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"lda $2"
|
|
"sta ARTH"
|
|
"lda $2+1"
|
|
"sta ARTH+1"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
loe lol dvu (IN($2) && $3==2) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$2"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"lda $2"
|
|
"sta ARTH+2"
|
|
"lda $2+1"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
loe loe dvu $3==2 | |
|
|
allocate(R16)
|
|
"lda $2"
|
|
"sta ARTH"
|
|
"lda $2+1"
|
|
"sta ARTH+1"
|
|
"lda $1"
|
|
"sta ARTH+2"
|
|
"lda $1+1"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
loc loe dvu $3==2 | |
|
|
allocate(R16)
|
|
"lda #[$1].l"
|
|
"sta ARTH+2"
|
|
"lda #[$1].h"
|
|
"sta ARTH+3"
|
|
"lda $2"
|
|
"sta ARTH"
|
|
"lda $2+1"
|
|
"sta ARTH+1"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
loe loc dvu $3==2 | |
|
|
allocate(R16)
|
|
"lda #[$2].l"
|
|
"sta ARTH"
|
|
"lda #[$2].h"
|
|
"sta ARTH+1"
|
|
"lda $1"
|
|
"sta ARTH+2"
|
|
"lda $1+1"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
ldl dvu IND($1) && $2==2 | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+2"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
lde dvu $2==2 | |
|
|
allocate(R16)
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"lda $1+2"
|
|
"sta ARTH+2"
|
|
"lda $1+3"
|
|
"sta ARTH+3"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[a] | |
|
|
loc dvu $2==2 | R16 |
|
|
"stx ARTH+2"
|
|
"sta ARTH+3"
|
|
"lda #[$1].l"
|
|
"sta ARTH"
|
|
"lda #[$1].h"
|
|
"sta ARTH+1"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[1] | |
|
|
lol dvu IN($1) && $2==2 | R16 |
|
|
"stx ARTH+2"
|
|
"sta ARTH+3"
|
|
"ldy #BASE+$1"
|
|
"lda (LBl),y"
|
|
"sta ARTH"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sta ARTH+1"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[1] | |
|
|
loe dvu $2==2 | R16 |
|
|
"stx ARTH+2"
|
|
"sta ARTH+3"
|
|
"lda $1"
|
|
"sta ARTH"
|
|
"lda $1+1"
|
|
"sta ARTH+1"
|
|
"ldy #0"
|
|
"sty UNSIGN"
|
|
"jsr Duv"
|
|
| %[1] | |
|
|
dvu $1==2 | R16 |
|
|
"jsr Dvu2"
|
|
| %[1] | |
|
|
dvu $1==4 | |
|
|
allocate(R16)
|
|
"jsr Dvu4"
|
|
| | |
|
|
dvu ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Dvu2"
|
|
| %[1] | |
|
|
|
|
rmu $1==2 | R16 |
|
|
"jsr Rmu2"
|
|
| %[1] | |
|
|
rmu $1==4 | |
|
|
allocate(R16)
|
|
"jsr Rmu4"
|
|
| | |
|
|
slu | | | | sli $1 |
|
|
sru $1==2 | R16 |
|
|
"jsr Sru2"
|
|
| %[1] | |
|
|
sru $1==4 | R16 |
|
|
"jsr Sru4"
|
|
| | |
|
|
sru ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Sru2"
|
|
| %[1] | |
|
|
|
|
|
|
/* GROUP 6 - POINTER ARITHMETIC */
|
|
|
|
adp $1==0 | | | | |
|
|
adp | | | | loc $1 adi 2 |
|
|
ads $1==2 | R16 |
|
|
"jsr Adi2"
|
|
| %[1] | |
|
|
ads ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Adi2"
|
|
| %[1] | |
|
|
sbs $1==2 | R16 |
|
|
"jsr Sbi2"
|
|
| %[1] | |
|
|
sbs ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Sbi2"
|
|
| %[1] | |
|
|
|
|
|
|
/* GROUP 7 INCREMENT/DECREMENT/ZERO */
|
|
|
|
inc | R16 |
|
|
"inx"
|
|
"bne 1f"
|
|
"clc"
|
|
"adc #1\n1:"
|
|
| %[1] | |
|
|
inl IN($1) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"clc"
|
|
"lda (LBl),y"
|
|
"adc #1"
|
|
"sta (LBl),y"
|
|
"bcc 1f"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"adc #0"
|
|
"sta (LBl),y\n1:"
|
|
| | |
|
|
inl D | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Lol"
|
|
"inx"
|
|
"bne 1f"
|
|
"clc"
|
|
"adc #1"
|
|
"1: jsr Stii"
|
|
| | |
|
|
ine | |
|
|
"inc $1"
|
|
"bne 1f"
|
|
"inc $1+1\n1:"
|
|
| | |
|
|
dec | R16 |
|
|
"cpx #0"
|
|
"bne 1f"
|
|
"sec"
|
|
"sbc #1"
|
|
"1: dex"
|
|
| %[1] | |
|
|
del IN($1) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"sec"
|
|
"lda (LBl),y"
|
|
"sbc #1"
|
|
"sta (LBl),y"
|
|
"bcs 1f"
|
|
"iny"
|
|
"lda (LBl),y"
|
|
"sbc #0"
|
|
"sta (LBl),y\n1:"
|
|
| | |
|
|
del | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Lol"
|
|
"cpx #0"
|
|
"bne 1f"
|
|
"sec"
|
|
"sbc #1"
|
|
"1: dex"
|
|
"jsr Stii"
|
|
| | |
|
|
dee | |
|
|
"ldy $1"
|
|
"bne 1f"
|
|
"dec $1+1"
|
|
"1: dey"
|
|
"sty $1"
|
|
| | |
|
|
zrl IN($1) | |
|
|
allocate(R16)
|
|
"ldy #BASE+$1"
|
|
"lda #0"
|
|
"sta (LBl),y"
|
|
"iny"
|
|
"sta (LBl),y"
|
|
| | |
|
|
zrl | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Zrl"
|
|
| | |
|
|
zre | |
|
|
"ldy #0"
|
|
"sty $1"
|
|
"sty $1+1"
|
|
| | |
|
|
zer $1==2 | |
|
|
allocate(R16)
|
|
"lda #0"
|
|
"tax"
|
|
| %[a] | |
|
|
zer $1==4 | |
|
|
allocate(R16)
|
|
"lda #0"
|
|
"tax"
|
|
"jsr Push"
|
|
| %[a] | |
|
|
zer $1>0 && $1<=256 | |
|
|
allocate(R16)
|
|
"ldy #$1-1"
|
|
"jsr Zer"
|
|
| | |
|
|
|
|
|
|
/* GROUP 8 - CONVERT (stack: source, source size, dest. size (top)) */
|
|
|
|
loc loc cii $1==1 && $2==2 | R16 |
|
|
"txa"
|
|
"bpl 1f"
|
|
"lda #0FFh"
|
|
"bne 2f"
|
|
"1: lda #0\n2:"
|
|
| %[1] | |
|
|
cii | R16 |
|
|
"jsr Cii"
|
|
| | |
|
|
cui | | | | cii |
|
|
ciu | | | | cii |
|
|
cuu | | | | asp 4 |
|
|
|
|
|
|
/* GROUP 9 - LOGICAL */
|
|
|
|
and $1==2 | R16 |
|
|
"sta ARTH+1"
|
|
"stx ARTH"
|
|
"jsr Pop"
|
|
"and ARTH+1"
|
|
"pha"
|
|
"txa"
|
|
"and ARTH"
|
|
"tax"
|
|
"pla"
|
|
| %[1] | |
|
|
and $1<=254 | |
|
|
allocate(R16)
|
|
"ldy #[$1].l"
|
|
"jsr And"
|
|
| | |
|
|
and ND | R16 |
|
|
"jsr TestFFh"
|
|
"jsr Pop"
|
|
"iny"
|
|
"jsr And"
|
|
| | |
|
|
ior $1==2 | R16 |
|
|
"sta ARTH+1"
|
|
"stx ARTH"
|
|
"jsr Pop"
|
|
"ora ARTH+1"
|
|
"pha"
|
|
"txa"
|
|
"ora ARTH"
|
|
"tax"
|
|
"pla"
|
|
| %[1] | |
|
|
ior $1<=254 | |
|
|
allocate(R16)
|
|
"ldy #[$1].l"
|
|
"jsr Ior"
|
|
| | |
|
|
ior ND | R16 |
|
|
"jsr TestFFh"
|
|
"jsr Pop"
|
|
"iny"
|
|
"jsr Ior"
|
|
| | |
|
|
xor $1==2 | R16 |
|
|
"sta ARTH+1"
|
|
"stx ARTH"
|
|
"jsr Pop"
|
|
"eor ARTH+1"
|
|
"pha"
|
|
"txa"
|
|
"eor ARTH"
|
|
"tax"
|
|
"pla"
|
|
| %[1] | |
|
|
xor $1<=254 | |
|
|
allocate(R16)
|
|
"ldy #[$1].l"
|
|
"jsr Xor"
|
|
| | |
|
|
xor ND | R16 |
|
|
"jsr TestFFh"
|
|
"jsr Pop"
|
|
"iny"
|
|
"jsr Xor"
|
|
| | |
|
|
com $1==2 | R16 |
|
|
"eor #0FFh"
|
|
"pha"
|
|
"txa"
|
|
"eor #0FFh"
|
|
"tax"
|
|
"pla"
|
|
| %[1] | |
|
|
com $1<=254 | |
|
|
allocate(R16)
|
|
"ldy #[$1].l"
|
|
"jsr Com"
|
|
| | |
|
|
com ND | R16 |
|
|
"jsr TestFFh"
|
|
"jsr Pop"
|
|
"iny"
|
|
"jsr Com"
|
|
| | |
|
|
rol $1==2 | R16 |
|
|
"jsr Rol"
|
|
| %[1] | |
|
|
rol $1==4 | R16 |
|
|
"jsr Rol4"
|
|
| | |
|
|
rol ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Rolw"
|
|
| %[1] | |
|
|
ror $1==2 | R16 |
|
|
"jsr Ror"
|
|
| %[1] | |
|
|
ror $1==4 | R16 |
|
|
"jsr Ror4"
|
|
| | |
|
|
ror ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Rorw"
|
|
| %[1] | |
|
|
|
|
|
|
/* GROUP 10 - SETS */
|
|
|
|
loc inn $1<0 && $2==2 | R16 |
|
|
"lda #0"
|
|
"tax"
|
|
| %[1] | |
|
|
loc inn $2==2 && $1==0 | R16 |
|
|
"txa"
|
|
"and #1"
|
|
"tax"
|
|
"lda #0"
|
|
| %[1] | |
|
|
loc inn $2==2 && $1>0 && $1<16 | R16 |
|
|
"ldy #$1"
|
|
"stx ARTH"
|
|
"1: lsr a"
|
|
"ror ARTH"
|
|
"dey"
|
|
"bne 1b"
|
|
"lda ARTH"
|
|
"and #1"
|
|
"tax"
|
|
"lda #0"
|
|
| %[1] | |
|
|
loc inn zeq $1>0 && $1<16 && $2==2 | R16 |
|
|
"ldy #$1+1"
|
|
"stx ARTH"
|
|
"1: lsr a"
|
|
"ror ARTH"
|
|
"dey"
|
|
"bne 1b"
|
|
"bcc $1"
|
|
| | |
|
|
loc inn zne $1>0 && $1<16 && $2==2 | R16 |
|
|
"ldy #$1+1"
|
|
"stx ARTH"
|
|
"1: lsr a"
|
|
"ror ARTH"
|
|
"dey"
|
|
"bne 1b"
|
|
"bcs $1"
|
|
| | |
|
|
inn $1==2 | R16 |
|
|
"txa"
|
|
"tay"
|
|
"jsr Pop"
|
|
"stx ARTH"
|
|
"1: lsr a"
|
|
"ror ARTH"
|
|
"dey"
|
|
"bne 1b"
|
|
"lda ARTH"
|
|
"and #1"
|
|
"tax"
|
|
"lda #0"
|
|
| %[1] | |
|
|
inn zeq $1==2 | R16 |
|
|
"txa"
|
|
"tay"
|
|
"jsr Pop"
|
|
"stx ARTH"
|
|
"1: lsr a"
|
|
"ror ARTH"
|
|
"dey"
|
|
"bpl 1b"
|
|
"lda ARTH"
|
|
"bcc $2"
|
|
| %[1] | |
|
|
inn zne $1==2 | R16 |
|
|
"txa"
|
|
"tay"
|
|
"jsr Pop"
|
|
"stx ARTH"
|
|
"1: lsr a"
|
|
"ror ARTH"
|
|
"dey"
|
|
"bpl 1b"
|
|
"bcs $2"
|
|
| %[1] | |
|
|
inn $1<=256 | R16 |
|
|
"ldy #$1-1"
|
|
"jsr Inn"
|
|
| %[1] | |
|
|
inn ND | R16 |
|
|
"jsr TestFFh"
|
|
"jsr Pop"
|
|
"jsr Inn"
|
|
| %[1] | |
|
|
loc set $2==2 && $1>=0 && $1<16 | |
|
|
allocate(R16)
|
|
"ldy #$1"
|
|
"lda #0"
|
|
"sta ARTH"
|
|
"sec"
|
|
"1: rol ARTH"
|
|
"rol a"
|
|
"dey"
|
|
"bpl 1b"
|
|
"ldx ARTH"
|
|
| %[a] | |
|
|
set $1==2 | R16 |
|
|
"txa"
|
|
"tay"
|
|
"lda #0"
|
|
"sta ARTH"
|
|
"sec"
|
|
"1: rol ARTH"
|
|
"rol a"
|
|
"bpl 1b"
|
|
"ldx ARTH"
|
|
| %[1] | |
|
|
set $1<=256 | R16 |
|
|
"ldy #$1-1"
|
|
"jsr Set"
|
|
| | |
|
|
set ND | R16 |
|
|
"jsr TestFFh"
|
|
"jsr Pop"
|
|
"jsr Set"
|
|
| | |
|
|
|
|
|
|
/* GROUP 11 - ARRAY */
|
|
|
|
lae lar defined(rom(1,3)) | | | | lae $1 aar $2 loi rom(1,3) |
|
|
lar $1==2 | R16 |
|
|
"jsr Lar"
|
|
| | |
|
|
lar ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Lar"
|
|
| | |
|
|
lae sar defined(rom(1,3)) | | | | lae $1 aar $2 sti rom(1,3) |
|
|
sar $1==2 | R16 |
|
|
"jsr Sar"
|
|
| | |
|
|
sar ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Sar"
|
|
| | |
|
|
lae aar $2==2 && rom(1,3)==1 && rom(1,1)==0 | | | | adi 2 |
|
|
lae aar $2==2 && rom(1,3)==1 && rom(1,1)!=0 | |
|
|
| | adi 2 adp 0-rom(1,1) |
|
|
lae aar $2==2 && rom(1,3)==2 && rom(1,1)==0 | R16 |
|
|
"pha"
|
|
"txa"
|
|
"asl a"
|
|
"tax"
|
|
"pla"
|
|
"rol a"
|
|
| %[1] | adi 2 |
|
|
lae aar $2==2 && rom(1,3)==2 && rom(1,1)!=0 | R16 |
|
|
"pha"
|
|
"txa"
|
|
"asl a"
|
|
"tax"
|
|
"pla"
|
|
"rol a"
|
|
| %[1] | adi 2 adp (0-rom(1,1))*2 |
|
|
lae aar $2==2 && rom(1,3)>2 && rom(1,1)==0 | |
|
|
| | loc rom(1,3) mli 2 adi 2 |
|
|
lae aar $2==2 && rom(1,3)>2 && rom(1,1)!=0 | |
|
|
| | loc rom(1,3) mli 2 adi 2 adp (0-rom(1,1))*rom(1,3) |
|
|
aar $1==2 | R16 |
|
|
"jsr Aar"
|
|
| %[1] | |
|
|
aar ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Aar"
|
|
| %[1] | |
|
|
|
|
|
|
/* GROUP 12 - COMPARE */
|
|
|
|
cmi $1==2 | R16 |
|
|
"jsr Cmi"
|
|
| %[1] | |
|
|
cmi $1==4 | |
|
|
allocate(R16)
|
|
"jsr Cmi4"
|
|
| %[a] | |
|
|
cmi ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Cmi"
|
|
| %[1] | |
|
|
cmu $1==2 | R16 |
|
|
"jsr Cmu2"
|
|
| %[1] | |
|
|
cmu $1==4 | |
|
|
allocate(R16)
|
|
"jsr Cmu4"
|
|
| %[a] | |
|
|
cmu ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Cmu"
|
|
| | |
|
|
cmp | |
|
|
| | cmu 2 |
|
|
cms $1==2 | |
|
|
allocate(R16)
|
|
"ldy #2"
|
|
"jsr Cms"
|
|
| %[a] | |
|
|
cms $1==4 | |
|
|
allocate(R16)
|
|
"ldy #4"
|
|
"jsr Cms"
|
|
| %[a] | |
|
|
cms ND | R16 |
|
|
"jsr TestFFh"
|
|
"iny"
|
|
"jsr Cms"
|
|
| %[1] | |
|
|
tlt | R16 |
|
|
"jsr Tlt"
|
|
| %[1] | |
|
|
tle | R16 |
|
|
"jsr Tle"
|
|
| %[1] | |
|
|
teq | R16 |
|
|
"jsr Teq"
|
|
| %[1] | |
|
|
tne | R16 |
|
|
"jsr Tne"
|
|
| %[1] | |
|
|
tge | R16 |
|
|
"jsr Tge"
|
|
| %[1] | |
|
|
tgt | R16 |
|
|
"jsr Tgt"
|
|
| %[1] | |
|
|
|
|
|
|
/* GROUP 13 - BRANCH */
|
|
|
|
bra | |
|
|
remove(ALL)
|
|
"jmp $1"
|
|
| | |
|
|
|
|
blt | R16 |
|
|
"jsr Sbi2"
|
|
"bmi $1"
|
|
| | |
|
|
ble | R16 |
|
|
"jsr Sbi2"
|
|
"bmi $1"
|
|
"bne 1f"
|
|
"txa"
|
|
"beq $1\n1:"
|
|
| | |
|
|
beq | R16 |
|
|
"sta BRANCH+1"
|
|
"stx BRANCH"
|
|
"jsr Pop"
|
|
"cmp BRANCH+1"
|
|
"bne 1f"
|
|
"cpx BRANCH"
|
|
"beq $1\n1:"
|
|
| | |
|
|
bne | R16 |
|
|
"sta BRANCH+1"
|
|
"stx BRANCH"
|
|
"jsr Pop"
|
|
"cmp BRANCH+1"
|
|
"bne $1"
|
|
"cpx BRANCH"
|
|
"bne $1"
|
|
| | |
|
|
bge | R16 |
|
|
"jsr Sbi2"
|
|
"bpl $1"
|
|
| | |
|
|
bgt | R16 |
|
|
"jsr Sbi2"
|
|
"bmi 1f"
|
|
"bne $1"
|
|
"txa"
|
|
"bne $1\n1:"
|
|
| | |
|
|
|
|
cmi zlt $1==2 | | | | blt $2 |
|
|
cmp zlt | | | | blt $2 |
|
|
zlt | R16 |
|
|
"tay"
|
|
"bmi $1"
|
|
| | |
|
|
cmi zle $1==2 | | | | ble $2 |
|
|
cmp zle | | | | ble $2 |
|
|
zle | R16 |
|
|
"tay"
|
|
"bmi $1"
|
|
"bne 1f"
|
|
"txa"
|
|
"beq $1\n1:"
|
|
| | |
|
|
cmi zeq $1==2 | | | | beq $2 |
|
|
cmp zeq | | | | beq $2 |
|
|
cms zeq $1==2 | | | | beq $2 |
|
|
zeq | R16 |
|
|
"tay"
|
|
"bne 1f"
|
|
"txa"
|
|
"beq $1\n1:"
|
|
| | |
|
|
cmi zne $1==2 | | | | bne $2 |
|
|
cmp zne | | | | bne $2 |
|
|
cms zne $1==2 | | | | bne $2 |
|
|
zne | R16 |
|
|
"tay"
|
|
"bne $1"
|
|
"txa"
|
|
"bne $1"
|
|
| | |
|
|
cmi zge $1==2 | | | | bge $2 |
|
|
cmp zge | | | | bge $2 |
|
|
zge | R16 |
|
|
"tay"
|
|
"bpl $1"
|
|
| | |
|
|
cmi zgt $1==2 | | | | bgt $2 |
|
|
cmp zgt | | | | bgt $2 |
|
|
zgt | R16 |
|
|
"tay"
|
|
"bmi 1f"
|
|
"bne $1"
|
|
"txa"
|
|
"bne $1\n1:"
|
|
| | |
|
|
|
|
|
|
/* GROUP 14 - PROCEDURE CALL */
|
|
|
|
cai | R16 |
|
|
"stx ADDR"
|
|
"sta ADDR+1"
|
|
"jsr Indir"
|
|
| | |
|
|
cal | |
|
|
remove(ALL)
|
|
"jsr $1"
|
|
| | |
|
|
lfr $1==2 | |
|
|
allocate(R16)
|
|
"lda #0"
|
|
"ldx #RETURN"
|
|
"jsr Loi"
|
|
| %[a] | |
|
|
lfr $1==4 | |
|
|
allocate(R16)
|
|
"lda #0"
|
|
"ldx #RETURN"
|
|
"jsr Ldi"
|
|
| | |
|
|
lfr ret $1==$2 | | | | ret 0 |
|
|
asp lfr ret $2==$3 | | | | ret 0 |
|
|
ret $1==0 || $1==2 || $1==4 | |
|
|
allocate(R16)
|
|
"ldy #$1"
|
|
"jmp Ret"
|
|
| | |
|
|
|
|
|
|
/* GROUP 15 - MISCELLANOUS */
|
|
|
|
asp | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jsr Asp"
|
|
| | |
|
|
ass $1==2 | R16 |
|
|
"jsr Asp"
|
|
| | |
|
|
ass ND | R16 |
|
|
"jsr Test2"
|
|
"jsr Pop"
|
|
"jsr Asp"
|
|
| | |
|
|
blm $1==0 | | | | asp 4 |
|
|
blm D | R16 |
|
|
"ldy #[[$1].h+1]"
|
|
"sty NBYTES+1"
|
|
"ldy #[$1].l"
|
|
"jsr Blm"
|
|
| | |
|
|
bls $1==2 | R16 |
|
|
"sta NBYTES+1"
|
|
"inc NBYTES+1"
|
|
"txa"
|
|
"tay"
|
|
"jsr Pop"
|
|
"jsr Blm"
|
|
| | |
|
|
bls ND | R16 |
|
|
"jsr Test2"
|
|
"sta NBYTES+1"
|
|
"inc NBYTES+1"
|
|
"txa"
|
|
"tay"
|
|
"jsr Pop"
|
|
"jsr Blm"
|
|
| | |
|
|
csa | R16 |
|
|
"jmp Csa"
|
|
| | |
|
|
csb | R16 |
|
|
"jmp Csb"
|
|
| | |
|
|
dch | | | | loi 2 |
|
|
dup $1==2 | R16 |
|
|
"jsr Push"
|
|
| %[1] | |
|
|
dup $1<=256 | |
|
|
allocate(R16)
|
|
"ldy #[$1].l"
|
|
"jsr Dup"
|
|
| | |
|
|
dus $1==2 | R16 |
|
|
"jsr TestFFh"
|
|
"iny"
|
|
"jsr Dup"
|
|
| | |
|
|
exg $1==2 | R16 |
|
|
"jsr Exg2"
|
|
| %[1] | |
|
|
exg $1<=255 | |
|
|
allocate(R16)
|
|
"ldy #$1"
|
|
"jsr Exg"
|
|
| | |
|
|
fil | |
|
|
"ldy #[$1].l"
|
|
"sty hol0+4"
|
|
"ldy #[$1].h"
|
|
"sty hol0+5"
|
|
| | |
|
|
gto | |
|
|
allocate(R16)
|
|
"lda #[$1].h"
|
|
"ldx #[$1].l"
|
|
"jmp Gto"
|
|
| | |
|
|
lim | |
|
|
allocate(R16)
|
|
"ldx IGNMASK"
|
|
"lda IGNMASK+1"
|
|
| %[a] | |
|
|
lin | |
|
|
"ldy #[$1].l"
|
|
"sty hol0"
|
|
"ldy #[$1].h"
|
|
"sty hol0+1"
|
|
| | |
|
|
lni | |
|
|
"inc hol0"
|
|
"bne 1f"
|
|
"inc hol0+1\n1:"
|
|
| | |
|
|
lor $1==0 | |
|
|
allocate(R16)
|
|
"ldx LB"
|
|
"lda LB+1"
|
|
| %[a] | |
|
|
lor $1==1 | |
|
|
allocate(R16)
|
|
"ldx SP+2"
|
|
"lda SP+1"
|
|
| %[a] | |
|
|
lor $1==2 | |
|
|
allocate(R16)
|
|
"ldx HP"
|
|
"lda HP+1"
|
|
| %[a] | |
|
|
lpb | | | | adp 2 |
|
|
mon | R16 |
|
|
"jsr Mon"
|
|
| %[1] | |
|
|
nop | |
|
|
allocate(R16)
|
|
"jsr Printstack"
|
|
| | |
|
|
rck | R16 | | | |
|
|
rtt | |
|
|
remove(ALL)
|
|
"jmp Rtt"
|
|
| | |
|
|
sig | R16 |
|
|
"pha"
|
|
"txa"
|
|
"pha"
|
|
"ldx ERRPROC"
|
|
"lda ERRPROC+1"
|
|
"jsr Push"
|
|
"pla"
|
|
"sta ERRPROC"
|
|
"pla"
|
|
"sta ERRPROC+1"
|
|
| | |
|
|
sim | R16 |
|
|
"stx IGNMASK"
|
|
"sta IGNMASK+1"
|
|
| | |
|
|
str $1==0 | R16 |
|
|
"stx LB"
|
|
"sta LB+1"
|
|
"tay"
|
|
"sec"
|
|
"txa"
|
|
"sbc #BASE"
|
|
"sta LBl"
|
|
"tya"
|
|
"sbc #0"
|
|
"sta LBl+1"
|
|
| | |
|
|
str $1==1 | R16 |
|
|
"stx SP+2"
|
|
"sta SP+1"
|
|
| | |
|
|
str $1==2 | R16 |
|
|
"stx HP"
|
|
"sta HP+1"
|
|
| | |
|
|
trp | R16 |
|
|
"jsr Trap"
|
|
| | |
|
|
lol lal sti $1==$2 && $3==1 | | | | | /* throw away funny C-proc-prolog */
|
|
|
|
| STACK |
|
|
allocate(R16)
|
|
"jsr Pop"
|
|
| %[a] | |
|
|
|
|
|
|
/*************\
|
|
* M O V E S *
|
|
\*************/
|
|
|
|
MOVES: (AAA,AAA,"nop")
|
|
|
|
STACKS: (R16, , "jsr Push")
|