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 .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
poetry install
- name: Cache tox environments
id: cache-tox
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: .tox
# setup.cfg, pyproject.toml, and .pre-commit-config.yaml have
Expand Down
2 changes: 1 addition & 1 deletion examples/colors.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
REM From the ZX Spectrum 48K Manual
CLS

DIM m, n, c AS BYTE

Expand All @@ -16,4 +17,3 @@ FOR c = 4 TO 7
INK c: PRINT c; " ";
NEXT c: NEXT m
PAPER 7: INK 0: BRIGHT 0

3 changes: 1 addition & 2 deletions examples/inputexample.bas
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <input.bas>

border 1: cls
print at 10, 5; "Type something: ";
a$ = input(20)
print
print "You typed: "; a$

30 changes: 6 additions & 24 deletions src/arch/zx48k/library-asm/attr.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include once <sposn.asm>
#include once <error.asm>
#include once <in_screen.asm>
#include once <const.asm>
#include once <cls.asm>
#include once <sysvars.asm>

push namespace core

Expand All @@ -14,20 +13,18 @@ __ATTR_ADDR:
; Contributed by Santiago Romero at http://www.speccy.org
ld h, 0 ; 7 T-States
ld a, d ; 4 T-States
ld d, h
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
ld de, (SCREEN_ATTR_ADDR) ; Adds the screen address
add hl, de

; Return current screen address in HL
ret

Expand All @@ -41,12 +38,13 @@ SET_ATTR:
call __IN_SCREEN
ret nc

call __ATTR_ADDR

__SET_ATTR:
; Internal __FASTCALL__ Entry used by printing routines
; HL contains the address of the ATTR cell to set
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

Expand All @@ -64,20 +62,4 @@ __SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address

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

pop namespace
2 changes: 1 addition & 1 deletion src/arch/zx48k/library-asm/bright.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Sets bright flag in ATTR_P permanently
; Parameter: Paper color in A register

#include once <const.asm>
#include once <sysvars.asm>

push namespace core

Expand Down
35 changes: 11 additions & 24 deletions src/arch/zx48k/library-asm/cls.asm
Original file line number Diff line number Diff line change
@@ -1,51 +1,38 @@
; JUMPS directly to spectrum CLS
; This routine does not clear lower screen
;; Clears the user screen (24 rows)

;CLS EQU 0DAFh

; Our faster implementation

#include once <sposn.asm>
#include once <sysvars.asm>

push namespace core

CLS:
PROC

LOCAL COORDS
LOCAL __CLS_SCR
LOCAL ATTR_P
LOCAL SCREEN

ld hl, 0
ld (COORDS), hl
ld hl, 1821h
ld hl, SCR_SIZE
ld (S_POSN), hl
__CLS_SCR:
ld hl, SCREEN
ld hl, (SCREEN_ADDR)
ld (DFCC), hl
ld (hl), 0
ld d, h
ld e, l
inc de
ld bc, 6144
ld bc, 6143
ldir

; Now clear attributes

ld hl, (SCREEN_ATTR_ADDR)
ld (DFCCL), hl
ld d, h
ld e, l
inc de
ld a, (ATTR_P)
ld (hl), a
ld bc, 767
ldir
ret

COORDS EQU 23677
SCREEN EQU 16384 ; Default start of the screen (can be changed)
ATTR_P EQU 23693
;you can poke (SCREEN_SCRADDR) to change CLS, DRAW & PRINTing address

SCREEN_ADDR EQU (__CLS_SCR + 1) ; Address used by print and other screen routines
; to get the start of the screen
ENDP

pop namespace

14 changes: 0 additions & 14 deletions src/arch/zx48k/library-asm/const.asm

This file was deleted.

2 changes: 1 addition & 1 deletion src/arch/zx48k/library-asm/copy_attr.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include once <print.asm>
#endif

#include once <const.asm>
#include once <sysvars.asm>

push namespace core

Expand Down
5 changes: 2 additions & 3 deletions src/arch/zx48k/library-asm/draw.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include once <error.asm>
#include once <in_screen.asm>

#include once <cls.asm>
#include once <attr.asm>
#include once <sysvars.asm>
#include once <set_pixel_addr_attr.asm>

#include once <SP/PixelDown.asm>
#include once <SP/PixelUp.asm>
Expand Down Expand Up @@ -330,4 +330,3 @@ __FASTPLOTEND:
ENDP

pop namespace

2 changes: 1 addition & 1 deletion src/arch/zx48k/library-asm/flash.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Sets flash flag in ATTR_P permanently
; Parameter: Paper color in A register

#include once <const.asm>
#include once <sysvars.asm>

push namespace core

Expand Down
11 changes: 4 additions & 7 deletions src/arch/zx48k/library-asm/in_screen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@

__IN_SCREEN:
; Returns NO carry if current coords (D, E)
; are OUT of the screen limits (MAXX, MAXY)
; are OUT of the screen limits

PROC
LOCAL __IN_SCREEN_ERR

ld hl, MAXX
ld hl, SCR_SIZE
ld a, e
cp (hl)
cp l
jr nc, __IN_SCREEN_ERR ; Do nothing and return if out of range

ld a, d
inc hl
cp (hl)
;; jr nc, __IN_SCREEN_ERR ; Do nothing and return if out of range
;; ret
cp h
ret c ; Return if carry (OK)

__IN_SCREEN_ERR:
Expand Down
2 changes: 1 addition & 1 deletion src/arch/zx48k/library-asm/ink.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Sets ink color in ATTR_P permanently
; Parameter: Paper color in A register

#include once <const.asm>
#include once <sysvars.asm>

push namespace core

Expand Down
2 changes: 1 addition & 1 deletion src/arch/zx48k/library-asm/over.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Sets OVER flag in P_FLAG permanently
; Parameter: OVER flag in bit 0 of A register
#include once <copy_attr.asm>
#include once <const.asm>
#include once <sysvars.asm>

push namespace core

Expand Down
2 changes: 1 addition & 1 deletion src/arch/zx48k/library-asm/paper.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Sets paper color in ATTR_P permanently
; Parameter: Paper color in A register

#include once <const.asm>
#include once <sysvars.asm>

push namespace core

Expand Down
4 changes: 2 additions & 2 deletions src/arch/zx48k/library-asm/plot.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include once <error.asm>
#include once <in_screen.asm>
#include once <cls.asm>
#include once <attr.asm>
#include once <sysvars.asm>
#include once <set_pixel_addr_attr.asm>

push namespace core

Expand Down
Loading