46 ; expects X -> c, Y -> b, returns in de
50 sla b ; change from blocks to pixels
52 ; construct low address byte -> e
53 ld a, b ; start with Y
56 and $e0 ; keep top 3 bits
59 and $1f ; keep low 5 bits
60 or e ; combine with Y bits
61 ld e, a ; move the result back to e
62 ; construct high address byte -> d
63 ld a, b ; start with Y again
67 and $18 ; keep bits 3 and 4
68 ld d, a ; keep it in d
69 ld a, b ; grap Y one more time
70 and $7 ; keep low 3 bits of Y in a
71 or d ; combine with Y6-Y7
73 or b ; combine with high byte of fb address
74 ld d, a ; move result back to d