kmm32:put sw before du and ov

This commit is contained in:
Kitty-Cricket Piapiac 2023-03-26 15:13:08 -07:00
parent 4e1502bd01
commit 897e9c20c0
3 changed files with 5 additions and 5 deletions

2
as.c
View File

@ -9,7 +9,7 @@ V mw(W i,W w){mh(i,w>>16),mh(i+2,w);}
V mcpy(W dst,B*src,W l){for(W i=0;i<l;++i)mb(dst+i,src[i]);}
#define OPSZ 36
_ B ops[OPSZ*2]="npexpbphpwfbfhfwmbmhmwioiissdrduswovadsumudianorxrslsrsaeqltgtnojujccacc";
_ B ops[OPSZ*2]="npexpbphpwfbfhfwmbmhmwioiissdrswduovadsumudianorxrslsrsaeqltgtnojujccacc";
_ B op(B x[2]){W i=0;WH(i++<OPSZ,Q(ops[i*2]==x[0]&&ops[1+i*2]==x[1],R i));R OPSZ;}
_ B htob(B h){R h>='a'&&h<='f'?h-'a'+10:h>='A'&&h<='F'?h-'F'+10:h>='0'&&h<='9'?h-'0':16;}
_ B ws(B x){R' '==x||'\t'==x||'\r'==x||'\n'==x;}

View File

@ -65,9 +65,9 @@ OPCODES
ii (p--n) gets cell from io port `p and pushes it onto the stack
ss (n-~n) move cell from data stack to return stack
dr (n--) drop item from data stack
du (n--n n) duplicate item on data stack
sw (n m--m n) swap items
ov (n m--n m n) bring sescon item on stack over
du (n--n n) duplicate item on data stack
ov (n m--n m n) bring second item on data stack over
ad (n m--n+m) add
su (n m--n-m) subtract
mu (n m--n*m) multiply

View File

@ -38,8 +38,8 @@ _ V io(V){AB,ios[b].io(a);}
_ V ii(V){put(ios[pop()].oi());}
_ V ss(V){pur(pop());}
_ V dr(V){--dp;}
_ V du(V){put(*(dp-1));}
_ V sw(V){AB,put(b),put(a);}
_ V du(V){put(*(dp-1));}
_ V ov(V){put(*(dp-2));}
_ V ad(V){AB,put(a+b);}
_ V su(V){AB,put(a-b);}
@ -63,7 +63,7 @@ _ V cc(V){AB;Q(a,pur(ip),ip=b)}
_ V(*ops[])(V)=
/*0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23*/
/*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35*/
{np,ex,pb,ph,pw,fb,fh,fw,mb,mh,mw,io,ii,ss,dr,du,sw,ov,ad,su,mu,di,an,or,xr,sl,sr,sa,eq,lt,gt,no,ju,jc,ca,cc};
{np,ex,pb,ph,pw,fb,fh,fw,mb,mh,mw,io,ii,ss,dr,sw,du,ov,ad,su,mu,di,an,or,xr,sl,sr,sa,eq,lt,gt,no,ju,jc,ca,cc};
V emu(W c){B m,f;while(c--&&ip<0x40000){Q((f=(m=mem[ip++])>>6)&1,swp());ops[0x3f&m]();Q(f&1,swp());}}
V lod(B*c,W l){for(ip=0;ip<l;++ip)mem[ip+0x100]=c[ip];ip=0x100;}