Skip to content

Commit 7f6d311

Browse files
committed
adding methods, and LCD type and LCD methods
1 parent 0764bd8 commit 7f6d311

File tree

6 files changed

+278
-4
lines changed

6 files changed

+278
-4
lines changed

commands.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,18 @@ means, for example, `Text(Y,1,"?"` will draw at pixel coordinates x=4, and
230230
- `SETFONT(2)` this also uses the small font, but you can draw text to pixel coordinates. **Default**
231231

232232

233-
233+
## LCD commands
234+
The built-in var, `LCD` is a `display` type. On the TI-83+/84+ series, you can:
235+
- `LCD.OFF()` to turn the LCD off
236+
- `LCD.ON()` to turn the LCD on
237+
- `LCD.CONTRAST(val)` to set teh contrast (0 to 63)
238+
- `LCD.ZSHIFT(val)` to set the z-shift value (0 to 63, if you don't know what this is, definitely play with this.
239+
- `LCD.FLIP(val)` on *some* calculators, the LCD has special commands to flip
240+
the LCD horizontally and vertically. This could be useful, but remember that not
241+
all calcs have this.
242+
243+
I don't know how useful this is, but you can also do something like `LCD→Z`,
244+
which means now you can use any of the commands via `Z`.
234245

235246
## CHAR()
236247
`CHAR(val)` converts `val` to a char. For example, to display the `@` symbol:

src/01.z80

+120
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ xconst_to:
5353
call xconst
5454
jp mov10
5555

56+
pop_operand_p1:
57+
ld hl,pop_operand
58+
ld (prev_page_call_address),hl
59+
jp prev_page_call
60+
5661
popoperand_ui8_p1:
5762
ld hl,popoperand_ui8
5863
ld (prev_page_call_address),hl
@@ -78,6 +83,21 @@ pushoperand_char_p1:
7883
ld (prev_page_call_address),hl
7984
jp prev_page_call
8085

86+
err_bad_input_p1:
87+
ld hl,err_bad_input
88+
ld (prev_page_call_address),hl
89+
jp prev_page_call
90+
91+
err_syntax_p1:
92+
ld hl,err_syntax
93+
ld (prev_page_call_address),hl
94+
jp prev_page_call
95+
96+
err_fatal_p1:
97+
ld hl,err_fatal
98+
ld (prev_page_call_address),hl
99+
jp prev_page_call
100+
81101
eval_func_p1:
82102
;A is the func to evaluate, <128
83103
ld hl,internal_eval_table
@@ -96,6 +116,7 @@ internal_eval_table:
96116
.dw eval_setmode
97117
.dw eval_char
98118
.dw eval_setfont
119+
.dw eval_method
99120

100121
eval_setfont:
101122
call popoperand_ui8_p1
@@ -126,4 +147,103 @@ eval_getmode:
126147
ld de,(flags+userflags)
127148
jp pushoperand_ui16_p1
128149

150+
eval_method:
151+
;opstack should contain a 0, then the type, then the function number*2
152+
ld hl,(opstack_ptr)
153+
ld a,(hl)
154+
or a
155+
jp nz,err_fatal_p1
156+
inc hl
157+
ld a,(hl)
158+
inc hl
159+
ld c,(hl)
160+
inc hl
161+
ld (opstack_ptr),hl
162+
ld hl,eval_method_type_LUT
163+
add a,a
164+
add a,l
165+
ld l,a
166+
jr nc,$+3
167+
inc h
168+
ld a,(hl)
169+
inc hl
170+
ld h,(hl)
171+
ld l,a
172+
or h
173+
jp z,err_syntax_p1
174+
;now HL points to the table for this type
175+
ld b,0
176+
add hl,bc ;BC is already times 2
177+
ld a,(hl)
178+
inc hl
179+
ld h,(hl)
180+
ld l,a
181+
jp (hl)
182+
183+
eval_method_type_LUT:
184+
.dw 0 ;00 ui8
185+
.dw 0 ;01
186+
.dw 0 ;02
187+
.dw 0 ;03
188+
.dw 0 ;04
189+
.dw 0 ;05
190+
.dw 0 ;06
191+
.dw 0 ;07
192+
.dw 0 ;08
193+
.dw 0 ;09
194+
.dw 0 ;0A
195+
.dw 0 ;0B
196+
.dw 0 ;0C
197+
.dw 0 ;0D
198+
.dw 0 ;0E
199+
.dw 0 ;0F
200+
.dw 0 ;10
201+
.dw 0 ;11
202+
.dw 0 ;12
203+
.dw method_display ;13 display
204+
205+
method_display:
206+
.dw display_contrast
207+
.dw display_flip
208+
.dw display_zshift
209+
.dw display_off
210+
.dw display_on
211+
212+
display_contrast:
213+
call popoperand_ui8_p1
214+
add a,$C0
215+
jp c,err_bad_input_p1
216+
out (16),a
217+
call pop_end_of_params_p1
218+
jp pop_operand_p1
219+
220+
display_zshift:
221+
call popoperand_ui8_p1
222+
and 63
223+
add a,$40
224+
out (16),a
225+
call pop_end_of_params_p1
226+
jp pop_operand_p1
227+
228+
display_off:
229+
ld a,3
230+
out (16),a
231+
call pop_end_of_params_p1
232+
jp pop_operand_p1
233+
234+
display_on:
235+
ld a,2
236+
out (16),a
237+
call pop_end_of_params_p1
238+
jp pop_operand_p1
239+
240+
display_flip:
241+
;Some calcs have an LCD with commands to flip the display vertically/horizontally
242+
call popoperand_ui8_p1
243+
and 3
244+
add a,$0C
245+
out (16),a
246+
call pop_end_of_params_p1
247+
jp pop_operand_p1
248+
129249
.echo "Page 1: ",$8000-$," bytes remaining"

src/commandtable.z80

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ CommandJumpTable:
6363
.dw exec_num ; 37
6464
.dw exec_num ; 38
6565
.dw exec_num ; 39
66-
.dw ErrBadToken ; 3A
66+
.dw exec_dec ; 3A
6767
.dw ErrBadToken ; 3B
6868
.dw ErrBadToken ; 3C
6969
.dw ErrBadToken ; 3D

src/ops/sto.z80

+6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ eval_sto_LUT:
2424
.dw sto_list
2525
.dw sto_list_ref
2626
.dw sto_char
27+
.dw sto_ref
28+
.dw sto_display
2729
_:
2830

31+
sto_display:
32+
ld a,type_display
33+
jr sto_
2934

3035
sto_char:
3136
ld a,type_char
@@ -77,6 +82,7 @@ sto_:
7782
ldir
7883
ret
7984

85+
sto_ref:
8086
sto_var:
8187
jp err_syntax
8288

src/parsnip.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,15 @@ type_list = 15
142142
type_list_ref = 16
143143
type_char = 17
144144
type_ref = 18
145-
145+
type_display = 19
146146
147147
X_CONST_0 = 6
148148
X_CONST_1 = 7
149149
X_CONST_PI = 0
150150
X_CONST_e = 1
151151
152152
tok_internal = $F1
153+
tok_method = $04 ;2-byte
153154
tok_index = $FF
154155
155156
;===============================================================

0 commit comments

Comments
 (0)