added strtow
changed SET command to use word instead of byte for arg 2
This commit is contained in:
parent
05787a20e3
commit
fa6bcd37da
BIN
bin/FSHa.8xp
BIN
bin/FSHa.8xp
Binary file not shown.
|
|
@ -121,6 +121,7 @@ strchrNoCharFound:
|
||||||
strtob:
|
strtob:
|
||||||
push bc
|
push bc
|
||||||
push de
|
push de
|
||||||
|
ld c, 0
|
||||||
strtobNumFind:
|
strtobNumFind:
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
cp $00
|
cp $00
|
||||||
|
|
@ -175,6 +176,108 @@ strtobExit:
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;; strtow
|
||||||
|
;; Converts a string to a byte
|
||||||
|
;; Inputs:
|
||||||
|
;; HL: string pointer
|
||||||
|
;; Outputs:
|
||||||
|
;; HL: byte
|
||||||
|
strtow:
|
||||||
|
push bc
|
||||||
|
push de
|
||||||
|
ld bc, 0
|
||||||
|
strtowNumFind:
|
||||||
|
ld a, (hl)
|
||||||
|
cp $00
|
||||||
|
jp z, strtowEXIT
|
||||||
|
ld c, 0
|
||||||
|
sub '1'
|
||||||
|
cp '9' + 1
|
||||||
|
jr c, strtowNumWhile
|
||||||
|
inc hl
|
||||||
|
jr strtowNumFind
|
||||||
|
strtowNumWhile:
|
||||||
|
push hl
|
||||||
|
strtowNumWhileLoop:
|
||||||
|
ld a, c
|
||||||
|
cp 5
|
||||||
|
jp nc, strtowConvert
|
||||||
|
ld a, (hl)
|
||||||
|
sub '0' - 1
|
||||||
|
jr c, strtowConvert
|
||||||
|
cp '9' + 1
|
||||||
|
jr nc, strtowConvert
|
||||||
|
inc hl
|
||||||
|
inc c
|
||||||
|
jr strtowNumWhileLoop
|
||||||
|
strtowConvert:
|
||||||
|
dec hl
|
||||||
|
ld a, (hl)
|
||||||
|
sub '0'
|
||||||
|
ld bc, 0
|
||||||
|
ld c, a
|
||||||
|
dec hl
|
||||||
|
|
||||||
|
pop de
|
||||||
|
call cpHLDE
|
||||||
|
jp c, strtowExit
|
||||||
|
ld a, (hl)
|
||||||
|
sub '0'
|
||||||
|
push hl
|
||||||
|
ld hl, 10
|
||||||
|
call mulAbyHL
|
||||||
|
add hl, bc
|
||||||
|
ld b, h
|
||||||
|
ld c, l
|
||||||
|
pop hl
|
||||||
|
dec hl
|
||||||
|
|
||||||
|
call cpHLDE
|
||||||
|
jp c, strtowExit
|
||||||
|
ld a, (hl)
|
||||||
|
sub '0'
|
||||||
|
push hl
|
||||||
|
ld hl, 100
|
||||||
|
call mulAbyHL
|
||||||
|
add hl, bc
|
||||||
|
ld b, h
|
||||||
|
ld c, l
|
||||||
|
pop hl
|
||||||
|
dec hl
|
||||||
|
|
||||||
|
call cpHLDE
|
||||||
|
jp c, strtowExit
|
||||||
|
ld a, (hl)
|
||||||
|
sub '0'
|
||||||
|
push hl
|
||||||
|
ld hl, 1000
|
||||||
|
call mulAbyHL
|
||||||
|
add hl, bc
|
||||||
|
ld b, h
|
||||||
|
ld c, l
|
||||||
|
pop hl
|
||||||
|
dec hl
|
||||||
|
|
||||||
|
call cpHLDE
|
||||||
|
jp c, strtowExit
|
||||||
|
ld a, (hl)
|
||||||
|
sub '0'
|
||||||
|
push hl
|
||||||
|
ld hl, 10000
|
||||||
|
call mulAbyHL
|
||||||
|
add hl, bc
|
||||||
|
ld b, h
|
||||||
|
ld c, l
|
||||||
|
pop hl
|
||||||
|
|
||||||
|
strtowExit:
|
||||||
|
ld hl, 0
|
||||||
|
ld h, b
|
||||||
|
ld l, c
|
||||||
|
pop de
|
||||||
|
pop bc
|
||||||
|
ret
|
||||||
|
|
||||||
;; toLower [Strings]
|
;; toLower [Strings]
|
||||||
;; Converts every alpha character of a string to lowercase.
|
;; Converts every alpha character of a string to lowercase.
|
||||||
;; Inputs:
|
;; Inputs:
|
||||||
|
|
|
||||||
|
|
@ -42,23 +42,29 @@ fshcmdSETfArg1Get:
|
||||||
ld hl, fshcmdSETfDValue
|
ld hl, fshcmdSETfDValue
|
||||||
call _PutS
|
call _PutS
|
||||||
ld hl, fshcmdSETfInputBuffer
|
ld hl, fshcmdSETfInputBuffer
|
||||||
ld de, 3
|
ld de, 5
|
||||||
call inputnumstr
|
call inputnumstr
|
||||||
call strtob
|
call strtow
|
||||||
|
ex de, hl
|
||||||
ld hl, FshCmdArg1
|
ld hl, FshCmdArg1
|
||||||
ld (hl), a
|
ld (hl), d
|
||||||
|
inc hl
|
||||||
|
ld (hl), e
|
||||||
fshcmdSETfExe:
|
fshcmdSETfExe:
|
||||||
ld hl, FshCmdArg0
|
ld hl, FshCmdArg0
|
||||||
ld de, 0
|
ld de, 0
|
||||||
ld e, (hl)
|
ld e, (hl)
|
||||||
ld hl, FshCmdArg1
|
push de
|
||||||
ld b, (hl)
|
ld hl, FshCmdArg1
|
||||||
ld hl, 0
|
ld d, (hl)
|
||||||
ld l, b
|
inc hl
|
||||||
|
ld e, (hl)
|
||||||
|
ex de, hl
|
||||||
|
pop de
|
||||||
call fshvarset
|
call fshvarset
|
||||||
call _NewLine
|
call _NewLine
|
||||||
jp ErrCatch
|
jp ErrCatch
|
||||||
|
|
||||||
fshcmdSETfInputBuffer: .db $00,$00,$00,$00
|
fshcmdSETfInputBuffer: .db $00, $00, $00, $00, $00, $00
|
||||||
fshcmdSETfDIndex: .db "Index= ", 0
|
fshcmdSETfDIndex: .db "Index= ", 0
|
||||||
fshcmdSETfDValue: .db "Value= ", 0
|
fshcmdSETfDValue: .db "Value= ", 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue