Hi All
I'm still a relative z80 novice, and was wondering if any of the gurus here could cast their beady eye over this code snippet and suggest any optimization for max speed.
The code takes 8 bytes (for example a character definition ) and extracts the 8 bits for each of the 8 bytes and stores them in a 64 byte buffer as a 0 or 1 for later use.
Many thanks in advance for your time and effort.
Regards
Roukan
Magnify: ld b,8 ; Number of bytes to process ld de,MagBuff ; 64 byte buffer ld hl,CharBuff ; 8 byte buffer .ByteLoop: ld c,(hl) ; Get a byte push bc ; Save byte counter ld b,8 ; Number of bits to process .BitLoop: xor a ; Zero accumulator rlc c ; Move bit into carry flag adc a,0 ; Add carry to accumulator ld (de),a ; Store result in buffer inc de ; Point to next byte in buffer djnz .BitLoop ; Loop if <8 bits processed inc hl ; Point to next byte in buffer pop bc ; Recall byte counter djnz .ByteLoop ; Loop if <8 bytes processed ret CharBuff: DS 8 MagBuff: DS 64
Login or register to post comments

does that work? 

- at least the MSX is in good shape from an emulation point of view.
and I couldn't agree more.