;
; Pass column in register c
;
get_column_offset:
push de ; Store de safely on the stack

ld a, c ; Load A with column coordinate
sra a ; Divide A by eight
sra a
sra a
ld d, 0
ld e, a ; Load DE with divided column value

ld a, c ; Load A with column coordinate
and %00000111 ; AND A to get the byte offset
ld c, a ; Store this value back into C

add hl, de ; Add the basic column to HL

pop de ; Retrieve de from the stack
ret

Back to Contents