Skip to content

Commit 6cc7766

Browse files
committed
Update test to reflect new ATTR routine
1 parent 9d3141f commit 6cc7766

63 files changed

Lines changed: 3428 additions & 544 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/functional/arrbase1.asm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ __MUL16NOADD:
136136

137137
#line 20 "array.asm"
138138

139-
#line 24 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
139+
#line 24 "/src/zxb/trunk/library-asm/array.asm"
140140

141141
__ARRAY:
142142
PROC
@@ -159,10 +159,10 @@ __ARRAY:
159159
ld hl, 0 ; BC = Offset "accumulator"
160160

161161
LOOP:
162-
#line 49 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
162+
#line 49 "/src/zxb/trunk/library-asm/array.asm"
163163
pop bc ; Get next index (Ai) from the stack
164164

165-
#line 59 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
165+
#line 59 "/src/zxb/trunk/library-asm/array.asm"
166166

167167
add hl, bc ; Adds current index
168168

@@ -192,7 +192,7 @@ ARRAY_END:
192192
push de
193193
exx
194194

195-
#line 92 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
195+
#line 92 "/src/zxb/trunk/library-asm/array.asm"
196196
LOCAL ARRAY_SIZE_LOOP
197197

198198
ex de, hl
@@ -223,7 +223,7 @@ ARRAY_SIZE_LOOP:
223223

224224
;add hl, de
225225
;__ARRAY_FIN:
226-
#line 123 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
226+
#line 123 "/src/zxb/trunk/library-asm/array.asm"
227227

228228
pop de
229229
add hl, de ; Adds element start
@@ -562,9 +562,9 @@ __MEM_START:
562562
__MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE
563563
ld a, h ; HL = NULL (No memory available?)
564564
or l
565-
#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm"
565+
#line 111 "/src/zxb/trunk/library-asm/alloc.asm"
566566
ret z ; NULL
567-
#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm"
567+
#line 113 "/src/zxb/trunk/library-asm/alloc.asm"
568568
; HL = Pointer to Free block
569569
ld e, (hl)
570570
inc hl

tests/functional/arrcheck.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ __STOP:
173173
ld (ERR_NR), a
174174
ret
175175
#line 23 "array.asm"
176-
#line 24 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
176+
#line 24 "/src/zxb/trunk/library-asm/array.asm"
177177

178178
__ARRAY:
179179
PROC
@@ -198,7 +198,7 @@ __ARRAY:
198198
LOOP:
199199

200200
pop de
201-
#line 49 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
201+
#line 49 "/src/zxb/trunk/library-asm/array.asm"
202202
pop bc ; Get next index (Ai) from the stack
203203

204204

@@ -208,7 +208,7 @@ LOOP:
208208
ld a, ERROR_SubscriptWrong
209209
jp c, __ERROR
210210
ex de, hl
211-
#line 59 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
211+
#line 59 "/src/zxb/trunk/library-asm/array.asm"
212212

213213
add hl, bc ; Adds current index
214214

@@ -238,7 +238,7 @@ ARRAY_END:
238238
push de
239239
exx
240240

241-
#line 92 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
241+
#line 92 "/src/zxb/trunk/library-asm/array.asm"
242242
LOCAL ARRAY_SIZE_LOOP
243243

244244
ex de, hl
@@ -269,7 +269,7 @@ ARRAY_SIZE_LOOP:
269269

270270
;add hl, de
271271
;__ARRAY_FIN:
272-
#line 123 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm"
272+
#line 123 "/src/zxb/trunk/library-asm/array.asm"
273273

274274
pop de
275275
add hl, de ; Adds element start

tests/functional/astore16.asm

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,23 +561,41 @@ PAPER_TMP:
561561

562562
FLASH:
563563
ld de, ATTR_P
564+
565+
PROC
566+
LOCAL IS_TR
567+
LOCAL IS_ZERO
568+
564569
__SET_FLASH:
565570
; Another entry. This will set the flash flag at location pointer by DE
566-
and 1 ; # Convert to 0/1
571+
cp 8
572+
jr z, IS_TR
567573

568-
rrca
574+
; # Convert to 0/1
575+
or a
576+
jr z, IS_ZERO
577+
ld a, 0x80
578+
579+
IS_ZERO:
569580
ld b, a ; Saves the color
570581
ld a, (de)
571582
and 07Fh ; Clears previous value
572583
or b
573584
ld (de), a
574585
ret
575586

587+
IS_TR: ; transparent
588+
inc de ; Points DE to MASK_T or MASK_P
589+
ld a, (de)
590+
or 0x80; Set bit 7 to enable transparency
591+
ld (de), a
592+
ret
576593

577594
; Sets the FLASH flag passed in A register in the ATTR_T variable
578595
FLASH_TMP:
579596
ld de, ATTR_T
580597
jr __SET_FLASH
598+
ENDP
581599

582600
#line 12 "print.asm"
583601
#line 1 "bright.asm"
@@ -590,25 +608,41 @@ FLASH_TMP:
590608
BRIGHT:
591609
ld de, ATTR_P
592610

611+
PROC
612+
LOCAL IS_TR
613+
LOCAL IS_ZERO
614+
593615
__SET_BRIGHT:
594616
; Another entry. This will set the bright flag at location pointer by DE
595-
and 1 ; # Convert to 0/1
617+
cp 8
618+
jr z, IS_TR
596619

597-
rrca
598-
rrca
620+
; # Convert to 0/1
621+
or a
622+
jr z, IS_ZERO
623+
ld a, 0x40
624+
625+
IS_ZERO:
599626
ld b, a ; Saves the color
600627
ld a, (de)
601628
and 0BFh ; Clears previous value
602629
or b
603630
ld (de), a
604631
ret
605632

633+
IS_TR: ; transparent
634+
inc de ; Points DE to MASK_T or MASK_P
635+
ld a, (de)
636+
or 0x40; Set bit 6 to enable transparency
637+
ld (de), a
638+
ret
639+
606640

607641
; Sets the BRIGHT flag passed in A register in the ATTR_T variable
608642
BRIGHT_TMP:
609643
ld de, ATTR_T
610644
jr __SET_BRIGHT
611-
645+
ENDP
612646
#line 13 "print.asm"
613647
#line 1 "over.asm"
614648

@@ -885,6 +919,8 @@ __SET_ATTR:
885919
PROC
886920

887921
call __ATTR_ADDR
922+
923+
__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address
888924
ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T
889925

890926
ld a, d
@@ -902,6 +938,20 @@ __SET_ATTR:
902938
ENDP
903939

904940

941+
; Sets the attribute at a given screen pixel address in hl
942+
; HL contains the address in RAM for a given pixel (not a coordinate)
943+
SET_PIXEL_ADDR_ATTR:
944+
;; gets ATTR position with offset given in SCREEN_ADDR
945+
ld a, h
946+
rrca
947+
rrca
948+
rrca
949+
and 3
950+
or 18h
951+
ld h, a
952+
ld de, (SCREEN_ADDR)
953+
add hl, de ;; Final screen addr
954+
jp __SET_ATTR2
905955
#line 19 "print.asm"
906956

907957
; Putting a comment starting with @INIT <address>

tests/functional/attr.asm

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,41 @@ BOLD_TMP:
139139

140140
FLASH:
141141
ld de, ATTR_P
142+
143+
PROC
144+
LOCAL IS_TR
145+
LOCAL IS_ZERO
146+
142147
__SET_FLASH:
143148
; Another entry. This will set the flash flag at location pointer by DE
144-
and 1 ; # Convert to 0/1
149+
cp 8
150+
jr z, IS_TR
151+
152+
; # Convert to 0/1
153+
or a
154+
jr z, IS_ZERO
155+
ld a, 0x80
145156

146-
rrca
157+
IS_ZERO:
147158
ld b, a ; Saves the color
148159
ld a, (de)
149160
and 07Fh ; Clears previous value
150161
or b
151162
ld (de), a
152163
ret
153164

165+
IS_TR: ; transparent
166+
inc de ; Points DE to MASK_T or MASK_P
167+
ld a, (de)
168+
or 0x80; Set bit 7 to enable transparency
169+
ld (de), a
170+
ret
154171

155172
; Sets the FLASH flag passed in A register in the ATTR_T variable
156173
FLASH_TMP:
157174
ld de, ATTR_T
158175
jr __SET_FLASH
176+
ENDP
159177

160178
#line 35 "attr.bas"
161179
#line 1 "ink.asm"

tests/functional/circle.asm

Lines changed: 95 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,100 @@ __CLS_SCR:
256256
ENDP
257257

258258
#line 10 "plot.asm"
259+
#line 1 "attr.asm"
260+
261+
; Attribute routines
262+
; vim:ts=4:et:sw:
263+
264+
265+
266+
267+
#line 1 "const.asm"
268+
269+
; Global constants
270+
271+
P_FLAG EQU 23697
272+
FLAGS2 EQU 23681
273+
ATTR_P EQU 23693 ; permanet ATTRIBUTES
274+
ATTR_T EQU 23695 ; temporary ATTRIBUTES
275+
CHARS EQU 23606 ; Pointer to ROM/RAM Charset
276+
UDG EQU 23675 ; Pointer to UDG Charset
277+
MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars
278+
279+
#line 8 "attr.asm"
280+
281+
282+
__ATTR_ADDR:
283+
; calc start address in DE (as (32 * d) + e)
284+
; Contributed by Santiago Romero at http://www.speccy.org
285+
ld h, 0 ; 7 T-States
286+
ld a, d ; 4 T-States
287+
add a, a ; a * 2 ; 4 T-States
288+
add a, a ; a * 4 ; 4 T-States
289+
ld l, a ; HL = A * 4 ; 4 T-States
290+
291+
add hl, hl ; HL = A * 8 ; 15 T-States
292+
add hl, hl ; HL = A * 16 ; 15 T-States
293+
add hl, hl ; HL = A * 32 ; 15 T-States
294+
295+
ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone)
296+
add hl, de
297+
298+
ld de, (SCREEN_ADDR) ; Adds the screen address
299+
add hl, de
300+
301+
; Return current screen address in HL
302+
ret
303+
304+
305+
; Sets the attribute at a given screen coordinate (D, E).
306+
; The attribute is taken from the ATTR_T memory variable
307+
; Used by PRINT routines
308+
SET_ATTR:
309+
310+
; Checks for valid coords
311+
call __IN_SCREEN
312+
ret nc
313+
314+
__SET_ATTR:
315+
; Internal __FASTCALL__ Entry used by printing routines
316+
PROC
317+
318+
call __ATTR_ADDR
319+
320+
__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address
321+
ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T
322+
323+
ld a, d
324+
and (hl)
325+
ld c, a ; C = current screen color, masked
326+
327+
ld a, d
328+
cpl ; Negate mask
329+
and e ; Mask current attributes
330+
or c ; Mix them
331+
ld (hl), a ; Store result in screen
332+
333+
ret
334+
335+
ENDP
336+
337+
338+
; Sets the attribute at a given screen pixel address in hl
339+
; HL contains the address in RAM for a given pixel (not a coordinate)
340+
SET_PIXEL_ADDR_ATTR:
341+
;; gets ATTR position with offset given in SCREEN_ADDR
342+
ld a, h
343+
rrca
344+
rrca
345+
rrca
346+
and 3
347+
or 18h
348+
ld h, a
349+
ld de, (SCREEN_ADDR)
350+
add hl, de ;; Final screen addr
351+
jp __SET_ATTR2
352+
#line 11 "plot.asm"
259353

260354
PLOT:
261355
PROC
@@ -313,21 +407,7 @@ __PLOT_OVER1:
313407
LOCAL __PLOT_END
314408
__PLOT_END:
315409
ld (hl), a
316-
317-
;; gets ATTR position with offset given in SCREEN_ADDR
318-
ld a, h
319-
rrca
320-
rrca
321-
rrca
322-
and 3
323-
or 18h
324-
ld h, a
325-
ld de, (SCREEN_ADDR)
326-
add hl, de ;; Final screen addr
327-
328-
LOCAL PO_ATTR_2
329-
PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR
330-
jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY
410+
jp SET_PIXEL_ADDR_ATTR
331411

332412
__PLOT_ERR:
333413
jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1)

0 commit comments

Comments
 (0)