Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.18.3
current_version = 1.18.4

[bumpversion:file:src/zxbc/version.py]
search = VERSION: Final[str] = "{current_version}"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[v1.18.4](https://github.com/boriel-basic/zxbasic/tree/v1.18.4)
===
+ ! Fixed a bug with arrays and strings
+ Updated documentation
+ Added Scroll-Aligned (aligned to column) functions

[v1.18.3](https://github.com/boriel-basic/zxbasic/tree/v1.18.3)
===
+ ! Fix `ByRef` with an array element
Expand Down
12 changes: 6 additions & 6 deletions docs/archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ repository (git).
You can contribute to ZX BASIC by reporting possible bugs or improvement suggestions at the
[forum](https://forum.boriel.com/) or in social media.

The latest stable version is <span style={{color: "green"}}>**1.18.3**</span>.
The latest stable version is <span style={{color: "green"}}>**1.18.4**</span>.
Click on the desired icon below to download the package suitable for your platform:

* [<img src="https://zxbasic.readthedocs.io/en/docs/img/win32.png" alt="win32zip" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.3-win32.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.3-win32.zip)
https://www.boriel.com/files/zxb/zxbasic-1.18.4-win32.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.4-win32.zip)
<br />Windows .exe zip package. No install needed, just uncompress it in a directory of your choice.
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/macos.png" alt="macostargz" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.3-macos.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.3-macos.tar.gz)
https://www.boriel.com/files/zxb/zxbasic-1.18.4-macos.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.4-macos.tar.gz)
<br />Mac OS x64 package. No install needed, just uncompress it in a directory of your choice (needs Python installed
in your system).
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/linux.png" alt="macostargz" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.3-linux64.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.3-linux64.tar.gz)
https://www.boriel.com/files/zxb/zxbasic-1.18.4-linux64.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.4-linux64.tar.gz)
<br />Linux x64 binary package. No install needed, just uncompress it in a directory of your choice.
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/zip-package.png" alt="zip" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.3.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.3.zip)
https://www.boriel.com/files/zxb/zxbasic-1.18.4.zip](https://www.boriel.com/files/zxb/zxbasic-1.18.4.zip)
<br />Windows, Linux, Mac zip package, with python scripts. Requires python installed in your system.
<br/>&nbsp;
* [<img src="https://zxbasic.readthedocs.io/en/docs/img/driver-down.png" alt="tar.gz" width="32px"/>
https://www.boriel.com/files/zxb/zxbasic-1.18.3.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.3.tar.gz)
https://www.boriel.com/files/zxb/zxbasic-1.18.4.tar.gz](https://www.boriel.com/files/zxb/zxbasic-1.18.4.tar.gz)
<br />Windows, Linux, Mac tar.gz package, with python scripts. Requires python installed in your system.

### What's new
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "zxbasic"
version = "1.18.3"
version = "1.18.4"
description = "Boriel's ZX BASIC Compiler"
authors = ["Jose Rodriguez <zxbasic@boriel.com>"]
license = "AGPL-3.0-or-later"
Expand Down
316 changes: 316 additions & 0 deletions src/lib/arch/zx48k/stdlib/scroll.bas
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,322 @@ EMPTYLINE:
end asm
end sub


' ----------------------------------------------------------------
' sub ScrollRightAligned
' pixel by pixel right scroll.
' scrolls 1 pixel right the window defined by (x1, y1, x2, y2)
' This scroll is aligned to columns.
' x1 and x2 are divided by 8 and rounded down (floor) to get the column number (0..31)
' ----------------------------------------------------------------
sub fastcall ScrollRightAligned(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte)
asm
push namespace core

PROC
LOCAL LOOP1
LOCAL LOOP2

; a = x1
pop hl ; RET address
pop bc ; b = y1
pop de ; d = x2
ex (sp), hl ; h = y2, (sp) = RET address. Stack ok now

ld c, a ; BC = y1x1
ld a, d
sub c
ret c ; x1 > x2

srl a
srl a
srl a
inc a
ld e, a ; e = (x2 - x1) / 8 + 1

ld a, h
sub b
ret c ; y1 > y2

inc a
ld d, a ; d = y2 - y1 + 1

ld b, h ; BC = y2x1
ld a, 191
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
ld b, e ; C cols
or a ; clear carry flag
LOOP2:
rr (hl)
inc hl
djnz LOOP2
pop hl

dec d
ret z
call SP.PixelDown
jp LOOP1
ENDP

pop namespace
end asm
end sub


' ----------------------------------------------------------------
' sub ScrolLeftAligned
' pixel by pixel left scroll
' scrolls 1 pixel left the window defined by (x1, y1, x2, y2)
' This scroll is aligned to columns.
' x1 and x2 are divided by 8 and rounded down (floor) to get the column number (0..31)
' ----------------------------------------------------------------
sub fastcall ScrollLeftAligned(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte)
asm
push namespace core

PROC
LOCAL LOOP1
LOCAL LOOP2

; a = x1
pop hl ; RET address
pop bc ; b = y1
pop de ; d = x2
ex (sp), hl ; h = y2, (sp) = RET address. Stack ok now

ld c, a ; BC = y1x1
ld a, d
sub c
ret c ; x1 > x2

srl a
srl a
srl a
inc a
ld e, a ; e = (x2 - x1) / 8 + 1

ld a, h
sub b
ret c ; y1 > y2

ld c, d
inc a
ld d, a ; d = y2 - y1 + 1

ld b, h ; BC = y2x1
ld a, 191
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
ld b, e ; C cols
or a ; clear carry flag
LOOP2:
rl (hl)
dec hl
djnz LOOP2
pop hl

dec d
ret z
call SP.PixelDown
jp LOOP1
ENDP

pop namespace
end asm
end sub


' ----------------------------------------------------------------
' sub ScrolUpAligned
' pixel by pixel up scroll
' scrolls 1 pixel up the window defined by (x1, y1, x2, y2)
' This scroll is aligned to columns.
' x1 and x2 are divided by 8 and rounded down (floor) to get the column number (0..31)
' ----------------------------------------------------------------
sub fastcall ScrollUpAligned(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte)
asm
push namespace core

PROC
LOCAL LOOP1

; a = x1
pop hl ; RET address
pop bc ; b = y1
pop de ; d = x2
ex (sp), hl ; h = y2, (sp) = RET address. Stack ok now

ld c, a ; BC = y1x1
ld a, d
sub c
ret c ; x1 > x2

srl a
srl a
srl a
inc a
ld e, a ; e = (x2 - x1) / 8 + 1
ex af, af' ; save it for later

ld a, h
sub b
ret c ; y1 > y2

inc a
ld d, a ; d = y2 - y1 + 1

ld b, h ; BC = y2x1
ld a, 191
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
exx
ld b, a ; Scan lines counter
ex af, af' ; Recovers cols
ld c, a
jp LOOP_START

LOOP1:
exx
ld d, h
ld e, l
ld c, a ; C cols
call SP.PixelDown
push hl
ldir
pop hl
exx
ld a, c ; Recovers C Cols
LOCAL LOOP_START
LOOP_START:
djnz LOOP1

; Clears bottom line
exx
ld (hl), 0
ld d, h
ld e, l
inc de
ld c, a
dec c
ret z
ldir
ENDP

pop namespace
end asm
end sub


' ----------------------------------------------------------------
' sub ScrolDownAligned
' pixel by pixel down scroll
' scrolls 1 pixel down the window defined by (x1, y1, x2, y2)
' This scroll is aligned to columns.
' x1 and x2 are divided by 8 and rounded down (floor) to get the column number (0..31)
' ----------------------------------------------------------------
sub fastcall ScrollDownAligned(x1 as uByte, y1 as uByte, x2 as Ubyte, y2 as Ubyte)
asm
push namespace core

PROC
LOCAL LOOP1

; a = x1
pop hl ; RET address
pop bc ; b = y1
pop de ; d = x2
ex (sp), hl ; h = y2, (sp) = RET address. Stack ok now

ld c, a ; BC = y1x1
ld a, d
sub c
ret c ; x1 > x2

srl a
srl a
srl a
inc a
ld e, a ; e = (x2 - x1) / 8 + 1
ex af, af' ; save it for later

ld a, h
sub b
ret c ; y1 > y2

inc a
ld d, a ; d = y2 - y1 + 1

ld a, 191
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
exx
ld b, a ; Scan lines counter
ex af, af' ; Recovers cols
ld c, a
jp LOOP_START

LOOP1:
exx
ld d, h
ld e, l
ld c, a ; C cols
call SP.PixelUp
push hl
ldir
pop hl
exx
ld a, c ; Recovers C Cols
LOCAL LOOP_START
LOOP_START:
djnz LOOP1

; Clears top line
exx
ld (hl), 0
ld d, h
ld e, l
inc de
ld c, a
dec c
ret z
ldir

ENDP

pop namespace
end asm
end sub


#pragma pop(case_insensitive)

REM the following is required, because it defines SCREEN_ADDR and SCREEN_ATTR_ADDR
Expand Down
Loading