From fac6141c80cc57d3f095d6c449a753f5888ec9bf Mon Sep 17 00:00:00 2001 From: Jose Rodriguez Date: Sun, 15 Jan 2023 13:32:35 +0100 Subject: [PATCH] feat: make scroll to use the srcbuffer --- src/arch/zx48k/library/scroll.bas | 22 +++++++++++++++++++++- src/arch/zx48k/library/winscroll.bas | 27 ++++++++++++++++++--------- src/arch/zxnext/library/scroll.bas | 22 +++++++++++++++++++++- src/arch/zxnext/library/winscroll.bas | 27 ++++++++++++++++++--------- 4 files changed, 78 insertions(+), 20 deletions(-) diff --git a/src/arch/zx48k/library/scroll.bas b/src/arch/zx48k/library/scroll.bas index 0a0c1b2d9..33cfa9919 100644 --- a/src/arch/zx48k/library/scroll.bas +++ b/src/arch/zx48k/library/scroll.bas @@ -58,6 +58,9 @@ sub fastcall ScrollRight(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset LOOP1: push hl @@ -123,6 +126,9 @@ sub fastcall ScrollLeft(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset LOOP1: push hl @@ -187,6 +193,9 @@ sub fastcall ScrollUp(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset ld a, d ; Num. of scan lines ld b, 0 @@ -194,6 +203,8 @@ __PIXEL_ADDR EQU 22ACh ld b, a ; Scan lines counter ex af, af' ; Recovers cols ld c, a + jp LOOP_START + LOOP1: exx ld d, h @@ -205,6 +216,8 @@ LOOP1: pop hl exx ld a, c ; Recovers C Cols + LOCAL LOOP_START +LOOP_START: djnz LOOP1 ; Clears bottom line @@ -265,6 +278,9 @@ sub fastcall ScrollDown(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset ld a, d ; Num. of scan lines ld b, 0 @@ -272,6 +288,8 @@ __PIXEL_ADDR EQU 22ACh ld b, a ; Scan lines counter ex af, af' ; Recovers cols ld c, a + jp LOOP_START + LOOP1: exx ld d, h @@ -283,6 +301,8 @@ LOOP1: pop hl exx ld a, c ; Recovers C Cols + LOCAL LOOP_START +LOOP_START: djnz LOOP1 ; Clears top line @@ -310,4 +330,4 @@ REM the following is required, because it defines screen start addr #require "SP/PixelUp.asm" -#endif \ No newline at end of file +#endif diff --git a/src/arch/zx48k/library/winscroll.bas b/src/arch/zx48k/library/winscroll.bas index e96c6ac5f..45e5a9a4e 100644 --- a/src/arch/zx48k/library/winscroll.bas +++ b/src/arch/zx48k/library/winscroll.bas @@ -43,7 +43,6 @@ sub fastcall WinScrollRight(row as uByte, col as uByte, width as Ubyte, height a push bc ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -56,6 +55,8 @@ sub fastcall WinScrollRight(row as uByte, col as uByte, width as Ubyte, height a add a,d dec a ld l,a ;HL=top-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld b,e BucleChars: @@ -100,8 +101,9 @@ BucleScans: dec a ld l,a ld a,h - add a,58h ld h,a ;HL=top-left window address in attr coord + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e BucleAttrs: @@ -155,7 +157,6 @@ sub fastcall WinScrollLeft(row as uByte, col as uByte, width as Ubyte, height as push bc ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -166,6 +167,8 @@ sub fastcall WinScrollLeft(row as uByte, col as uByte, width as Ubyte, height as add a,a add a,c ld l,a ;HL=top-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld b,e BucleChars: @@ -209,8 +212,9 @@ BucleScans: add a,c ld l,a ld a,h - add a,58h ld h,a ;HL=top-left address in attr coords + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e BucleAttrs: @@ -266,7 +270,6 @@ sub fastcall WinScrollUp(row as uByte, col as uByte, width as Ubyte, height as U ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -277,6 +280,8 @@ sub fastcall WinScrollUp(row as uByte, col as uByte, width as Ubyte, height as U add a,a add a,c ld l,a ;HL=top-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld a,e ld c, d ; c = width ld d, h @@ -351,8 +356,9 @@ ScrollAttrs: add a,c ld l,a ld a,h - add a,58h ld h,a ;HL=top-left address in attr coords + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e dec b ret z @@ -414,7 +420,6 @@ sub fastcall WinScrollDown(row as uByte, col as uByte, width as Ubyte, height as ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -425,6 +430,8 @@ sub fastcall WinScrollDown(row as uByte, col as uByte, width as Ubyte, height as add a,a add a,c ld l,a ;HL=bottom-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld a,e ld c, d ; c = width ld d, h @@ -499,8 +506,9 @@ ScrollAttrs: add a,c ld l,a ld a,h - add a,58h ld h,a ;HL=top-left address in attr coords + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e dec b ret z @@ -533,6 +541,7 @@ REM the following is required, because it defines screen start addr #require "cls.asm" #require "SP/PixelDown.asm" #require "SP/PixelUp.asm" +#require "sysvars.asm" -#endif \ No newline at end of file +#endif diff --git a/src/arch/zxnext/library/scroll.bas b/src/arch/zxnext/library/scroll.bas index 0a0c1b2d9..33cfa9919 100644 --- a/src/arch/zxnext/library/scroll.bas +++ b/src/arch/zxnext/library/scroll.bas @@ -58,6 +58,9 @@ sub fastcall ScrollRight(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset LOOP1: push hl @@ -123,6 +126,9 @@ sub fastcall ScrollLeft(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset LOOP1: push hl @@ -187,6 +193,9 @@ sub fastcall ScrollUp(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset ld a, d ; Num. of scan lines ld b, 0 @@ -194,6 +203,8 @@ __PIXEL_ADDR EQU 22ACh ld b, a ; Scan lines counter ex af, af' ; Recovers cols ld c, a + jp LOOP_START + LOOP1: exx ld d, h @@ -205,6 +216,8 @@ LOOP1: pop hl exx ld a, c ; Recovers C Cols + LOCAL LOOP_START +LOOP_START: djnz LOOP1 ; Clears bottom line @@ -265,6 +278,9 @@ sub fastcall ScrollDown(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte) LOCAL __PIXEL_ADDR __PIXEL_ADDR EQU 22ACh call __PIXEL_ADDR + res 6, h ; Starts from 0 + ld bc, (SCREEN_ADDR) + add hl, bc ; Now current offset ld a, d ; Num. of scan lines ld b, 0 @@ -272,6 +288,8 @@ __PIXEL_ADDR EQU 22ACh ld b, a ; Scan lines counter ex af, af' ; Recovers cols ld c, a + jp LOOP_START + LOOP1: exx ld d, h @@ -283,6 +301,8 @@ LOOP1: pop hl exx ld a, c ; Recovers C Cols + LOCAL LOOP_START +LOOP_START: djnz LOOP1 ; Clears top line @@ -310,4 +330,4 @@ REM the following is required, because it defines screen start addr #require "SP/PixelUp.asm" -#endif \ No newline at end of file +#endif diff --git a/src/arch/zxnext/library/winscroll.bas b/src/arch/zxnext/library/winscroll.bas index e96c6ac5f..45e5a9a4e 100644 --- a/src/arch/zxnext/library/winscroll.bas +++ b/src/arch/zxnext/library/winscroll.bas @@ -43,7 +43,6 @@ sub fastcall WinScrollRight(row as uByte, col as uByte, width as Ubyte, height a push bc ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -56,6 +55,8 @@ sub fastcall WinScrollRight(row as uByte, col as uByte, width as Ubyte, height a add a,d dec a ld l,a ;HL=top-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld b,e BucleChars: @@ -100,8 +101,9 @@ BucleScans: dec a ld l,a ld a,h - add a,58h ld h,a ;HL=top-left window address in attr coord + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e BucleAttrs: @@ -155,7 +157,6 @@ sub fastcall WinScrollLeft(row as uByte, col as uByte, width as Ubyte, height as push bc ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -166,6 +167,8 @@ sub fastcall WinScrollLeft(row as uByte, col as uByte, width as Ubyte, height as add a,a add a,c ld l,a ;HL=top-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld b,e BucleChars: @@ -209,8 +212,9 @@ BucleScans: add a,c ld l,a ld a,h - add a,58h ld h,a ;HL=top-left address in attr coords + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e BucleAttrs: @@ -266,7 +270,6 @@ sub fastcall WinScrollUp(row as uByte, col as uByte, width as Ubyte, height as U ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -277,6 +280,8 @@ sub fastcall WinScrollUp(row as uByte, col as uByte, width as Ubyte, height as U add a,a add a,c ld l,a ;HL=top-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld a,e ld c, d ; c = width ld d, h @@ -351,8 +356,9 @@ ScrollAttrs: add a,c ld l,a ld a,h - add a,58h ld h,a ;HL=top-left address in attr coords + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e dec b ret z @@ -414,7 +420,6 @@ sub fastcall WinScrollDown(row as uByte, col as uByte, width as Ubyte, height as ld a,b and 18h - or 40h ld h,a ld a,b and 07h @@ -425,6 +430,8 @@ sub fastcall WinScrollDown(row as uByte, col as uByte, width as Ubyte, height as add a,a add a,c ld l,a ;HL=bottom-left window address in bitmap coord + ld bc, (SCREEN_ADDR) + add hl, bc ld a,e ld c, d ; c = width ld d, h @@ -499,8 +506,9 @@ ScrollAttrs: add a,c ld l,a ld a,h - add a,58h ld h,a ;HL=top-left address in attr coords + ld bc, (SCREEN_ATTR_ADDR) + add hl, bc ld b,e dec b ret z @@ -533,6 +541,7 @@ REM the following is required, because it defines screen start addr #require "cls.asm" #require "SP/PixelDown.asm" #require "SP/PixelUp.asm" +#require "sysvars.asm" -#endif \ No newline at end of file +#endif