Skip to content

Commit cf504fb

Browse files
authored
Merge pull request #581 from boriel/refact/rename_const_to_sysvars
Refact/rename const to sysvars
2 parents ef8d786 + 0babdd5 commit cf504fb

135 files changed

Lines changed: 20324 additions & 23797 deletions

File tree

Some content is hidden

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

.github/workflows/python-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
poetry install
3535
- name: Cache tox environments
3636
id: cache-tox
37-
uses: actions/cache@v1
37+
uses: actions/cache@v2
3838
with:
3939
path: .tox
4040
# setup.cfg, pyproject.toml, and .pre-commit-config.yaml have

examples/colors.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
REM From the ZX Spectrum 48K Manual
2+
CLS
23

34
DIM m, n, c AS BYTE
45

@@ -16,4 +17,3 @@ FOR c = 4 TO 7
1617
INK c: PRINT c; " ";
1718
NEXT c: NEXT m
1819
PAPER 7: INK 0: BRIGHT 0
19-

examples/inputexample.bas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <input.bas>
2-
2+
border 1: cls
33
print at 10, 5; "Type something: ";
44
a$ = input(20)
55
print
66
print "You typed: "; a$
7-

src/arch/zx48k/library-asm/attr.asm

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include once <sposn.asm>
55
#include once <error.asm>
66
#include once <in_screen.asm>
7-
#include once <const.asm>
8-
#include once <cls.asm>
7+
#include once <sysvars.asm>
98

109
push namespace core
1110

@@ -14,20 +13,18 @@ __ATTR_ADDR:
1413
; Contributed by Santiago Romero at http://www.speccy.org
1514
ld h, 0 ; 7 T-States
1615
ld a, d ; 4 T-States
16+
ld d, h
1717
add a, a ; a * 2 ; 4 T-States
1818
add a, a ; a * 4 ; 4 T-States
1919
ld l, a ; HL = A * 4 ; 4 T-States
2020

2121
add hl, hl ; HL = A * 8 ; 15 T-States
2222
add hl, hl ; HL = A * 16 ; 15 T-States
2323
add hl, hl ; HL = A * 32 ; 15 T-States
24-
25-
ld d, 18h ; DE = 6144 + E. Note: 6144 is the screen size (before attr zone)
2624
add hl, de
2725

28-
ld de, (SCREEN_ADDR) ; Adds the screen address
26+
ld de, (SCREEN_ATTR_ADDR) ; Adds the screen address
2927
add hl, de
30-
3128
; Return current screen address in HL
3229
ret
3330

@@ -41,12 +38,13 @@ SET_ATTR:
4138
call __IN_SCREEN
4239
ret nc
4340

41+
call __ATTR_ADDR
42+
4443
__SET_ATTR:
4544
; Internal __FASTCALL__ Entry used by printing routines
45+
; HL contains the address of the ATTR cell to set
4646
PROC
4747

48-
call __ATTR_ADDR
49-
5048
__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address
5149
ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T
5250

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

6563
ENDP
6664

67-
68-
; Sets the attribute at a given screen pixel address in hl
69-
; HL contains the address in RAM for a given pixel (not a coordinate)
70-
SET_PIXEL_ADDR_ATTR:
71-
;; gets ATTR position with offset given in SCREEN_ADDR
72-
ld a, h
73-
rrca
74-
rrca
75-
rrca
76-
and 3
77-
or 18h
78-
ld h, a
79-
ld de, (SCREEN_ADDR)
80-
add hl, de ;; Final screen addr
81-
jp __SET_ATTR2
82-
8365
pop namespace

src/arch/zx48k/library-asm/bright.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; Sets bright flag in ATTR_P permanently
22
; Parameter: Paper color in A register
33

4-
#include once <const.asm>
4+
#include once <sysvars.asm>
55

66
push namespace core
77

src/arch/zx48k/library-asm/cls.asm

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,38 @@
1-
; JUMPS directly to spectrum CLS
2-
; This routine does not clear lower screen
1+
;; Clears the user screen (24 rows)
32

4-
;CLS EQU 0DAFh
5-
6-
; Our faster implementation
7-
8-
#include once <sposn.asm>
3+
#include once <sysvars.asm>
94

105
push namespace core
116

127
CLS:
138
PROC
149

15-
LOCAL COORDS
16-
LOCAL __CLS_SCR
17-
LOCAL ATTR_P
18-
LOCAL SCREEN
19-
2010
ld hl, 0
2111
ld (COORDS), hl
22-
ld hl, 1821h
12+
ld hl, SCR_SIZE
2313
ld (S_POSN), hl
24-
__CLS_SCR:
25-
ld hl, SCREEN
14+
ld hl, (SCREEN_ADDR)
15+
ld (DFCC), hl
2616
ld (hl), 0
2717
ld d, h
2818
ld e, l
2919
inc de
30-
ld bc, 6144
20+
ld bc, 6143
3121
ldir
3222

3323
; Now clear attributes
3424

25+
ld hl, (SCREEN_ATTR_ADDR)
26+
ld (DFCCL), hl
27+
ld d, h
28+
ld e, l
29+
inc de
3530
ld a, (ATTR_P)
3631
ld (hl), a
3732
ld bc, 767
3833
ldir
3934
ret
4035

41-
COORDS EQU 23677
42-
SCREEN EQU 16384 ; Default start of the screen (can be changed)
43-
ATTR_P EQU 23693
44-
;you can poke (SCREEN_SCRADDR) to change CLS, DRAW & PRINTing address
45-
46-
SCREEN_ADDR EQU (__CLS_SCR + 1) ; Address used by print and other screen routines
47-
; to get the start of the screen
4836
ENDP
4937

5038
pop namespace
51-

src/arch/zx48k/library-asm/const.asm

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/arch/zx48k/library-asm/copy_attr.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include once <print.asm>
33
#endif
44

5-
#include once <const.asm>
5+
#include once <sysvars.asm>
66

77
push namespace core
88

src/arch/zx48k/library-asm/draw.asm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include once <error.asm>
99
#include once <in_screen.asm>
1010

11-
#include once <cls.asm>
12-
#include once <attr.asm>
11+
#include once <sysvars.asm>
12+
#include once <set_pixel_addr_attr.asm>
1313

1414
#include once <SP/PixelDown.asm>
1515
#include once <SP/PixelUp.asm>
@@ -330,4 +330,3 @@ __FASTPLOTEND:
330330
ENDP
331331

332332
pop namespace
333-

src/arch/zx48k/library-asm/flash.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; Sets flash flag in ATTR_P permanently
22
; Parameter: Paper color in A register
33

4-
#include once <const.asm>
4+
#include once <sysvars.asm>
55

66
push namespace core
77

0 commit comments

Comments
 (0)