@@ -55,17 +55,32 @@ _screenAttributes2__leave:
5555#line 1 "/zxbasic/src/arch/zx48k/library-asm/bright.asm"
5656 ; Sets bright flag in ATTR_P permanently
5757; Parameter: Paper color in A register
58- #line 1 "/zxbasic/src/arch/zx48k/library-asm/const.asm"
59- ; Global constants
60- push namespace core
61- P_FLAG EQU 23697
62- FLAGS2 EQU 23681
63- ATTR_P EQU 23693 ; permanet ATTRIBUTES
64- ATTR_T EQU 23695 ; temporary ATTRIBUTES
65- CHARS EQU 23606 ; Pointer to ROM/RAM Charset
66- UDG EQU 23675 ; Pointer to UDG Charset
67- MEM0 EQU 5C92h ; Temporary memory buffer used by ROM chars
68- pop namespace
58+ #line 1 "/zxbasic/src/arch/zx48k/library-asm/sysvars.asm"
59+ ;; -----------------------------------------------------------------------
60+ ;; ZX Basic System Vars
61+ ;; Some of them will be mapped over Sinclair ROM ones for compatibility
62+ ;; -----------------------------------------------------------------------
63+ push namespace core
64+ SCREEN_ADDR: DW 16384 ; Screen address (can be pointed to other place to use a screen buffer)
65+ SCREEN_ATTR_ADDR: DW 22528 ; Screen attribute address (ditto.)
66+ ; These are mapped onto ZX Spectrum ROM VARS
67+ CHARS EQU 23606 ; Pointer to ROM/RAM Charset
68+ TVFLAGS EQU 23612 ; TV Flags
69+ UDG EQU 23675 ; Pointer to UDG Charset
70+ COORDS EQU 23677 ; Last PLOT coordinates
71+ FLAGS2 EQU 23681 ;
72+ ECHO_E EQU 23682 ;
73+ DFCC EQU 23684 ; Next screen addr for PRINT
74+ DFCCL EQU 23686 ; Next screen attr for PRINT
75+ S_POSN EQU 23688
76+ ATTR_P EQU 23693 ; Current Permanent ATTRS set with INK, PAPER, etc commands
77+ ATTR_T EQU 23695 ; temporary ATTRIBUTES
78+ P_FLAG EQU 23697 ;
79+ MEM0 EQU 23698 ; Temporary memory buffer used by ROM chars
80+ SCR_COLS EQU 33 ; Screen with in columns + 1
81+ SCR_ROWS EQU 24 ; Screen height in rows
82+ SCR_SIZE EQU (SCR_ROWS << 8 ) + SCR_COLS
83+ pop namespace
6984#line 5 "/zxbasic/src/arch/zx48k/library-asm/bright.asm"
7085 push namespace core
7186BRIGHT:
@@ -100,73 +115,38 @@ BRIGHT_TMP:
100115 jr __SET_BRIGHT
101116 ENDP
102117 pop namespace
103- #line 34 "attr_in_subs.bas"
118+ #line 34 "zx48k/ attr_in_subs.bas"
104119#line 1 "/zxbasic/src/arch/zx48k/library-asm/cls.asm"
105- ; JUMPS directly to spectrum CLS
106- ; This routine does not clear lower screen
107- ;CLS EQU 0DAFh
108- ; Our faster implementation
109- #line 1 "/zxbasic/src/arch/zx48k/library-asm/sposn.asm"
110- ; Printing positioning library.
111- push namespace core
112- PROC
113- LOCAL ECHO_E
114- __LOAD_S_POSN: ; Loads into DE current ROW, COL print position from S_POSN mem var.
115- ld de , (S_POSN)
116- ld hl , (MAXX)
117- or a
118- sbc hl , de
119- ex de , hl
120- ret
121- __SAVE_S_POSN: ; Saves ROW, COL from DE into S_POSN mem var.
122- ld hl , (MAXX)
123- or a
124- sbc hl , de
125- ld (S_POSN) , hl ; saves it again
126- ret
127- ECHO_E EQU 23682
128- MAXX EQU ECHO_E ; Max X position + 1
129- MAXY EQU MAXX + 1 ; Max Y position + 1
130- S_POSN EQU 23688
131- POSX EQU S_POSN ; Current POS X
132- POSY EQU S_POSN + 1 ; Current POS Y
133- ENDP
134- pop namespace
135- #line 9 "/zxbasic/src/arch/zx48k/library-asm/cls.asm"
120+ ;; Clears the user screen (24 rows)
136121 push namespace core
137122CLS:
138123 PROC
139- LOCAL COORDS
140- LOCAL __CLS_SCR
141- LOCAL ATTR_P
142- LOCAL SCREEN
143124 ld hl , 0
144125 ld (COORDS) , hl
145- ld hl , 1821h
126+ ld hl , SCR_SIZE
146127 ld (S_POSN) , hl
147- __CLS_SCR:
148- ld hl , SCREEN
128+ ld hl , (SCREEN_ADDR)
129+ ld (DFCC) , hl
149130 ld (hl) , 0
150131 ld d , h
151132 ld e , l
152133 inc de
153- ld bc , 6144
134+ ld bc , 6143
154135 ldir
155136 ; Now clear attributes
137+ ld hl , (SCREEN_ATTR_ADDR)
138+ ld (DFCCL) , hl
139+ ld d , h
140+ ld e , l
141+ inc de
156142 ld a , (ATTR_P)
157143 ld (hl) , a
158144 ld bc , 767
159145 ldir
160146 ret
161- COORDS EQU 23677
162- SCREEN EQU 16384 ; Default start of the screen (can be changed)
163- ATTR_P EQU 23693
164- ;you can poke (SCREEN_SCRADDR) to change CLS, DRAW & PRINTing address
165- SCREEN_ADDR EQU (__CLS_SCR + 1 ) ; Address used by print and other screen routines
166- ; to get the start of the screen
167147 ENDP
168148 pop namespace
169- #line 35 "attr_in_subs.bas"
149+ #line 35 "zx48k/ attr_in_subs.bas"
170150#line 1 "/zxbasic/src/arch/zx48k/library-asm/copy_attr.asm"
171151#line 4 "/zxbasic/src/arch/zx48k/library-asm/copy_attr.asm"
172152 push namespace core
@@ -197,7 +177,7 @@ __REFRESH_TMP:
197177 ret
198178 ENDP
199179 pop namespace
200- #line 36 "attr_in_subs.bas"
180+ #line 36 "zx48k/ attr_in_subs.bas"
201181#line 1 "/zxbasic/src/arch/zx48k/library-asm/ink.asm"
202182 ; Sets ink color in ATTR_P permanently
203183; Parameter: Paper color in A register
@@ -234,7 +214,7 @@ INK_TMP:
234214 jp __SET_INK
235215 ENDP
236216 pop namespace
237- #line 37 "attr_in_subs.bas"
217+ #line 37 "zx48k/ attr_in_subs.bas"
238218#line 1 "/zxbasic/src/arch/zx48k/library-asm/paper.asm"
239219 ; Sets paper color in ATTR_P permanently
240220; Parameter: Paper color in A register
@@ -274,5 +254,5 @@ PAPER_TMP:
274254 jp __SET_PAPER
275255 ENDP
276256 pop namespace
277- #line 38 "attr_in_subs.bas"
257+ #line 38 "zx48k/ attr_in_subs.bas"
278258 END
0 commit comments