implement FREADUY on pet, so that ubyte to float now works

This commit is contained in:
Irmen de Jong
2026-01-31 19:31:26 +01:00
parent bc0d6453ae
commit ac851a35bc
2 changed files with 10 additions and 1 deletions
+9 -1
View File
@@ -19,7 +19,6 @@ const uword FAC_ADDR = $5e
;extsub $ba90 = FAREADMEM() clobbers(A,Y) ; load mflpt value from memory in $22/$23 into fac2
;;
;
;extsub $b3a2 = FREADUY(ubyte value @ Y) clobbers(A,X,Y) ; 8 bit unsigned Y -> float in fac1
;extsub $b7b5 = FREADSTR(ubyte length @ A) clobbers(A,X,Y) ; str -> fac1, $22/23 must point to string, A=string length. Also see parse()
;extsub $aabc = FPRINTLN() clobbers(A,X,Y) ; print string of fac1, on one line (= with newline) destroys fac1. (consider FOUT + STROUT as well)
;
@@ -101,6 +100,15 @@ asmsub AYINT2() clobbers(X) -> word @AY {
}}
}
asmsub FREADUY(ubyte value @ Y) clobbers(A,X,Y) {
; -- 8 bit unsigned Y -> float in fac1
%asm {{
lda #0
jmp GIVAYF
}}
}
asmsub FREADSA (byte value @A) clobbers(A,X,Y) {
; ---- 8 bit signed A -> float in fac1
%asm {{
+1
View File
@@ -13,6 +13,7 @@ Future Things and Ideas
- make builtin functions capable of returning multiple values, then make divmod() return the 2 results rather than accepting 2 extra variables as arguments
- then also introduce lmh(longvalue) -or whatever sensible name- builtin function that returns the low, mid, hi (bank) bytes of a long.
- and rewrite the divmod (and others?) function to just return the 2 results instead of taking target variables as arguments.
- allow alias to blocks?
- add a -profile option (for now X16 only) that instruments the start (and returns?) -of every prog8 subroutine with code that dumps to the X16 emulator debug console: name of sub, stack pointer (for call depth!), emudbg cycle count. Save/restore all used registers! Start of program must set cycle count to zero.
- add @private to variables and subroutines declared in a scope to make them invisible from outside that scope?
- when implementing unsigned longs: remove the (multiple) "TODO "hack" to allow unsigned long constants to be used as values for signed longs, without needing a cast"