test program for floating point issues on c128

This commit is contained in:
Irmen de Jong 2021-12-25 14:33:34 +01:00
parent d4153da8b9
commit 60a64c2558

48
c128floatproblem.asm Normal file
View File

@ -0,0 +1,48 @@
; this program adds 2 floats 1.2345 + 4.4444 and prints the result 5.67879
; it works fine on C64 and CX16 but fails to add the right number on C128
; I think it has something to do with the banking on the C128
; because several rom fp routines mention "value in bank 1"
; but I don't know what this means and why the program as given doesn't work
.cpu '6502'
* = $1300 ; sys 4864
P8ZP_SCRATCH_W1 = 251 ; free zp word
CHROUT = $ffd2
; c128:
MOVFM = $af63
FADD = $af18
FOUT = $af06
;cx16:
;MOVFM = $fe42
;FADD = $fe12
;FOUT = $fe7b
;c64:
;MOVFM = $bba2
;FADD = $b867
;FOUT = $bddd
lda #<f1
ldy #>f1
jsr MOVFM ; load FAC1
lda #<f2
ldy #>f2
jsr FADD ; add mem float to FAC1 DOESN'T WORK ON C128!?
jsr FOUT ; convert to string
sta P8ZP_SCRATCH_W1
sty P8ZP_SCRATCH_W1+1
ldy #0
_printloop lda (P8ZP_SCRATCH_W1),y
beq _done
jsr CHROUT
iny
bne _printloop
_done jmp _done
f1 .byte $81, $1e, $04, $18, $93 ; float 1.2345
f2 .byte $83, $0e, $38, $86, $59 ; float 4.4444