Added new runtime sub bcasta/bcastax/bcasteax opposing to bnega/bnegax/bnegeax.
This commit is contained in:
parent
142b0bf9b3
commit
fe3f267233
5 changed files with 48 additions and 1 deletions
21
libsrc/runtime/bcast.s
Normal file
21
libsrc/runtime/bcast.s
Normal file
|
@ -0,0 +1,21 @@
|
|||
;
|
||||
; acqn, 01.16.2020
|
||||
;
|
||||
; CC65 runtime: boolean cast
|
||||
;
|
||||
|
||||
.export bcasta, bcastax
|
||||
|
||||
bcastax:
|
||||
cpx #0
|
||||
bne L1
|
||||
|
||||
bcasta:
|
||||
tax
|
||||
beq L0 ; Zero already in X
|
||||
|
||||
L1: ldx #0
|
||||
lda #1
|
||||
|
||||
L0: rts
|
||||
|
20
libsrc/runtime/lbcast.s
Normal file
20
libsrc/runtime/lbcast.s
Normal file
|
@ -0,0 +1,20 @@
|
|||
;
|
||||
; acqn, 01.16.2020
|
||||
;
|
||||
; CC65 runtime: boolean cast for longs
|
||||
;
|
||||
|
||||
.export bcasteax
|
||||
.importzp sreg, tmp1
|
||||
|
||||
bcasteax:
|
||||
stx tmp1
|
||||
ldx #0 ; High byte of result
|
||||
ora tmp1
|
||||
ora sreg
|
||||
ora sreg+1
|
||||
beq L0
|
||||
|
||||
lda #1
|
||||
L0: rts
|
||||
|
|
@ -851,7 +851,9 @@ void CE_GenRegInfo (CodeEntry* E, RegContents* InputRegs)
|
|||
if ((In->RegA & 0x0F) >= 8) {
|
||||
Out->RegA = 0;
|
||||
}
|
||||
} else if (FindBoolCmpCond (E->Arg) != CMP_INV ||
|
||||
} else if (strcmp (E->Arg, "bcastax") == 0 ||
|
||||
strcmp (E->Arg, "bnegax") == 0 ||
|
||||
FindBoolCmpCond (E->Arg) != CMP_INV ||
|
||||
FindTosCmpCond (E->Arg) != CMP_INV) {
|
||||
/* Result is boolean value, so X is zero on output */
|
||||
Out->RegX = 0;
|
||||
|
|
|
@ -107,6 +107,9 @@ static const FuncInfo FuncInfoTable[] = {
|
|||
{ "asreax2", REG_EAX, REG_EAX | REG_TMP1 },
|
||||
{ "asreax3", REG_EAX, REG_EAX | REG_TMP1 },
|
||||
{ "asreax4", REG_EAX, REG_EAXY | REG_TMP1 },
|
||||
{ "bcasta", REG_A, REG_AX },
|
||||
{ "bcastax", REG_AX, REG_AX },
|
||||
{ "bcasteax", REG_EAX, REG_EAX | REG_TMP1 },
|
||||
{ "bnega", REG_A, REG_AX },
|
||||
{ "bnegax", REG_AX, REG_AX },
|
||||
{ "bnegeax", REG_EAX, REG_EAX | REG_TMP1 },
|
||||
|
|
|
@ -2328,6 +2328,7 @@ static int HarmlessCall (const char* Name)
|
|||
"asrax3",
|
||||
"asrax4",
|
||||
"asraxy",
|
||||
"bcastax",
|
||||
"bnegax",
|
||||
"complax",
|
||||
"decax1",
|
||||
|
|
Loading…
Add table
Reference in a new issue