mirror of
https://github.com/irmen/prog8.git
synced 2025-01-10 20:30:23 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7af8007447
@ -36,7 +36,7 @@ romsub $b1bf = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101
|
||||
; there is also floats.GIVUAYFAY - unsigned word in A/Y (lo/hi) to fac1
|
||||
; there is also floats.FREADS32 that reads from 98-101 ($62-$65) MSB FIRST
|
||||
; there is also floats.FREADUS32 that reads from 98-101 ($62-$65) MSB FIRST
|
||||
; there is also floats.FREADS24AXY that reads signed int24 into fac1 from A/X/Y (lo/mid/hi bytes)
|
||||
; there is also floats.FREAD{S,U}24AXY that read (un)signed int24 into fac1 from A/X/Y (lo/mid/hi bytes)
|
||||
romsub $b391 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y)
|
||||
|
||||
romsub $b3a2 = FREADUY(ubyte value @ Y) clobbers(A,X,Y) ; 8 bit unsigned Y -> float in fac1
|
||||
@ -104,7 +104,6 @@ asmsub FREADUS32 () clobbers(A,X,Y) {
|
||||
|
||||
asmsub FREADS24AXY (ubyte lo @ A, ubyte mid @ X, ubyte hi @ Y) clobbers(A,X,Y) {
|
||||
; ---- fac1 = signed int24 (A/X/Y contain lo/mid/hi bytes)
|
||||
; note: there is no FREADU24AXY (unsigned), use FREADUS32 instead.
|
||||
%asm {{
|
||||
sty $62
|
||||
stx $63
|
||||
@ -119,6 +118,38 @@ asmsub FREADS24AXY (ubyte lo @ A, ubyte mid @ X, ubyte hi @ Y) clobbers(A,X,Y)
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub FREADU24AXY(ubyte lo @ A, ubyte mid @ X, ubyte hi @ Y) clobbers(A, X, Y) -> float @FAC1 {
|
||||
%asm{{
|
||||
FAC = $61
|
||||
sty FAC+1
|
||||
stx FAC+2
|
||||
sta FAC+3
|
||||
|
||||
cpy #$00
|
||||
bne +
|
||||
cpx #$00
|
||||
bne +
|
||||
cmp #$00
|
||||
beq ++
|
||||
|
||||
+ ldx #$98
|
||||
bit FAC+1
|
||||
bmi +
|
||||
|
||||
- dex
|
||||
asl FAC+3
|
||||
rol FAC+2
|
||||
rol FAC+1
|
||||
bpl -
|
||||
|
||||
+ stx FAC
|
||||
lda #$00
|
||||
sta FAC+4
|
||||
sta FAC+5
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) {
|
||||
; ---- unsigned 16 bit word in A/Y (lo/hi) to fac1
|
||||
%asm {{
|
||||
@ -177,6 +208,13 @@ asmsub normalize(float value @FAC1) -> float @ FAC1 {
|
||||
}}
|
||||
}
|
||||
|
||||
; get the jiffy clock as a float
|
||||
asmsub time() -> float @ FAC1 {
|
||||
%asm {{
|
||||
jsr cbm.RDTIM
|
||||
jmp floats.FREADU24AXY
|
||||
}}
|
||||
}
|
||||
|
||||
%asminclude "library:c64/floats.asm"
|
||||
%asminclude "library:c64/floats_funcs.asm"
|
||||
|
@ -90,6 +90,37 @@ asmsub FREADSA (byte value @A) clobbers(A,X,Y) {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub FREADU24AXY(ubyte lo @ A, ubyte mid @ X, ubyte hi @ Y) clobbers(A, X, Y) -> float @FAC1 {
|
||||
%asm{{
|
||||
FAC = $C3
|
||||
sty FAC+1
|
||||
stx FAC+2
|
||||
sta FAC+3
|
||||
|
||||
cpy #$00
|
||||
bne +
|
||||
cpx #$00
|
||||
bne +
|
||||
cmp #$00
|
||||
beq ++
|
||||
|
||||
+ ldx #$98
|
||||
bit FAC+1
|
||||
bmi +
|
||||
|
||||
- dex
|
||||
asl FAC+3
|
||||
rol FAC+2
|
||||
rol FAC+1
|
||||
bpl -
|
||||
|
||||
+ stx FAC
|
||||
stz FAC+4
|
||||
stz FAC+5
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) {
|
||||
; ---- unsigned 16 bit word in A/Y (lo/hi) to fac1
|
||||
%asm {{
|
||||
@ -157,7 +188,6 @@ _msg .text 13,"?rom 47+ required for val1",13,0
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
&uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT (See "basic.sym" kernal symbol file)
|
||||
|
||||
sub rnd() -> float {
|
||||
@ -173,6 +203,14 @@ asmsub normalize(float value @FAC1) -> float @ FAC1 {
|
||||
}}
|
||||
}
|
||||
|
||||
; get the jiffy clock as a float
|
||||
asmsub time() -> float @ FAC1 {
|
||||
%asm {{
|
||||
jsr cbm.RDTIM
|
||||
jmp floats.FREADU24AXY
|
||||
}}
|
||||
}
|
||||
|
||||
%asminclude "library:c64/floats.asm"
|
||||
%asminclude "library:c64/floats_funcs.asm"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user