Added new runtime sub bcasta/bcastax/bcasteax opposing to bnega/bnegax/bnegeax.

This commit is contained in:
acqn
2020-09-05 11:28:38 +08:00
committed by Oliver Schmidt
parent 142b0bf9b3
commit fe3f267233
5 changed files with 48 additions and 1 deletions

21
libsrc/runtime/bcast.s Normal file
View 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
View 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