fixed X register corruption on Cx16 verions of float.GIVUAYFAY and GIVAYFAY

This commit is contained in:
Irmen de Jong 2020-10-11 17:45:40 +02:00
parent 1469033c1e
commit b759d5e06a
3 changed files with 18 additions and 56 deletions

View File

@ -78,10 +78,10 @@ asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) {
; ---- unsigned 16 bit word in A/Y (lo/hi) to fac1
%asm {{
phx
sta P8ZP_SCRATCH_REG
sta P8ZP_SCRATCH_W2
sty P8ZP_SCRATCH_B1
tya
ldy P8ZP_SCRATCH_REG
ldy P8ZP_SCRATCH_W2
jsr GIVAYF ; load it as signed... correct afterwards
lda P8ZP_SCRATCH_B1
bpl +
@ -98,9 +98,9 @@ _flt65536 .byte 145,0,0,0,0 ; 65536.0
asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) {
; ---- signed 16 bit word in A/Y (lo/hi) to float in fac1
%asm {{
sta P8ZP_SCRATCH_REG
sta P8ZP_SCRATCH_W2
tya
ldy P8ZP_SCRATCH_REG
ldy P8ZP_SCRATCH_W2
jmp GIVAYF ; this uses the inverse order, Y/A
}}
}

View File

@ -39,7 +39,6 @@ main {
iter++
}
; TODO something above is causing a strange black column on the right on Cx16.
if iter & 1
graphics.plot(pixelx, pixely)
}

View File

@ -1,5 +1,6 @@
%import textio
%import syslib
%import floats
%zeropage basicsafe
@ -7,62 +8,24 @@ main {
sub start() {
ubyte xx
ubyte yy
regx(xx)
str name = "irmen de jong"
uword strptr = &name
; str name = "irmen de jong"
; uword strptr = &name
;
;
; txt.print_ub(strlen("1234"))
; txt.chrout('\n')
; txt.print_ub(strlen(name))
; txt.chrout('\n')
; txt.print_uwhex(strptr, 1)
; txt.chrout('\n')
; txt.print(strptr)
; txt.chrout('\n')
; txt.print_ub(strlen(strptr))
; txt.chrout('\n')
txt.print_ub(strlen("1234"))
txt.chrout('\n')
txt.print_ub(strlen(name))
txt.chrout('\n')
txt.print_uwhex(strptr, 1)
txt.chrout('\n')
txt.print(strptr)
txt.chrout('\n')
txt.print_ub(strlen(strptr))
txt.chrout('\n')
}
asmsub regx(uword value @AX) {
%asm {{
nop
rts
}}
}
asmsub print_10s(uword value @AY) clobbers(A, X, Y) {
%asm {{
jsr conv.uword2decimal
lda conv.uword2decimal.decTenThousands
cmp #'0'
beq +
jsr c64.CHROUT
+ lda conv.uword2decimal.decThousands
cmp #'0'
beq +
jsr c64.CHROUT
+ lda conv.uword2decimal.decHundreds
cmp #'0'
beq +
jsr c64.CHROUT
+ lda conv.uword2decimal.decTens
jsr c64.CHROUT
lda #'.'
jsr c64.CHROUT
lda conv.uword2decimal.decOnes
jsr c64.CHROUT
rts
}}
}
asmsub testX() {
%asm {{
stx _saveX