Hi!
The Woz format has less precision (23 bits instead of 24), stores the mantisa in twos-complement and stores 0 as the four bytes equal to 0 - exponent 0 is not special.
As I understand it, both formats have similar precision, because 24-bit signed magnitude vs. 24-bit twos complement differ only very slightly, with the tie-breaker actually going to twos complement for losing -0 in favor of -(2^23). Woz encoding appears to waste a small amount of storage efficiency with 256 "0.0"s, but is still more storage-efficient than its MS competitor which seems to have 16777216 "0.0"s. My own unfinished encoding method has just a single "0.0", but is probably only able to be speed-competitive on a machine with 32-bit registers.
No, there are two separate issues, you can have sign-magnitude and twos-complement with or without implied high bit.
In the case of Woz format, it has no implied high bit, so the representation always starts with "10" for negatives and with "01" for positive, normalized numbers. Also, as it does not have implied high bit, it allows un-normalized numbers, this is bad because multiplication and divisions with those use less precision than available.
And the twos-complement representation makes the normalization code slower, as you have to test for a pattern in two bits when shifting instead of simply test the top bit:
Code: Select all
; WOZ NORMALIZATION CODE:
NORM1: DEC X1 ; DECREMENT EXP1
ASL M1+2
ROL M1+1 ; SHIFT MANT1 (3 BYTES) LEFT
ROL M1
NORML: LDA M1 ; HIGH ORDER MANT1 BYTE
ASL ; UPPER TWO BITS UNEQUAL?
EOR M1
BMI RTS1 ; YES,RETURN WITH MANT1 NORMALIZED
LDA X1 ; EXP1 ZERO?
BNE NORM1 ; NO, CONTINUE NORMALIZING
RTS1: RTS ; RETURN
With sign-magnitude representation, this is simpler:
Code: Select all
; NON COMPLEMENTED NORMALIZATION CODE:
NORM1: DEC X1 ; DECREMENT EXP1
ASL M1+2
ROL M1+1 ; SHIFT MANT1 (3 BYTES) LEFT
ROL M1
NORML: BIT M1 ; HIGH ORDER MANT1 BYTE
BVS RTS1 ; YES,RETURN WITH MANT1 NORMALIZED
LDA X1 ; EXP1 ZERO?
BNE NORM1 ; NO, CONTINUE NORMALIZING
RTS1: RTS ; RETURN
Implied bit is a bit longer, as you need to store the sign in a location, but only one byte more than WOZ:
Code: Select all
; NON COMPLEMENTED NORMALIZATION CODE:
NORM1: DEC X1 ; DECREMENT EXP1
ASL M1+2
ROL M1+1 ; SHIFT MANT1 (3 BYTES) LEFT
ROL M1
NORML: LDA M1 ; HIGH ORDER MANT1 BYTE
BMI RTS1 ; YES,RETURN WITH MANT1 NORMALIZED
LDA X1 ; EXP1 ZERO?
BNE NORM1 ; NO, CONTINUE NORMALIZING
RTS1: EOR SIGN ; ADD SIGN (0=NEGATIVE, 128=POSITIVE)
STA M1 ; STORE
RTS ; RETURN