Use parse-nhex

Instead of reimplementing it several times use parse-nhex to decode
two hex numbers,

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
BALATON Zoltan
2023-01-13 22:25:10 +01:00
committed by Mark Cave-Ayland
parent 9711c61be4
commit c967b4c947
3 changed files with 3 additions and 15 deletions

View File

@ -5,11 +5,7 @@ include config.fs
\ ------------------------------------------------------------------------- \ -------------------------------------------------------------------------
: decode-unit-upa ( str len -- id lun ) : decode-unit-upa ( str len -- id lun )
ascii , left-split 2 parse-nhex
( addr-R len-R addr-L len-L )
parse-hex
-rot parse-hex
swap
; ;
: encode-unit-upa ( id lun -- str len) : encode-unit-upa ( id lun -- str len)

View File

@ -3,11 +3,7 @@
\ ------------------------------------------------------------------------- \ -------------------------------------------------------------------------
: decode-unit-scsi ( str len -- id lun ) : decode-unit-scsi ( str len -- id lun )
ascii , left-split 2 parse-nhex
( addr-R len-R addr-L len-L )
parse-hex
-rot parse-hex
swap
; ;
: encode-unit-scsi ( id lun -- str len) : encode-unit-scsi ( id lun -- str len)

View File

@ -3,11 +3,7 @@
\ ------------------------------------------------------------------------- \ -------------------------------------------------------------------------
: decode-unit-sbus ( str len -- id lun ) : decode-unit-sbus ( str len -- id lun )
ascii , left-split 2 parse-nhex
( addr-R len-R addr-L len-L )
parse-hex
-rot parse-hex
swap
; ;
: encode-unit-sbus ( id lun -- str len) : encode-unit-sbus ( id lun -- str len)