mirror of
https://github.com/hsoft/collapseos.git
synced 2025-04-11 03:38:15 +10:00
Fixed comments
I agree the comments I had weren't very useful in terms of understanding the code, and I also agree the comments I removed didn't need removing. I've edited them a little because I feel like it's clearer to refer to the nibbles of what will be the result rather than the bytes of what was the data being parsed, but I'd like to hear your opinion on that.
This commit is contained in:
parent
423460cc47
commit
fca0244c68
@ -44,27 +44,25 @@ parseHex:
|
||||
parseHexPair:
|
||||
ld a, (hl)
|
||||
call parseHex
|
||||
ret c ; faster and smaller than a conditional jump
|
||||
; by delaying this push, we can use a conditional return above
|
||||
ret c ; if there's an error, return
|
||||
push bc
|
||||
ld b, a
|
||||
ld b, a ; save MSN (Most Significant Nibble)
|
||||
inc hl
|
||||
ld a, (hl)
|
||||
cp 0x21
|
||||
jr c, .single
|
||||
jr c, .single ; special char? single digit
|
||||
call parseHex
|
||||
jr c, .end
|
||||
ld c, a
|
||||
jr c, .end ; if error, go to end
|
||||
ld c, a ; save LSN (Least Significant Nibble)
|
||||
ld a, b
|
||||
; by delaying shifting until the end, we save bytes in the single case.
|
||||
rla \ rla \ rla \ rla
|
||||
or c
|
||||
rla \ rla \ rla \ rla ; left shift into MSN (also zeroes LSN)
|
||||
or c ; join MSN + LSN. we're done!
|
||||
|
||||
.end:
|
||||
.end:
|
||||
pop bc
|
||||
ret
|
||||
|
||||
.single:
|
||||
.single:
|
||||
ld a, b
|
||||
dec hl
|
||||
pop bc
|
||||
|
Loading…
Reference in New Issue
Block a user