-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextio.dasm16
More file actions
45 lines (41 loc) · 1.23 KB
/
Copy pathtextio.dasm16
File metadata and controls
45 lines (41 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
set b, 0x2000 ;sets text to be green on black
set i, 0 ;screen cursor position
set j, 0 ;keyboard read in maker, must not exceed 16
:wait
set [0x8000+i], 0x00df ;sets initial cursor to a blinking line
set a, [0x9000+j] ;wait for input
ife a, 0
set pc, wait
ife a, 0x8 ;if delete key
set pc, del
ife a, 0xa ;if enter key
set pc, ent
bor a, b ;combines the colour info stored in b with the collected char in a
set [0x8000 + i], a ;prints the combination
jsr clearmem ;clears all back to normal
set pc, wait ;restarts waiting for new input
:del
set [0x8000+i], 0x0000 ;remove blinking line
ifg i, 0
sub i, 1 ;move screen cursor back one
jsr clearmem
set pc, wait
:ent
set [0x8000+i], 0x0000
set x, i ;this calculates the line number and adds the correct spaces to start on
div x, 32 ;new line
add x, 1
mul x, 32
sub x, 1
set i, x
jsr clearmem
set pc, wait
:clearmem
set [0x9000+j], 0 ;sets the input memory to 0
add j, 1
ife j, 16 ;if j = 16 set j = 0
set j, 0
add i, 1
ife a, 0x8
sub i, 1 ;counter inc. in cursor pos from previous line
set pc, pop