Skip to content

Commit c7665f6

Browse files
committed
refact: make GetScrnAddr to use back buffer
Also makes SET_PIXEL_ADDR_ATTR to use ATTR buffer too.
1 parent ce814cf commit c7665f6

5 files changed

Lines changed: 15 additions & 66 deletions

File tree

src/arch/zx48k/library-asm/SP/GetScrnAddr.asm

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,24 @@
33
; Alvin Albrecht 2002
44
;
55

6-
;INCLUDE "SPconfig.def"
7-
;XLIB SPGetScrnAddr
8-
96
; Get Screen Address
107
;
118
; Computes the screen address given a valid pixel coordinate.
129
; (0,0) is located at the top left corner of the screen.
1310
;
14-
; enter: a = h = y coord
11+
; enter: h = y coord
1512
; l = x coord
1613
; In hi-res mode, Carry is most significant bit of x coord (0..511 pixels)
1714
; exit : de = screen address, b = pixel mask
1815
; uses : af, b, de, hl
1916

20-
;IF !DISP_HIRES
21-
2217
push namespace core
18+
PROC
19+
LOCAL rotloop, norotate
2320

2421
SPGetScrnAddr:
22+
ld a,h
2523
and $07
26-
or $40
2724
ld d,a
2825
ld a,h
2926
rra
@@ -54,57 +51,12 @@ norotate:
5451
and $e0
5552
or l
5653
ld e,a
54+
ld hl, (SCREEN_ADDR)
55+
add hl, de
56+
ex de, hl
5757
ret
5858

59+
ENDP
5960
pop namespace
6061

61-
62-
;ELSE
63-
;
64-
;.SPGetScrnAddr
65-
; ld b,0
66-
; ld d,b
67-
; rr l
68-
; rl b
69-
; srl l
70-
; rl b
71-
; srl l
72-
; rl b
73-
; srl l
74-
; jr nc, notodd
75-
; ld d,$20
76-
;
77-
;.notodd
78-
; ld a,b
79-
; or a
80-
; ld a,$80
81-
; jr z, norotate
82-
;
83-
;.rotloop
84-
; rra
85-
; djnz rotloop
86-
87-
;.norotate
88-
; ld b,a
89-
; ld a,h
90-
; and $07
91-
; or $40
92-
; or d
93-
; ld d,a
94-
; ld a,h
95-
; rra
96-
; rra
97-
; rra
98-
; and $18
99-
; or d
100-
; ld d,a
101-
;
102-
; ld a,h
103-
; rla
104-
; rla
105-
; and $e0
106-
; or l
107-
; ld e,a
108-
; ret
109-
110-
;ENDIF
62+
#include once <sysvars.asm>

src/arch/zx48k/library-asm/set_pixel_addr_attr.asm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ push namespace core
66
; HL contains the address in RAM for a given pixel (not a coordinate)
77
SET_PIXEL_ADDR_ATTR:
88
;; gets ATTR position with offset given in SCREEN_ADDR
9+
ld de, (SCREEN_ADDR)
10+
or a
11+
sbc hl, de
912
ld a, h
1013
rrca
1114
rrca
1215
rrca
1316
and 3
14-
1517
ld h, a
18+
1619
ld de, (SCREEN_ATTR_ADDR)
1720
add hl, de ;; Final screen addr
1821
jp __SET_ATTR2

src/arch/zx48k/library/SP/Fill.bas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ SPPFill:
112112
dec bc ; we will start with one struct in the queue
113113
push bc ; save max stack depth variable
114114

115-
ld a,h
116115
call SPGetScrnAddr ; de = screen address, b = pixel byte
117116
ex de,hl ; hl = screen address
118117

src/arch/zxnext/library-asm/SP/GetScrnAddr.asm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
; Computes the screen address given a valid pixel coordinate.
1212
; (0,0) is located at the top left corner of the screen.
1313
;
14-
; enter: a = h = y coord
14+
; enter: h = y coord
1515
; l = x coord
1616
; In hi-res mode, Carry is most significant bit of x coord (0..511 pixels)
1717
; exit : de = screen address, b = pixel mask
@@ -22,6 +22,7 @@
2222
push namespace core
2323

2424
SPGetScrnAddr:
25+
ld a,h
2526
and $07
2627
or $40
2728
ld d,a

src/arch/zxnext/library/SP/Fill.bas

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,9 @@ SPPFill:
112112
dec bc ; we will start with one struct in the queue
113113
push bc ; save max stack depth variable
114114

115-
ld a,h
116115
call SPGetScrnAddr ; de = screen address, b = pixel byte
117116
ex de,hl ; hl = screen address
118117

119-
; ld b, h
120-
; ld c, l
121-
; call 22B0h ; Uses ROM Pixel ADDR
122-
; ld b, a
123-
124118
call bytefill ; b = fill byte
125119
jr c, viable
126120
pop bc

0 commit comments

Comments
 (0)