diff --git a/library-asm/attr.asm b/library-asm/attr.asm index 47ede7df3..38349f797 100644 --- a/library-asm/attr.asm +++ b/library-asm/attr.asm @@ -44,6 +44,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -61,3 +63,17 @@ __SET_ATTR: ENDP +; Sets the attribute at a given screen pixel address in hl +; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 diff --git a/library-asm/bright.asm b/library-asm/bright.asm index c8ed539dd..862f49d5c 100644 --- a/library-asm/bright.asm +++ b/library-asm/bright.asm @@ -6,12 +6,21 @@ BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR + + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 - rrca - rrca +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -19,9 +28,16 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP diff --git a/library-asm/draw.asm b/library-asm/draw.asm index edc61c078..46ffe82c6 100644 --- a/library-asm/draw.asm +++ b/library-asm/draw.asm @@ -9,6 +9,7 @@ #include once #include once +#include once #include once #include once @@ -36,7 +37,6 @@ __DRAW_ERROR: DRAW: ;; ENTRY POINT - LOCAL PIXEL_ADDR LOCAL COORDS LOCAL __DRAW_SETUP1, __DRAW_START, __PLOTOVER, __PLOTINVERSE @@ -208,7 +208,7 @@ __DRAW4: DY1: ; y += yi inc b - call __INCY ; This address will be dyncamically updated + call __INCY ; This address will be dynamically updated ld a, e ; Restores A reg. call __FASTPLOT @@ -272,7 +272,6 @@ __DRAW6_LOOP: ld (COORDS), bc ret -PIXEL_ADDR EQU 22ACh COORDS EQU 5C7Dh __DRAW_END: @@ -313,21 +312,9 @@ __PLOTOVER: push hl push de - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - -LOCAL PO_ATTR_2 -PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - call PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY - + push bc + call SET_PIXEL_ADDR_ATTR + pop bc pop de pop hl diff --git a/library-asm/flash.asm b/library-asm/flash.asm index 6f8dc6cd2..b28e2ca83 100644 --- a/library-asm/flash.asm +++ b/library-asm/flash.asm @@ -5,11 +5,22 @@ FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR + + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 - rrca +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -17,9 +28,16 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP diff --git a/library-asm/plot.asm b/library-asm/plot.asm index 6b8df80f0..35c477211 100644 --- a/library-asm/plot.asm +++ b/library-asm/plot.asm @@ -7,6 +7,7 @@ #include once #include once #include once +#include once PLOT: PROC @@ -64,21 +65,7 @@ __PLOT_OVER1: LOCAL __PLOT_END __PLOT_END: ld (hl), a - -;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - -LOCAL PO_ATTR_2 -PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY + jp SET_PIXEL_ADDR_ATTR __PLOT_ERR: jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1) diff --git a/tests/functional/arrbase1.asm b/tests/functional/arrbase1.asm index 61d89fd7c..54a14de29 100644 --- a/tests/functional/arrbase1.asm +++ b/tests/functional/arrbase1.asm @@ -136,7 +136,7 @@ __MUL16NOADD: #line 20 "array.asm" -#line 24 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 24 "/src/zxb/trunk/library-asm/array.asm" __ARRAY: PROC @@ -159,10 +159,10 @@ __ARRAY: ld hl, 0 ; BC = Offset "accumulator" LOOP: -#line 49 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 49 "/src/zxb/trunk/library-asm/array.asm" pop bc ; Get next index (Ai) from the stack -#line 59 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 59 "/src/zxb/trunk/library-asm/array.asm" add hl, bc ; Adds current index @@ -192,7 +192,7 @@ ARRAY_END: push de exx -#line 92 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 92 "/src/zxb/trunk/library-asm/array.asm" LOCAL ARRAY_SIZE_LOOP ex de, hl @@ -223,7 +223,7 @@ ARRAY_SIZE_LOOP: ;add hl, de ;__ARRAY_FIN: -#line 123 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 123 "/src/zxb/trunk/library-asm/array.asm" pop de add hl, de ; Adds element start @@ -562,9 +562,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/arrcheck.asm b/tests/functional/arrcheck.asm index d1fae43e2..73f3a7cf0 100644 --- a/tests/functional/arrcheck.asm +++ b/tests/functional/arrcheck.asm @@ -173,7 +173,7 @@ __STOP: ld (ERR_NR), a ret #line 23 "array.asm" -#line 24 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 24 "/src/zxb/trunk/library-asm/array.asm" __ARRAY: PROC @@ -198,7 +198,7 @@ __ARRAY: LOOP: pop de -#line 49 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 49 "/src/zxb/trunk/library-asm/array.asm" pop bc ; Get next index (Ai) from the stack @@ -208,7 +208,7 @@ LOOP: ld a, ERROR_SubscriptWrong jp c, __ERROR ex de, hl -#line 59 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 59 "/src/zxb/trunk/library-asm/array.asm" add hl, bc ; Adds current index @@ -238,7 +238,7 @@ ARRAY_END: push de exx -#line 92 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 92 "/src/zxb/trunk/library-asm/array.asm" LOCAL ARRAY_SIZE_LOOP ex de, hl @@ -269,7 +269,7 @@ ARRAY_SIZE_LOOP: ;add hl, de ;__ARRAY_FIN: -#line 123 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 123 "/src/zxb/trunk/library-asm/array.asm" pop de add hl, de ; Adds element start diff --git a/tests/functional/astore16.asm b/tests/functional/astore16.asm index eab6b4224..91b2e4028 100644 --- a/tests/functional/astore16.asm +++ b/tests/functional/astore16.asm @@ -561,11 +561,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -573,11 +584,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -590,12 +608,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -603,12 +630,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -885,6 +919,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -902,6 +938,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/attr.asm b/tests/functional/attr.asm index fb6490f9e..a71cf69ba 100644 --- a/tests/functional/attr.asm +++ b/tests/functional/attr.asm @@ -139,11 +139,22 @@ BOLD_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR + + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 - rrca +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -151,11 +162,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 35 "attr.bas" #line 1 "ink.asm" diff --git a/tests/functional/circle.asm b/tests/functional/circle.asm index 163fb707a..2b3fe9d7e 100644 --- a/tests/functional/circle.asm +++ b/tests/functional/circle.asm @@ -256,6 +256,100 @@ __CLS_SCR: ENDP #line 10 "plot.asm" +#line 1 "attr.asm" + + ; Attribute routines +; vim:ts=4:et:sw: + + + + +#line 1 "const.asm" + + ; Global constants + + P_FLAG EQU 23697 + FLAGS2 EQU 23681 + ATTR_P EQU 23693 ; permanet ATTRIBUTES + ATTR_T EQU 23695 ; temporary ATTRIBUTES + CHARS EQU 23606 ; Pointer to ROM/RAM Charset + UDG EQU 23675 ; Pointer to UDG Charset + MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars + +#line 8 "attr.asm" + + +__ATTR_ADDR: + ; calc start address in DE (as (32 * d) + e) + ; Contributed by Santiago Romero at http://www.speccy.org + ld h, 0 ; 7 T-States + ld a, d ; 4 T-States + add a, a ; a * 2 ; 4 T-States + add a, a ; a * 4 ; 4 T-States + ld l, a ; HL = A * 4 ; 4 T-States + + add hl, hl ; HL = A * 8 ; 15 T-States + add hl, hl ; HL = A * 16 ; 15 T-States + add hl, hl ; HL = A * 32 ; 15 T-States + + ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone) + add hl, de + + ld de, (SCREEN_ADDR) ; Adds the screen address + add hl, de + + ; Return current screen address in HL + ret + + + ; Sets the attribute at a given screen coordinate (D, E). + ; The attribute is taken from the ATTR_T memory variable + ; Used by PRINT routines +SET_ATTR: + + ; Checks for valid coords + call __IN_SCREEN + ret nc + +__SET_ATTR: + ; Internal __FASTCALL__ Entry used by printing routines + PROC + + call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address + ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T + + ld a, d + and (hl) + ld c, a ; C = current screen color, masked + + ld a, d + cpl ; Negate mask + and e ; Mask current attributes + or c ; Mix them + ld (hl), a ; Store result in screen + + ret + + ENDP + + + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 +#line 11 "plot.asm" PLOT: PROC @@ -313,21 +407,7 @@ __PLOT_OVER1: LOCAL __PLOT_END __PLOT_END: ld (hl), a - - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY + jp SET_PIXEL_ADDR_ATTR __PLOT_ERR: jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1) diff --git a/tests/functional/code00.asm b/tests/functional/code00.asm index 805c41046..723b3a753 100644 --- a/tests/functional/code00.asm +++ b/tests/functional/code00.asm @@ -849,11 +849,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -861,11 +872,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -878,12 +896,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -891,12 +918,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1140,6 +1174,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1157,6 +1193,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/code01.asm b/tests/functional/code01.asm index 0fccfcb58..94fcf7125 100644 --- a/tests/functional/code01.asm +++ b/tests/functional/code01.asm @@ -849,11 +849,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -861,11 +872,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -878,12 +896,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -891,12 +918,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1140,6 +1174,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1157,6 +1193,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/code02.asm b/tests/functional/code02.asm index d42f63f8f..67b83bb24 100644 --- a/tests/functional/code02.asm +++ b/tests/functional/code02.asm @@ -849,11 +849,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -861,11 +872,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -878,12 +896,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -891,12 +918,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1140,6 +1174,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1157,6 +1193,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/draw.asm b/tests/functional/draw.asm index 351e83dfb..1100ab830 100644 --- a/tests/functional/draw.asm +++ b/tests/functional/draw.asm @@ -222,6 +222,100 @@ __CLS_SCR: ENDP #line 12 "draw.asm" +#line 1 "attr.asm" + + ; Attribute routines +; vim:ts=4:et:sw: + + + + +#line 1 "const.asm" + + ; Global constants + + P_FLAG EQU 23697 + FLAGS2 EQU 23681 + ATTR_P EQU 23693 ; permanet ATTRIBUTES + ATTR_T EQU 23695 ; temporary ATTRIBUTES + CHARS EQU 23606 ; Pointer to ROM/RAM Charset + UDG EQU 23675 ; Pointer to UDG Charset + MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars + +#line 8 "attr.asm" + + +__ATTR_ADDR: + ; calc start address in DE (as (32 * d) + e) + ; Contributed by Santiago Romero at http://www.speccy.org + ld h, 0 ; 7 T-States + ld a, d ; 4 T-States + add a, a ; a * 2 ; 4 T-States + add a, a ; a * 4 ; 4 T-States + ld l, a ; HL = A * 4 ; 4 T-States + + add hl, hl ; HL = A * 8 ; 15 T-States + add hl, hl ; HL = A * 16 ; 15 T-States + add hl, hl ; HL = A * 32 ; 15 T-States + + ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone) + add hl, de + + ld de, (SCREEN_ADDR) ; Adds the screen address + add hl, de + + ; Return current screen address in HL + ret + + + ; Sets the attribute at a given screen coordinate (D, E). + ; The attribute is taken from the ATTR_T memory variable + ; Used by PRINT routines +SET_ATTR: + + ; Checks for valid coords + call __IN_SCREEN + ret nc + +__SET_ATTR: + ; Internal __FASTCALL__ Entry used by printing routines + PROC + + call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address + ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T + + ld a, d + and (hl) + ld c, a ; C = current screen color, masked + + ld a, d + cpl ; Negate mask + and e ; Mask current attributes + or c ; Mix them + ld (hl), a ; Store result in screen + + ret + + ENDP + + + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 +#line 13 "draw.asm" #line 1 "PixelDown.asm" @@ -267,7 +361,7 @@ SP.PixelDown: ;ENDIF ccf ret -#line 14 "draw.asm" +#line 15 "draw.asm" #line 1 "PixelUp.asm" ; @@ -311,7 +405,7 @@ SP.PixelUp: cp $40 ;ENDIF ret -#line 15 "draw.asm" +#line 16 "draw.asm" #line 1 "PixelLeft.asm" ; @@ -345,7 +439,7 @@ SP.PixelLeft: ld a, 1 ret -#line 16 "draw.asm" +#line 17 "draw.asm" #line 1 "PixelRight.asm" ; @@ -380,7 +474,7 @@ SP.PixelRight: ld a, 80h ret -#line 17 "draw.asm" +#line 18 "draw.asm" ;; DRAW PROCEDURE PROC @@ -403,7 +497,6 @@ __DRAW_ERROR: DRAW: ;; ENTRY POINT - LOCAL PIXEL_ADDR LOCAL COORDS LOCAL __DRAW_SETUP1, __DRAW_START, __PLOTOVER, __PLOTINVERSE @@ -575,7 +668,7 @@ __DRAW4: DY1: ; y += yi inc b - call __INCY ; This address will be dyncamically updated + call __INCY ; This address will be dynamically updated ld a, e ; Restores A reg. call __FASTPLOT @@ -639,7 +732,6 @@ __DRAW6_LOOP: ld (COORDS), bc ret - PIXEL_ADDR EQU 22ACh COORDS EQU 5C7Dh __DRAW_END: @@ -680,21 +772,9 @@ __PLOTOVER: push hl push de - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - call PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY - + push bc + call SET_PIXEL_ADDR_ATTR + pop bc pop de pop hl diff --git a/tests/functional/draw3.asm b/tests/functional/draw3.asm index d7ad6f774..ed1f41911 100644 --- a/tests/functional/draw3.asm +++ b/tests/functional/draw3.asm @@ -262,6 +262,100 @@ __CLS_SCR: ENDP #line 10 "plot.asm" +#line 1 "attr.asm" + + ; Attribute routines +; vim:ts=4:et:sw: + + + + +#line 1 "const.asm" + + ; Global constants + + P_FLAG EQU 23697 + FLAGS2 EQU 23681 + ATTR_P EQU 23693 ; permanet ATTRIBUTES + ATTR_T EQU 23695 ; temporary ATTRIBUTES + CHARS EQU 23606 ; Pointer to ROM/RAM Charset + UDG EQU 23675 ; Pointer to UDG Charset + MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars + +#line 8 "attr.asm" + + +__ATTR_ADDR: + ; calc start address in DE (as (32 * d) + e) + ; Contributed by Santiago Romero at http://www.speccy.org + ld h, 0 ; 7 T-States + ld a, d ; 4 T-States + add a, a ; a * 2 ; 4 T-States + add a, a ; a * 4 ; 4 T-States + ld l, a ; HL = A * 4 ; 4 T-States + + add hl, hl ; HL = A * 8 ; 15 T-States + add hl, hl ; HL = A * 16 ; 15 T-States + add hl, hl ; HL = A * 32 ; 15 T-States + + ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone) + add hl, de + + ld de, (SCREEN_ADDR) ; Adds the screen address + add hl, de + + ; Return current screen address in HL + ret + + + ; Sets the attribute at a given screen coordinate (D, E). + ; The attribute is taken from the ATTR_T memory variable + ; Used by PRINT routines +SET_ATTR: + + ; Checks for valid coords + call __IN_SCREEN + ret nc + +__SET_ATTR: + ; Internal __FASTCALL__ Entry used by printing routines + PROC + + call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address + ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T + + ld a, d + and (hl) + ld c, a ; C = current screen color, masked + + ld a, d + cpl ; Negate mask + and e ; Mask current attributes + or c ; Mix them + ld (hl), a ; Store result in screen + + ret + + ENDP + + + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 +#line 11 "plot.asm" PLOT: PROC @@ -319,21 +413,7 @@ __PLOT_OVER1: LOCAL __PLOT_END __PLOT_END: ld (hl), a - - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY + jp SET_PIXEL_ADDR_ATTR __PLOT_ERR: jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1) @@ -405,6 +485,7 @@ __FPSTACK_I16: ; Pushes 16 bits integer in HL into the FP ROM STACK + #line 1 "PixelDown.asm" ; @@ -449,7 +530,7 @@ SP.PixelDown: ;ENDIF ccf ret -#line 14 "draw.asm" +#line 15 "draw.asm" #line 1 "PixelUp.asm" ; @@ -493,7 +574,7 @@ SP.PixelUp: cp $40 ;ENDIF ret -#line 15 "draw.asm" +#line 16 "draw.asm" #line 1 "PixelLeft.asm" ; @@ -527,7 +608,7 @@ SP.PixelLeft: ld a, 1 ret -#line 16 "draw.asm" +#line 17 "draw.asm" #line 1 "PixelRight.asm" ; @@ -562,7 +643,7 @@ SP.PixelRight: ld a, 80h ret -#line 17 "draw.asm" +#line 18 "draw.asm" ;; DRAW PROCEDURE PROC @@ -585,7 +666,6 @@ __DRAW_ERROR: DRAW: ;; ENTRY POINT - LOCAL PIXEL_ADDR LOCAL COORDS LOCAL __DRAW_SETUP1, __DRAW_START, __PLOTOVER, __PLOTINVERSE @@ -757,7 +837,7 @@ __DRAW4: DY1: ; y += yi inc b - call __INCY ; This address will be dyncamically updated + call __INCY ; This address will be dynamically updated ld a, e ; Restores A reg. call __FASTPLOT @@ -821,7 +901,6 @@ __DRAW6_LOOP: ld (COORDS), bc ret - PIXEL_ADDR EQU 22ACh COORDS EQU 5C7Dh __DRAW_END: @@ -862,21 +941,9 @@ __PLOTOVER: push hl push de - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - call PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY - + push bc + call SET_PIXEL_ADDR_ATTR + pop bc pop de pop hl diff --git a/tests/functional/einarattr.asm b/tests/functional/einarattr.asm index abc4773f7..5f334c154 100644 --- a/tests/functional/einarattr.asm +++ b/tests/functional/einarattr.asm @@ -359,11 +359,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -371,11 +382,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -388,12 +406,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -401,12 +428,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -607,6 +641,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -624,6 +660,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/einarshift.asm b/tests/functional/einarshift.asm index faf044fee..4c10d10af 100644 --- a/tests/functional/einarshift.asm +++ b/tests/functional/einarshift.asm @@ -341,11 +341,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -353,11 +364,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -370,12 +388,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -383,12 +410,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -665,6 +699,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -682,6 +718,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/fact.asm b/tests/functional/fact.asm index a068dea03..847df545e 100644 --- a/tests/functional/fact.asm +++ b/tests/functional/fact.asm @@ -516,11 +516,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -528,11 +539,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -545,12 +563,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -558,12 +585,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -840,6 +874,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -857,6 +893,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/fastcall0.asm b/tests/functional/fastcall0.asm index ef260a968..c3868a262 100644 --- a/tests/functional/fastcall0.asm +++ b/tests/functional/fastcall0.asm @@ -652,6 +652,100 @@ __CLS_SCR: ENDP #line 10 "plot.asm" +#line 1 "attr.asm" + + ; Attribute routines +; vim:ts=4:et:sw: + + + + +#line 1 "const.asm" + + ; Global constants + + P_FLAG EQU 23697 + FLAGS2 EQU 23681 + ATTR_P EQU 23693 ; permanet ATTRIBUTES + ATTR_T EQU 23695 ; temporary ATTRIBUTES + CHARS EQU 23606 ; Pointer to ROM/RAM Charset + UDG EQU 23675 ; Pointer to UDG Charset + MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars + +#line 8 "attr.asm" + + +__ATTR_ADDR: + ; calc start address in DE (as (32 * d) + e) + ; Contributed by Santiago Romero at http://www.speccy.org + ld h, 0 ; 7 T-States + ld a, d ; 4 T-States + add a, a ; a * 2 ; 4 T-States + add a, a ; a * 4 ; 4 T-States + ld l, a ; HL = A * 4 ; 4 T-States + + add hl, hl ; HL = A * 8 ; 15 T-States + add hl, hl ; HL = A * 16 ; 15 T-States + add hl, hl ; HL = A * 32 ; 15 T-States + + ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone) + add hl, de + + ld de, (SCREEN_ADDR) ; Adds the screen address + add hl, de + + ; Return current screen address in HL + ret + + + ; Sets the attribute at a given screen coordinate (D, E). + ; The attribute is taken from the ATTR_T memory variable + ; Used by PRINT routines +SET_ATTR: + + ; Checks for valid coords + call __IN_SCREEN + ret nc + +__SET_ATTR: + ; Internal __FASTCALL__ Entry used by printing routines + PROC + + call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address + ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T + + ld a, d + and (hl) + ld c, a ; C = current screen color, masked + + ld a, d + cpl ; Negate mask + and e ; Mask current attributes + or c ; Mix them + ld (hl), a ; Store result in screen + + ret + + ENDP + + + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 +#line 11 "plot.asm" PLOT: PROC @@ -709,21 +803,7 @@ __PLOT_OVER1: LOCAL __PLOT_END __PLOT_END: ld (hl), a - - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY + jp SET_PIXEL_ADDR_ATTR __PLOT_ERR: jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1) @@ -962,19 +1042,7 @@ __PAUSE: ; and A register is non-zero if the string must be freed (TMP string) -#line 1 "const.asm" - - ; Global constants - - P_FLAG EQU 23697 - FLAGS2 EQU 23681 - ATTR_P EQU 23693 ; permanet ATTRIBUTES - ATTR_T EQU 23695 ; temporary ATTRIBUTES - CHARS EQU 23606 ; Pointer to ROM/RAM Charset - UDG EQU 23675 ; Pointer to UDG Charset - MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars -#line 10 "usr_str.asm" #line 1 "free.asm" ; vim: ts=4:et:sw=4: diff --git a/tests/functional/for0.asm b/tests/functional/for0.asm index 6b9cc7e5b..4756c1435 100644 --- a/tests/functional/for0.asm +++ b/tests/functional/for0.asm @@ -385,11 +385,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -397,11 +408,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -414,12 +432,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -427,12 +454,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -709,6 +743,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -726,6 +762,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/ifelse1.asm b/tests/functional/ifelse1.asm index e9ce4c19f..7486afcc6 100644 --- a/tests/functional/ifelse1.asm +++ b/tests/functional/ifelse1.asm @@ -354,11 +354,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -366,11 +377,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -383,12 +401,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -396,12 +423,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -678,6 +712,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -695,6 +731,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/ifwhilex.asm b/tests/functional/ifwhilex.asm index dc4929b24..9e5d1406a 100644 --- a/tests/functional/ifwhilex.asm +++ b/tests/functional/ifwhilex.asm @@ -373,11 +373,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -385,11 +396,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -402,12 +420,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -415,12 +442,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -697,6 +731,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -714,6 +750,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/inkey.asm b/tests/functional/inkey.asm index 5e7fbeacf..36faf5705 100644 --- a/tests/functional/inkey.asm +++ b/tests/functional/inkey.asm @@ -717,11 +717,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -729,11 +740,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -746,12 +764,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -759,12 +786,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1041,6 +1075,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1058,6 +1094,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/inktemp.asm b/tests/functional/inktemp.asm index 1c537c2ef..c099b402f 100644 --- a/tests/functional/inktemp.asm +++ b/tests/functional/inktemp.asm @@ -223,6 +223,100 @@ __CLS_SCR: ENDP #line 10 "plot.asm" +#line 1 "attr.asm" + + ; Attribute routines +; vim:ts=4:et:sw: + + + + +#line 1 "const.asm" + + ; Global constants + + P_FLAG EQU 23697 + FLAGS2 EQU 23681 + ATTR_P EQU 23693 ; permanet ATTRIBUTES + ATTR_T EQU 23695 ; temporary ATTRIBUTES + CHARS EQU 23606 ; Pointer to ROM/RAM Charset + UDG EQU 23675 ; Pointer to UDG Charset + MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars + +#line 8 "attr.asm" + + +__ATTR_ADDR: + ; calc start address in DE (as (32 * d) + e) + ; Contributed by Santiago Romero at http://www.speccy.org + ld h, 0 ; 7 T-States + ld a, d ; 4 T-States + add a, a ; a * 2 ; 4 T-States + add a, a ; a * 4 ; 4 T-States + ld l, a ; HL = A * 4 ; 4 T-States + + add hl, hl ; HL = A * 8 ; 15 T-States + add hl, hl ; HL = A * 16 ; 15 T-States + add hl, hl ; HL = A * 32 ; 15 T-States + + ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone) + add hl, de + + ld de, (SCREEN_ADDR) ; Adds the screen address + add hl, de + + ; Return current screen address in HL + ret + + + ; Sets the attribute at a given screen coordinate (D, E). + ; The attribute is taken from the ATTR_T memory variable + ; Used by PRINT routines +SET_ATTR: + + ; Checks for valid coords + call __IN_SCREEN + ret nc + +__SET_ATTR: + ; Internal __FASTCALL__ Entry used by printing routines + PROC + + call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address + ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T + + ld a, d + and (hl) + ld c, a ; C = current screen color, masked + + ld a, d + cpl ; Negate mask + and e ; Mask current attributes + or c ; Mix them + ld (hl), a ; Store result in screen + + ret + + ENDP + + + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 +#line 11 "plot.asm" PLOT: PROC @@ -280,21 +374,7 @@ __PLOT_OVER1: LOCAL __PLOT_END __PLOT_END: ld (hl), a - - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY + jp SET_PIXEL_ADDR_ATTR __PLOT_ERR: jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1) @@ -517,19 +597,7 @@ __CIRCLE_PLOT: #line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" -#line 1 "const.asm" - - ; Global constants - - P_FLAG EQU 23697 - FLAGS2 EQU 23681 - ATTR_P EQU 23693 ; permanet ATTRIBUTES - ATTR_T EQU 23695 ; temporary ATTRIBUTES - CHARS EQU 23606 ; Pointer to ROM/RAM Charset - UDG EQU 23675 ; Pointer to UDG Charset - MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars -#line 6 "copy_attr.asm" COPY_ATTR: ; Just copies current permanent attribs to temporal attribs @@ -583,6 +651,7 @@ __REFRESH_TMP: + #line 1 "PixelDown.asm" ; @@ -627,7 +696,7 @@ SP.PixelDown: ;ENDIF ccf ret -#line 14 "draw.asm" +#line 15 "draw.asm" #line 1 "PixelUp.asm" ; @@ -671,7 +740,7 @@ SP.PixelUp: cp $40 ;ENDIF ret -#line 15 "draw.asm" +#line 16 "draw.asm" #line 1 "PixelLeft.asm" ; @@ -705,7 +774,7 @@ SP.PixelLeft: ld a, 1 ret -#line 16 "draw.asm" +#line 17 "draw.asm" #line 1 "PixelRight.asm" ; @@ -740,7 +809,7 @@ SP.PixelRight: ld a, 80h ret -#line 17 "draw.asm" +#line 18 "draw.asm" ;; DRAW PROCEDURE PROC @@ -763,7 +832,6 @@ __DRAW_ERROR: DRAW: ;; ENTRY POINT - LOCAL PIXEL_ADDR LOCAL COORDS LOCAL __DRAW_SETUP1, __DRAW_START, __PLOTOVER, __PLOTINVERSE @@ -935,7 +1003,7 @@ __DRAW4: DY1: ; y += yi inc b - call __INCY ; This address will be dyncamically updated + call __INCY ; This address will be dynamically updated ld a, e ; Restores A reg. call __FASTPLOT @@ -999,7 +1067,6 @@ __DRAW6_LOOP: ld (COORDS), bc ret - PIXEL_ADDR EQU 22ACh COORDS EQU 5C7Dh __DRAW_END: @@ -1040,21 +1107,9 @@ __PLOTOVER: push hl push de - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - call PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY - + push bc + call SET_PIXEL_ADDR_ATTR + pop bc pop de pop hl @@ -1077,11 +1132,22 @@ __FASTPLOTEND: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -1089,11 +1155,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 46 "inktemp.bas" #line 1 "ink.asm" diff --git a/tests/functional/lcd3.asm b/tests/functional/lcd3.asm index e22716e4b..97a177b3e 100644 --- a/tests/functional/lcd3.asm +++ b/tests/functional/lcd3.asm @@ -823,9 +823,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl @@ -1202,11 +1202,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -1214,11 +1225,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -1231,12 +1249,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -1244,12 +1271,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1259,7 +1293,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -1318,7 +1352,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -1526,6 +1560,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1543,6 +1579,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/lcd7.asm b/tests/functional/lcd7.asm index 782b3e192..2bbf87ce2 100644 --- a/tests/functional/lcd7.asm +++ b/tests/functional/lcd7.asm @@ -939,11 +939,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -951,11 +962,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -968,12 +986,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -981,12 +1008,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1263,6 +1297,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1280,6 +1316,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/lcd8.asm b/tests/functional/lcd8.asm index d1397334c..f667ed392 100644 --- a/tests/functional/lcd8.asm +++ b/tests/functional/lcd8.asm @@ -941,11 +941,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -953,11 +964,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -970,12 +988,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -983,12 +1010,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1265,6 +1299,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1282,6 +1318,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/lcd9.asm b/tests/functional/lcd9.asm index 4c609fbaa..6dd924245 100644 --- a/tests/functional/lcd9.asm +++ b/tests/functional/lcd9.asm @@ -929,11 +929,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -941,11 +952,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -958,12 +976,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -971,12 +998,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1253,6 +1287,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1270,6 +1306,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/load02.asm b/tests/functional/load02.asm index 776974937..df0570b6e 100644 --- a/tests/functional/load02.asm +++ b/tests/functional/load02.asm @@ -854,11 +854,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -866,11 +877,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -883,12 +901,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -896,12 +923,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1145,6 +1179,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1162,6 +1198,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/load03.asm b/tests/functional/load03.asm index 3b1d5afc9..b1ac02089 100644 --- a/tests/functional/load03.asm +++ b/tests/functional/load03.asm @@ -853,11 +853,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -865,11 +876,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -882,12 +900,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -895,12 +922,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1144,6 +1178,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1161,6 +1197,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/loadu16ii.asm b/tests/functional/loadu16ii.asm index 9f64911bb..8b1ea3f7c 100644 --- a/tests/functional/loadu16ii.asm +++ b/tests/functional/loadu16ii.asm @@ -408,11 +408,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -420,11 +431,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -437,12 +455,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -450,12 +477,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -732,6 +766,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -749,6 +785,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/ltee1.asm b/tests/functional/ltee1.asm index f296066f8..a1aa855ea 100644 --- a/tests/functional/ltee1.asm +++ b/tests/functional/ltee1.asm @@ -955,11 +955,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -967,11 +978,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -984,12 +1002,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -997,12 +1024,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1279,6 +1313,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1296,6 +1332,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/memcpytest.asm b/tests/functional/memcpytest.asm index 81855f7cb..62b7d562c 100644 --- a/tests/functional/memcpytest.asm +++ b/tests/functional/memcpytest.asm @@ -479,11 +479,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -491,11 +502,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -508,12 +526,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -521,12 +548,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -803,6 +837,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -820,6 +856,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/ongoto.asm b/tests/functional/ongoto.asm index 4ce0906ed..2ea9b8a75 100644 --- a/tests/functional/ongoto.asm +++ b/tests/functional/ongoto.asm @@ -473,11 +473,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -485,11 +496,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -502,12 +520,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -515,12 +542,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -797,6 +831,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -814,6 +850,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/opt3_data2.asm b/tests/functional/opt3_data2.asm index c11f8bb81..79e0d1479 100644 --- a/tests/functional/opt3_data2.asm +++ b/tests/functional/opt3_data2.asm @@ -186,7 +186,7 @@ __MUL16NOADD: #line 20 "array.asm" -#line 24 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 24 "/src/zxb/trunk/library-asm/array.asm" __ARRAY: PROC @@ -209,10 +209,10 @@ __ARRAY: ld hl, 0 ; BC = Offset "accumulator" LOOP: -#line 49 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 49 "/src/zxb/trunk/library-asm/array.asm" pop bc ; Get next index (Ai) from the stack -#line 59 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 59 "/src/zxb/trunk/library-asm/array.asm" add hl, bc ; Adds current index @@ -242,7 +242,7 @@ ARRAY_END: push de exx -#line 92 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 92 "/src/zxb/trunk/library-asm/array.asm" LOCAL ARRAY_SIZE_LOOP ex de, hl @@ -273,7 +273,7 @@ ARRAY_SIZE_LOOP: ;add hl, de ;__ARRAY_FIN: -#line 123 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 123 "/src/zxb/trunk/library-asm/array.asm" pop de add hl, de ; Adds element start @@ -663,11 +663,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -675,11 +686,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -692,12 +710,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -705,12 +732,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -720,7 +754,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -779,7 +813,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -987,6 +1021,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1004,6 +1040,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
@@ -1918,9 +1968,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/opt3_einar.asm b/tests/functional/opt3_einar.asm index 4883b26b3..aeffc84fc 100644 --- a/tests/functional/opt3_einar.asm +++ b/tests/functional/opt3_einar.asm @@ -365,11 +365,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -377,11 +388,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -394,12 +412,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -407,12 +434,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -689,6 +723,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -706,6 +742,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/optconst.asm b/tests/functional/optconst.asm index 9eb89c718..31f5bb73a 100644 --- a/tests/functional/optconst.asm +++ b/tests/functional/optconst.asm @@ -355,11 +355,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -367,11 +378,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -384,12 +402,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -397,12 +424,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -679,6 +713,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -696,6 +732,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/param0.asm b/tests/functional/param0.asm index 4c00c87e2..5c8a9b9d0 100644 --- a/tests/functional/param0.asm +++ b/tests/functional/param0.asm @@ -918,11 +918,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -930,11 +941,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -947,12 +965,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -960,12 +987,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1242,6 +1276,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1259,6 +1295,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/param1.asm b/tests/functional/param1.asm index 540d7874b..7f53f6787 100644 --- a/tests/functional/param1.asm +++ b/tests/functional/param1.asm @@ -365,11 +365,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -377,11 +388,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -394,12 +412,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -407,12 +434,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -689,6 +723,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -706,6 +742,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/param2.asm b/tests/functional/param2.asm index 1016aac03..a5c0104f3 100644 --- a/tests/functional/param2.asm +++ b/tests/functional/param2.asm @@ -918,11 +918,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -930,11 +941,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -947,12 +965,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -960,12 +987,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1242,6 +1276,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1259,6 +1295,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/parambyref1.asm b/tests/functional/parambyref1.asm index 0e87ec7ed..b9e3b63cc 100644 --- a/tests/functional/parambyref1.asm +++ b/tests/functional/parambyref1.asm @@ -368,11 +368,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -380,11 +391,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -397,12 +415,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -410,12 +437,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -692,6 +726,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -709,6 +745,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/plot.asm b/tests/functional/plot.asm index 7c5835b7f..dd6c371cc 100644 --- a/tests/functional/plot.asm +++ b/tests/functional/plot.asm @@ -352,6 +352,100 @@ __CLS_SCR: ENDP #line 10 "plot.asm" +#line 1 "attr.asm" + + ; Attribute routines +; vim:ts=4:et:sw: + + + + +#line 1 "const.asm" + + ; Global constants + + P_FLAG EQU 23697 + FLAGS2 EQU 23681 + ATTR_P EQU 23693 ; permanet ATTRIBUTES + ATTR_T EQU 23695 ; temporary ATTRIBUTES + CHARS EQU 23606 ; Pointer to ROM/RAM Charset + UDG EQU 23675 ; Pointer to UDG Charset + MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars + +#line 8 "attr.asm" + + +__ATTR_ADDR: + ; calc start address in DE (as (32 * d) + e) + ; Contributed by Santiago Romero at http://www.speccy.org + ld h, 0 ; 7 T-States + ld a, d ; 4 T-States + add a, a ; a * 2 ; 4 T-States + add a, a ; a * 4 ; 4 T-States + ld l, a ; HL = A * 4 ; 4 T-States + + add hl, hl ; HL = A * 8 ; 15 T-States + add hl, hl ; HL = A * 16 ; 15 T-States + add hl, hl ; HL = A * 32 ; 15 T-States + + ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone) + add hl, de + + ld de, (SCREEN_ADDR) ; Adds the screen address + add hl, de + + ; Return current screen address in HL + ret + + + ; Sets the attribute at a given screen coordinate (D, E). + ; The attribute is taken from the ATTR_T memory variable + ; Used by PRINT routines +SET_ATTR: + + ; Checks for valid coords + call __IN_SCREEN + ret nc + +__SET_ATTR: + ; Internal __FASTCALL__ Entry used by printing routines + PROC + + call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address + ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T + + ld a, d + and (hl) + ld c, a ; C = current screen color, masked + + ld a, d + cpl ; Negate mask + and e ; Mask current attributes + or c ; Mix them + ld (hl), a ; Store result in screen + + ret + + ENDP + + + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 +#line 11 "plot.asm" PLOT: PROC @@ -409,21 +503,7 @@ __PLOT_OVER1: LOCAL __PLOT_END __PLOT_END: ld (hl), a - - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY + jp SET_PIXEL_ADDR_ATTR __PLOT_ERR: jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1) diff --git a/tests/functional/print.asm b/tests/functional/print.asm index 809d74e8c..ee907d90e 100644 --- a/tests/functional/print.asm +++ b/tests/functional/print.asm @@ -364,11 +364,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -376,11 +387,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -393,12 +411,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -406,12 +433,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -688,6 +722,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -705,6 +741,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/print_arrstr.asm b/tests/functional/print_arrstr.asm index 51eba47a9..b5949f5fc 100644 --- a/tests/functional/print_arrstr.asm +++ b/tests/functional/print_arrstr.asm @@ -708,11 +708,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -720,11 +731,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -737,12 +755,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -750,12 +777,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1032,6 +1066,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1049,6 +1085,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/read.asm b/tests/functional/read.asm index cba30ec0c..2801f7635 100644 --- a/tests/functional/read.asm +++ b/tests/functional/read.asm @@ -340,9 +340,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/read10.asm b/tests/functional/read10.asm index 63b5422f5..59ee1a221 100644 --- a/tests/functional/read10.asm +++ b/tests/functional/read10.asm @@ -582,11 +582,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -594,11 +605,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -611,12 +629,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -624,12 +651,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -639,7 +673,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -698,7 +732,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -906,6 +940,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -923,6 +959,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
@@ -2012,9 +2062,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/read12.asm b/tests/functional/read12.asm index fe10fb682..667d1f922 100644 --- a/tests/functional/read12.asm +++ b/tests/functional/read12.asm @@ -344,9 +344,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl @@ -723,11 +723,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -735,11 +746,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -752,12 +770,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -765,12 +792,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -780,7 +814,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -839,7 +873,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -1047,6 +1081,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1064,6 +1100,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/read4.asm b/tests/functional/read4.asm index 1b9ac7d58..b1627a0bb 100644 --- a/tests/functional/read4.asm +++ b/tests/functional/read4.asm @@ -383,9 +383,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/read5.asm b/tests/functional/read5.asm index 9b0a02e7d..465fec9c3 100644 --- a/tests/functional/read5.asm +++ b/tests/functional/read5.asm @@ -530,11 +530,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -542,11 +553,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -559,12 +577,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -572,12 +599,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -587,7 +621,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -646,7 +680,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -854,6 +888,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -871,6 +907,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
@@ -1910,9 +1960,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/read8.asm b/tests/functional/read8.asm index ed27a823d..d151aabcf 100644 --- a/tests/functional/read8.asm +++ b/tests/functional/read8.asm @@ -521,11 +521,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -533,11 +544,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -550,12 +568,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -563,12 +590,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -578,7 +612,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -637,7 +671,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -845,6 +879,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -862,6 +898,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
@@ -1901,9 +1951,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/read9.asm b/tests/functional/read9.asm index 545e6a697..f91121bf5 100644 --- a/tests/functional/read9.asm +++ b/tests/functional/read9.asm @@ -208,7 +208,7 @@ __MUL16NOADD: #line 20 "array.asm" -#line 24 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 24 "/src/zxb/trunk/library-asm/array.asm" __ARRAY: PROC @@ -231,10 +231,10 @@ __ARRAY: ld hl, 0 ; BC = Offset "accumulator" LOOP: -#line 49 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 49 "/src/zxb/trunk/library-asm/array.asm" pop bc ; Get next index (Ai) from the stack -#line 59 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 59 "/src/zxb/trunk/library-asm/array.asm" add hl, bc ; Adds current index @@ -264,7 +264,7 @@ ARRAY_END: push de exx -#line 92 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 92 "/src/zxb/trunk/library-asm/array.asm" LOCAL ARRAY_SIZE_LOOP ex de, hl @@ -295,7 +295,7 @@ ARRAY_SIZE_LOOP: ;add hl, de ;__ARRAY_FIN: -#line 123 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/array.asm" +#line 123 "/src/zxb/trunk/library-asm/array.asm" pop de add hl, de ; Adds element start @@ -767,11 +767,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -779,11 +790,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -796,12 +814,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -809,12 +836,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -824,7 +858,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -883,7 +917,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -1091,6 +1125,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1108,6 +1144,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
@@ -2147,9 +2197,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/readbug.asm b/tests/functional/readbug.asm index 853a4b5e7..a5db5f532 100644 --- a/tests/functional/readbug.asm +++ b/tests/functional/readbug.asm @@ -338,9 +338,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/readokdown.asm b/tests/functional/readokdown.asm index 87d8a4875..bf7488ca5 100644 --- a/tests/functional/readokdown.asm +++ b/tests/functional/readokdown.asm @@ -405,11 +405,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -417,11 +428,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -434,12 +452,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -447,12 +474,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -462,7 +496,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -521,7 +555,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -729,6 +763,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -746,6 +782,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
@@ -2460,9 +2510,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/readokup.asm b/tests/functional/readokup.asm index 1f11b134f..35d6ec1db 100644 --- a/tests/functional/readokup.asm +++ b/tests/functional/readokup.asm @@ -404,11 +404,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -416,11 +427,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -433,12 +451,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -446,12 +473,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -461,7 +495,7 @@ BRIGHT_TMP: -#line 4 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 4 "/src/zxb/trunk/library-asm/copy_attr.asm" @@ -520,7 +554,7 @@ TABLE: and (hl) ; OVER 2 MODE or (hl) ; OVER 3 MODE -#line 65 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/copy_attr.asm" +#line 65 "/src/zxb/trunk/library-asm/copy_attr.asm" __REFRESH_TMP: ld a, (hl) @@ -728,6 +762,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -745,6 +781,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
@@ -2459,9 +2509,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/simple.asm b/tests/functional/simple.asm index a7c4850a2..9aa6db693 100644 --- a/tests/functional/simple.asm +++ b/tests/functional/simple.asm @@ -347,11 +347,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -359,11 +370,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -376,12 +394,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -389,12 +416,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -671,6 +705,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -688,6 +724,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/spfill.asm b/tests/functional/spfill.asm index 652b5dada..d0479ee16 100644 --- a/tests/functional/spfill.asm +++ b/tests/functional/spfill.asm @@ -652,6 +652,100 @@ __CLS_SCR: ENDP #line 10 "plot.asm" +#line 1 "attr.asm" + + ; Attribute routines +; vim:ts=4:et:sw: + + + + +#line 1 "const.asm" + + ; Global constants + + P_FLAG EQU 23697 + FLAGS2 EQU 23681 + ATTR_P EQU 23693 ; permanet ATTRIBUTES + ATTR_T EQU 23695 ; temporary ATTRIBUTES + CHARS EQU 23606 ; Pointer to ROM/RAM Charset + UDG EQU 23675 ; Pointer to UDG Charset + MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars + +#line 8 "attr.asm" + + +__ATTR_ADDR: + ; calc start address in DE (as (32 * d) + e) + ; Contributed by Santiago Romero at http://www.speccy.org + ld h, 0 ; 7 T-States + ld a, d ; 4 T-States + add a, a ; a * 2 ; 4 T-States + add a, a ; a * 4 ; 4 T-States + ld l, a ; HL = A * 4 ; 4 T-States + + add hl, hl ; HL = A * 8 ; 15 T-States + add hl, hl ; HL = A * 16 ; 15 T-States + add hl, hl ; HL = A * 32 ; 15 T-States + + ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone) + add hl, de + + ld de, (SCREEN_ADDR) ; Adds the screen address + add hl, de + + ; Return current screen address in HL + ret + + + ; Sets the attribute at a given screen coordinate (D, E). + ; The attribute is taken from the ATTR_T memory variable + ; Used by PRINT routines +SET_ATTR: + + ; Checks for valid coords + call __IN_SCREEN + ret nc + +__SET_ATTR: + ; Internal __FASTCALL__ Entry used by printing routines + PROC + + call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address + ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T + + ld a, d + and (hl) + ld c, a ; C = current screen color, masked + + ld a, d + cpl ; Negate mask + and e ; Mask current attributes + or c ; Mix them + ld (hl), a ; Store result in screen + + ret + + ENDP + + + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 +#line 11 "plot.asm" PLOT: PROC @@ -709,21 +803,7 @@ __PLOT_OVER1: LOCAL __PLOT_END __PLOT_END: ld (hl), a - - ;; gets ATTR position with offset given in SCREEN_ADDR - ld a, h - rrca - rrca - rrca - and 3 - or 18h - ld h, a - ld de, (SCREEN_ADDR) - add hl, de ;; Final screen addr - - LOCAL PO_ATTR_2 - PO_ATTR_2 EQU 0BE4h ; Another entry to PO_ATTR - jp PO_ATTR_2 ; This will update attr accordingly. Beware, uses IY + jp SET_PIXEL_ADDR_ATTR __PLOT_ERR: jp __OUT_OF_SCREEN_ERR ; Spent 3 bytes, but saves 3 T-States at (#1) @@ -962,19 +1042,7 @@ __PAUSE: ; and A register is non-zero if the string must be freed (TMP string) -#line 1 "const.asm" - - ; Global constants - - P_FLAG EQU 23697 - FLAGS2 EQU 23681 - ATTR_P EQU 23693 ; permanet ATTRIBUTES - ATTR_T EQU 23695 ; temporary ATTRIBUTES - CHARS EQU 23606 ; Pointer to ROM/RAM Charset - UDG EQU 23675 ; Pointer to UDG Charset - MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars -#line 10 "usr_str.asm" #line 1 "free.asm" ; vim: ts=4:et:sw=4: diff --git a/tests/functional/str0.asm b/tests/functional/str0.asm index f8c791150..344d4799c 100644 --- a/tests/functional/str0.asm +++ b/tests/functional/str0.asm @@ -695,11 +695,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -707,11 +718,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -724,12 +742,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -737,12 +764,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1019,6 +1053,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1036,6 +1072,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/strbase2.asm b/tests/functional/strbase2.asm index 81309c320..37aa43dd4 100644 --- a/tests/functional/strbase2.asm +++ b/tests/functional/strbase2.asm @@ -1088,11 +1088,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -1100,11 +1111,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -1117,12 +1135,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -1130,12 +1157,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1412,6 +1446,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1429,6 +1465,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/stringparam.asm b/tests/functional/stringparam.asm index 6cb244078..407103e0e 100644 --- a/tests/functional/stringparam.asm +++ b/tests/functional/stringparam.asm @@ -920,11 +920,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -932,11 +943,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -949,12 +967,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -962,12 +989,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1244,6 +1278,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1261,6 +1297,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/strlocal0.asm b/tests/functional/strlocal0.asm index 9104b31bd..d315754af 100644 --- a/tests/functional/strlocal0.asm +++ b/tests/functional/strlocal0.asm @@ -693,11 +693,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -705,11 +716,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -722,12 +740,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -735,12 +762,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1017,6 +1051,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1034,6 +1070,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/strparam0.asm b/tests/functional/strparam0.asm index 059207f67..ba48529d7 100644 --- a/tests/functional/strparam0.asm +++ b/tests/functional/strparam0.asm @@ -950,11 +950,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -962,11 +973,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -979,12 +997,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -992,12 +1019,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1274,6 +1308,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1291,6 +1327,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/strparam2.asm b/tests/functional/strparam2.asm index 96e4cd6a3..40ad1a80e 100644 --- a/tests/functional/strparam2.asm +++ b/tests/functional/strparam2.asm @@ -387,11 +387,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -399,11 +410,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -416,12 +434,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -429,12 +456,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -711,6 +745,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -728,6 +764,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/strparam3.asm b/tests/functional/strparam3.asm index 80c2db5d7..a857c6621 100644 --- a/tests/functional/strparam3.asm +++ b/tests/functional/strparam3.asm @@ -944,11 +944,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -956,11 +967,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -973,12 +991,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -986,12 +1013,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -1268,6 +1302,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -1285,6 +1321,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/strsigil.asm b/tests/functional/strsigil.asm index e732a4ce3..bf24b92e0 100644 --- a/tests/functional/strsigil.asm +++ b/tests/functional/strsigil.asm @@ -717,9 +717,9 @@ __MEM_START: __MEM_LOOP: ; Loads lengh at (HL, HL+). If Lenght >= BC, jump to __MEM_DONE ld a, h ; HL = NULL (No memory available?) or l -#line 111 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 111 "/src/zxb/trunk/library-asm/alloc.asm" ret z ; NULL -#line 113 "/Users/boriel/Documents/src/zxbasic/zxbasic/library-asm/alloc.asm" +#line 113 "/src/zxb/trunk/library-asm/alloc.asm" ; HL = Pointer to Free block ld e, (hl) inc hl diff --git a/tests/functional/subrec.asm b/tests/functional/subrec.asm index 25ef05074..05cc91a90 100644 --- a/tests/functional/subrec.asm +++ b/tests/functional/subrec.asm @@ -527,11 +527,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -539,11 +550,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -556,12 +574,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -569,12 +596,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -851,6 +885,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -868,6 +904,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT
diff --git a/tests/functional/tap_00.tap b/tests/functional/tap_00.tap index 250677210..be1a22535 100644 Binary files a/tests/functional/tap_00.tap and b/tests/functional/tap_00.tap differ diff --git a/tests/functional/tzx_00.tzx b/tests/functional/tzx_00.tzx index b0cf1539c..d60bcbfa4 100644 Binary files a/tests/functional/tzx_00.tzx and b/tests/functional/tzx_00.tzx differ diff --git a/tests/functional/usr0.asm b/tests/functional/usr0.asm index 8096fec2a..890b0ffa7 100644 --- a/tests/functional/usr0.asm +++ b/tests/functional/usr0.asm @@ -338,11 +338,22 @@ PAPER_TMP: FLASH: ld de, ATTR_P + + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_FLASH: ; Another entry. This will set the flash flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x80 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 07Fh ; Clears previous value @@ -350,11 +361,18 @@ __SET_FLASH: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x80; Set bit 7 to enable transparency + ld (de), a + ret ; Sets the FLASH flag passed in A register in the ATTR_T variable FLASH_TMP: ld de, ATTR_T jr __SET_FLASH + ENDP #line 12 "print.asm" #line 1 "bright.asm" @@ -367,12 +385,21 @@ FLASH_TMP: BRIGHT: ld de, ATTR_P + PROC + LOCAL IS_TR + LOCAL IS_ZERO + __SET_BRIGHT: ; Another entry. This will set the bright flag at location pointer by DE - and 1 ; # Convert to 0/1 + cp 8 + jr z, IS_TR - rrca - rrca + ; # Convert to 0/1 + or a + jr z, IS_ZERO + ld a, 0x40 + +IS_ZERO: ld b, a ; Saves the color ld a, (de) and 0BFh ; Clears previous value @@ -380,12 +407,19 @@ __SET_BRIGHT: ld (de), a ret +IS_TR: ; transparent + inc de ; Points DE to MASK_T or MASK_P + ld a, (de) + or 0x40; Set bit 6 to enable transparency + ld (de), a + ret + ; Sets the BRIGHT flag passed in A register in the ATTR_T variable BRIGHT_TMP: ld de, ATTR_T jr __SET_BRIGHT - + ENDP #line 13 "print.asm" #line 1 "over.asm" @@ -662,6 +696,8 @@ __SET_ATTR: PROC call __ATTR_ADDR + +__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T ld a, d @@ -679,6 +715,20 @@ __SET_ATTR: ENDP + ; Sets the attribute at a given screen pixel address in hl + ; HL contains the address in RAM for a given pixel (not a coordinate) +SET_PIXEL_ADDR_ATTR: + ;; gets ATTR position with offset given in SCREEN_ADDR + ld a, h + rrca + rrca + rrca + and 3 + or 18h + ld h, a + ld de, (SCREEN_ADDR) + add hl, de ;; Final screen addr + jp __SET_ATTR2 #line 19 "print.asm" ; Putting a comment starting with @INIT