Skip to content

Commit ce4bb53

Browse files
committed
Add routine to set ATTR to address
This routine, given a pixel address on the screen in HL will set the ATTR for it. Also adds an extra entry point to the SET_ATTR routine. This routine is in charge of setting the ATTR upon an screen update operation (PRINT, PLOT, DRAW, CIRCLE). Now it can be used also by drawing primitives instead of the ROM's one.
1 parent 5bc9cca commit ce4bb53

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

library-asm/attr.asm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ __SET_ATTR:
4444
PROC
4545

4646
call __ATTR_ADDR
47+
48+
__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address
4749
ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T
4850

4951
ld a, d
@@ -61,3 +63,17 @@ __SET_ATTR:
6163
ENDP
6264

6365

66+
; Sets the attribute at a given screen pixel address in hl
67+
; HL contains the address in RAM for a given pixel (not a coordinate)
68+
SET_PIXEL_ADDR_ATTR:
69+
;; gets ATTR position with offset given in SCREEN_ADDR
70+
ld a, h
71+
rrca
72+
rrca
73+
rrca
74+
and 3
75+
or 18h
76+
ld h, a
77+
ld de, (SCREEN_ADDR)
78+
add hl, de ;; Final screen addr
79+
jp __SET_ATTR2

0 commit comments

Comments
 (0)