fix ir rndseed()

This commit is contained in:
Irmen de Jong 2024-10-07 21:56:12 +02:00
parent fea531be9a
commit b2bdfe8482
3 changed files with 8 additions and 14 deletions

View File

@ -1,4 +1,8 @@
; Somewhat experimental Vera FX support.
; Partial Vera FX support:
; - fast 32 bit cached writes (clear, copy)
; - transparent write setting
; - hardware 16 bits multiplications
;
; Docs:
; https://github.com/X16Community/x16-docs/blob/fb63156cca2d6de98be0577aacbe4ddef458f896/X16%20Reference%20-%2010%20-%20VERA%20FX%20Reference.md
; https://docs.google.com/document/d/1q34uWOiM3Be2pnaHRVgSdHySI-qsiQWPTo_gfE54PTg
@ -110,19 +114,11 @@ verafx {
cx16.VERA_CTRL = 0
}
; unsigned multiplication just passes the values as signed to muls
; if you do this yourself in your call to muls, it will save a few instructions.
; TODO fix this: verafx.muls doesn't support unsigned values like this for full 32 bit result
; inline asmsub mult(uword value1 @R0, uword value2 @R1) clobbers(X) -> uword @AY, uword @R0 {
; ; Returns the 32 bits unsigned result in AY and R0 (lower word, upper word).
; %asm {{
; jsr verafx.muls
; }}
; }
asmsub mult16(uword value1 @R0, uword value2 @R1) clobbers(X) -> uword @AY {
; Returns the 16 bits unsigned result of R0*R1 in AY.
; Note: only the lower 16 bits! (the upper 16 bits are not valid for unsigned word multiplications, only for signed)
; Verafx doesn't support unsigned values like this for full 32 bit result.
%asm {{
lda cx16.r0
sta P8ZP_SCRATCH_W1

View File

@ -199,7 +199,7 @@ math {
%ir {{
loadm.w r65534,math.rndseed.seed1
loadm.w r65535,math.rndseed.seed2
syscall 19 (r65534.w, r65535.w)
syscall 18 (r65534.w, r65535.w)
return
}}
}

View File

@ -1,8 +1,6 @@
TODO
====
see github for issues
Regenerate skeleton doc files.
Improve register load order in subroutine call args assignments:
@ -14,7 +12,7 @@ Maybe this routine can be made more intelligent. See usesOtherRegistersWhileEva
Future Things and Ideas
^^^^^^^^^^^^^^^^^^^^^^^
- Add a new SublimeText syntax file for prog8, and also install this for bat: https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-syntaxes--language-definitions
- Improve the SublimeText syntax file for prog8, you can also install this for 'bat': https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-syntaxes--language-definitions
- callfar() should allow setting an argument in the X register as well?
- Can we support signed % (remainder) somehow?
- Don't add "random" rts to %asm blocks but instead give a warning about it? (but this breaks existing behavior that others already depend on... command line switch? block directive?)