Add STRVAL
This commit is contained in:
1 parent
382b382847
commit
47fa7a393c
8 files changed
+75
-21
No files matched your search
@@ -202,7 +202,7 @@ Floating point mathematical routines - not official, but well known and broadly
|
|||||||
| `$B391` | `GIVAYF` | PARTIAL | not fully tested yet |
|
| `$B391` | `GIVAYF` | PARTIAL | not fully tested yet |
|
||||||
| `$B3A2` | `convert_Y_to_FAC1` | DONE | |
|
| `$B3A2` | `convert_Y_to_FAC1` | DONE | |
|
||||||
| `$B794` | `convert_u8_A_to_FAC1` | DONE | |
|
| `$B794` | `convert_u8_A_to_FAC1` | DONE | |
|
||||||
| `$B7B5` | `STRVAL` | NOT DONE | imports string to FAC1 |
|
| `$B7B5` | `STRVAL` | PARTIAL | Only for 38k memory model |
|
||||||
| `$B7F7` | `convert_FAC1_to_ADDR` | NOT DONE | |
|
| `$B7F7` | `convert_FAC1_to_ADDR` | NOT DONE | |
|
||||||
| `$B849` | `add_HALF_FAC1` | DONE | |
|
| `$B849` | `add_HALF_FAC1` | DONE | |
|
||||||
| `$B850` | `sub_MEM_FAC1` | DONE | |
|
| `$B850` | `sub_MEM_FAC1` | DONE | |
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
;; #LAYOUT# STD * #TAKE
|
|
||||||
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
|
||||||
;; #LAYOUT# * BASIC_0 #TAKE
|
|
||||||
;; #LAYOUT# * * #IGNORE
|
|
||||||
|
|
||||||
;
|
|
||||||
; Math package - imports string to FAC1 - XXX: what about spaces?
|
|
||||||
;
|
|
||||||
; Input:
|
|
||||||
; - .A needs to be loaded with string length
|
|
||||||
; - string address in $22/$23
|
|
||||||
;
|
|
||||||
; See also:
|
|
||||||
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
|
||||||
;
|
|
||||||
|
|
||||||
; XXX provide implementation
|
|
||||||
|
|
||||||
STRVAL:
|
|
||||||
+STUB_IMPLEMENTATION
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
;; #LAYOUT# STD * #TAKE
|
||||||
|
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||||
|
;; #LAYOUT# * BASIC_0 #TAKE
|
||||||
|
;; #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
;
|
||||||
|
; Math package - converts string to FAC1
|
||||||
|
;
|
||||||
|
; Input:
|
||||||
|
; - .A needs to be loaded with string length
|
||||||
|
; - string address in $22/$23
|
||||||
|
;
|
||||||
|
; See also:
|
||||||
|
; - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||||
|
; - https://www.c64-wiki.com/wiki/STRVAL
|
||||||
|
;
|
||||||
|
|
||||||
|
!ifdef CONFIG_MEMORY_MODEL_38K {
|
||||||
|
; Only supported model for now since needs CHRGOT and FIN
|
||||||
|
|
||||||
|
STRVAL:
|
||||||
|
|
||||||
|
ldx TXTPTR ; Save TXTPTR
|
||||||
|
stx FBUFPT
|
||||||
|
ldx TXTPTR+1
|
||||||
|
stx FBUFPT+1
|
||||||
|
|
||||||
|
ldx INDEX ; Move string address into TXTPTR
|
||||||
|
stx TXTPTR
|
||||||
|
ldx INDEX+1
|
||||||
|
stx TXTPTR+1
|
||||||
|
|
||||||
|
pha ; Save string length
|
||||||
|
tay
|
||||||
|
lda (INDEX),Y
|
||||||
|
sta TEMPF1 ; Save byte after string
|
||||||
|
lda #0
|
||||||
|
sta (INDEX),Y ; NULL terminate string
|
||||||
|
|
||||||
|
jsr CHRGOT
|
||||||
|
jsr FIN
|
||||||
|
|
||||||
|
pla ; Retrieve string length
|
||||||
|
tay
|
||||||
|
lda TEMPF1
|
||||||
|
sta (INDEX),Y ; Restore byte after string
|
||||||
|
|
||||||
|
ldx FBUFPT ; Restore TXTPTR
|
||||||
|
stx TXTPTR
|
||||||
|
ldx FBUFPT+1
|
||||||
|
stx TXTPTR+1
|
||||||
|
rts
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,3 @@
|
|||||||
|
18 60 81 00 00 00 00
|
||||||
|
|
||||||
|
CLC + RTS + Floating point number 1.0
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
JSR $B68C + JMP fragment
|
||||||
|
|
||||||
|
Call some place in ROM + jump fragment
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
STA $24 + STY $25
|
||||||
|
|
||||||
|
Store YA to well known zero page vector
|
||||||
@@ -530,5 +530,17 @@ print "COMPARE"
|
|||||||
compare $61 $66 $1001
|
compare $61 $66 $1001
|
||||||
print "END"
|
print "END"
|
||||||
|
|
||||||
|
print "TEST: STRVAL 200E-1"
|
||||||
|
fill $61 $66 FF FF FF FF FF CC
|
||||||
|
fill $22 $23 $00 $05
|
||||||
|
fill $500 $507 32 30 30 45 2D 31 31
|
||||||
|
r A=6
|
||||||
|
r PC=$B7B5
|
||||||
|
ret
|
||||||
|
fill $1001 $1006 88 C8 00 00 00 00
|
||||||
|
print "COMPARE"
|
||||||
|
compare $61 $61 $1001
|
||||||
|
print "END"
|
||||||
|
|
||||||
|
|
||||||
q
|
q
|
||||||
Reference in new issue
Block a user