diff --git a/compiler/res/prog8lib/cx16/floats.p8 b/compiler/res/prog8lib/cx16/floats.p8 index 4967b28ba..747d51e6b 100644 --- a/compiler/res/prog8lib/cx16/floats.p8 +++ b/compiler/res/prog8lib/cx16/floats.p8 @@ -140,16 +140,26 @@ asmsub parse_f(str value @AY) -> float @FAC1 { ; -- parse a string value of a number to float in FAC1 ; warning: on older > 2) - unroll 4 cx16.VERA_DATA0=0 ; write 4 bytes at a time, unrolled + unroll 4 cx16.VERA_DATA0=0 ; write 4*4 bytes at a time, unrolled } else if (amountof32bits & %1111111000000001) == 0 { repeat lsb(amountof32bits >> 1) - unroll 2 cx16.VERA_DATA0=0 ; write 4 bytes at a time, unrolled + unroll 2 cx16.VERA_DATA0=0 ; write 2*4 bytes at a time, unrolled } else if (lsb(amountof32bits) & 3) == 0 { repeat amountof32bits >> 2 - unroll 4 cx16.VERA_DATA0=0 ; write 4 bytes at a time, unrolled + unroll 4 cx16.VERA_DATA0=0 ; write 4*4 bytes at a time, unrolled } else if (lsb(amountof32bits) & 1) == 0 { repeat amountof32bits >> 1 - unroll 2 cx16.VERA_DATA0=0 ; write 4 bytes at a time, unrolled + unroll 2 cx16.VERA_DATA0=0 ; write 2*4 bytes at a time, unrolled } else { repeat amountof32bits diff --git a/compiler/res/prog8lib/prog8_lib.asm b/compiler/res/prog8lib/prog8_lib.asm index a36c4bb93..1ff557cd0 100644 --- a/compiler/res/prog8lib/prog8_lib.asm +++ b/compiler/res/prog8lib/prog8_lib.asm @@ -441,7 +441,7 @@ _return_minusone strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. + ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. sta P8ZP_SCRATCH_W1 sty P8ZP_SCRATCH_W1+1 ldy #0 diff --git a/examples/test.p8 b/examples/test.p8 index 23abac320..dd2be98aa 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,24 +1,25 @@ %import textio -%import bmx +%import floats +%import string %zeropage basicsafe %option no_sysinit main { sub start() { - bmx.palette_buffer_ptr = memory("palette", 512, 0) - if bmx.open(8, "desertfish.bmx") { - if bmx.continue_load(0,0) { - uword offset = 10*320 + 100 - bmx.width = 100 - bmx.height = 150 - if bmx.save(8, "@:stamp.bmx", 0, offset, 320) { - txt.print("save stamp ok\n") - return - } - } + str buffer = "???????????????????????????" + repeat { + txt.print("enter number: ") + void txt.input_chars(buffer) + txt.print("\nprog8's parse_f: ") + float value = floats.parse_f(buffer) + floats.print_f(value) + + ; floats.VAL_1 is defined as: + ; romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 +; txt.print("\nrom val_1: ") +; value = floats.VAL_1(buffer, string.length(buffer)) +; floats.print_f(value) + txt.nl() } - txt.print("error: ") - txt.print(bmx.error_message) - txt.nl() } }