Where is the string stored in float's memory so that it can be read with peek and written with "print"?
I would like to output this loop in basic with print/poke and not in asm:
-------------------------
loop:
lda ($02),y
beq done
jsr CHROUT
iny
bne loop
done:
------------------------
Thanks.
Code: Select all
; calculate how far an object has fallen: d = 1/2 * g * t^2.
; we set g = 9.81 m/sec^2, time = 5 sec -> d = 122.625 m.
org $00
CHROUT = $ffd2
FOUT = $fe06
FMULTT = $fe21
FDIV = $fe24
CONUPK = $fe5a
MOVFM = $fe63
lda #4
sta $01 ; rom bank 4 (BASIC) contains the fp routines.
lda #<flt_two
ldy #>flt_two
jsr MOVFM
lda #<flt_g
ldy #>flt_g
jsr FDIV ; FACC= g/2
lda #<flt_time
ldy #>flt_time
jsr CONUPK ; ARG = time
jsr FMULTT ; FACC = g/2 * time
lda #<flt_time
ldy #>flt_time
jsr CONUPK ; again ARG = time
jsr FMULTT ; FACC = g/2 * time * time
jsr FOUT ; to string
; print string in AY
sta $02
sty $03
ldy #0
loop:
lda ($02),y
beq done
jsr CHROUT
iny
bne loop
done:
rts
flt_g: .byte $84, $1c, $f5, $c2, $8f ; float 9.81
flt_time: .byte $83, $20, $00, $00, $00 ; float 5.0
flt_two: .byte $82, $00, $00, $00, $00 ; float 2.0