Use Keep mode for all LIT opcodes
This commit is contained in:
parent
6f872feff5
commit
80b4e4f88d
|
@ -432,12 +432,11 @@ include projects/library/binary-tree.tal
|
|||
,¬-found JCN
|
||||
|
||||
;asma-opcodes/_disasm SUB2 #03 SFT2 ( 00 byte / end* )
|
||||
DUP #00 EQU ,&set-keep JCN ( force keep flag for LIT )
|
||||
&loop
|
||||
LDAkr STHr LIT2r 0001 ADD2r ( 00 byte char / end* )
|
||||
DUP ,¬-end JCN
|
||||
POP POP2r
|
||||
DUP ,¬-zero JCN #80 NIP ( LIT by itself needs keep flag, to distinguish from BRK )
|
||||
¬-zero
|
||||
SWP
|
||||
JMP2r
|
||||
|
||||
|
@ -451,7 +450,7 @@ include projects/library/binary-tree.tal
|
|||
|
||||
¬-return
|
||||
LIT 'k NEQ ,¬-keep JCN
|
||||
asma-KEEP-FLAG ORA ,&loop JMP
|
||||
&set-keep asma-KEEP-FLAG ORA ,&loop JMP
|
||||
|
||||
¬-keep ( 00 byte / end* )
|
||||
¬-found ( incoming-ptr* / end* )
|
||||
|
|
|
@ -92,6 +92,7 @@ findopcode(char *s)
|
|||
int m = 0;
|
||||
if(!scmp(ops[i], s, 3))
|
||||
continue;
|
||||
if(!i) i |= (1 << 7); /* force keep for LIT */
|
||||
while(s[3 + m]) {
|
||||
if(s[3 + m] == '2')
|
||||
i |= (1 << 5); /* mode: short */
|
||||
|
@ -103,7 +104,6 @@ findopcode(char *s)
|
|||
return 0; /* failed to match */
|
||||
m++;
|
||||
}
|
||||
if(!i) i |= (1 << 7); /* force LIT nonzero (keep is ignored) */
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
|
@ -112,7 +112,7 @@ findopcode(char *s)
|
|||
static void
|
||||
pushbyte(Uint8 b, int lit)
|
||||
{
|
||||
if(lit) pushbyte(findopcode("LITk"), 0);
|
||||
if(lit) pushbyte(findopcode("LIT"), 0);
|
||||
p.data[p.ptr++] = b;
|
||||
p.length = p.ptr;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ pushbyte(Uint8 b, int lit)
|
|||
static void
|
||||
pushshort(Uint16 s, int lit)
|
||||
{
|
||||
if(lit) pushbyte(findopcode("LIT2k"), 0);
|
||||
if(lit) pushbyte(findopcode("LIT2"), 0);
|
||||
pushbyte((s >> 8) & 0xff, 0);
|
||||
pushbyte(s & 0xff, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue