File tree Expand file tree Collapse file tree 1 file changed +112
-36
lines changed Expand file tree Collapse file tree 1 file changed +112
-36
lines changed Original file line number Diff line number Diff line change 1
1
; ---
2
- ; void os_GetStringInput(char *string, char *buf, size_t bufsize )
2
+ ; void os_GetStringInput(char *string, char *buf, size_t size )
3
3
; ---
4
4
5
5
.def _os_GetStringInput
6
6
.assume adl=1
7
7
8
+ kUp := 3
9
+ kLeft := 2
10
+ kDown := 4
11
+ kEnter := 5
12
+ kClear := 9
13
+ kRight := 1
14
+ curLock := 4
15
+ flags := $D00080
16
+ curRow := $D00595
17
+ curUnder := $D00599
18
+ _PutS := $207C0
19
+ _PutC := $207B8
20
+ _PutPS := $207C8
21
+ _GetKey := $20D8C
22
+ _CursorOn := $208B0
23
+ _CursorOff := $208A8
24
+ _PullDownChk := $208BC
25
+ _ConvKeyToTok := $20E40
26
+ _GetTokString := $20874
27
+ _PutTokString := $20D74
28
+
8
29
_os_GetStringInput:
9
30
push ix
10
31
ld ix,0
@@ -13,46 +34,101 @@ _os_GetStringInput:
13
34
add hl,de
14
35
xor a,a
15
36
sbc hl,de
16
- ld de,0D00879h ; ioPrompt
17
- jr z,donecopy
18
- copyloop:
37
+ jr z,__nodisp
38
+ ld iy,flags
39
+ call _PutS
40
+ __nodisp:
41
+ ld hl,(curRow)
42
+ ld (__savecur),hl
43
+ ld a,(ix+12)
44
+ dec a
45
+ ld (ix+12),a
46
+ ld (ix+6),a
47
+ __start:
48
+ ld de,(ix+9)
49
+ __loop:
50
+ ld a,' '
51
+ ld (curUnder),a
52
+ push de
53
+ push ix
54
+ call _CursorOn
55
+ __getkey:
56
+ call _GetKey
57
+ call _CursorOff
58
+ call _PullDownChk
59
+ call _CursorOn
60
+ jr c,__getkey
61
+ cp a,kLeft
62
+ jr z,__loop
63
+ cp a,kDown
64
+ jr z,__loop
65
+ cp a,kRight
66
+ jr z,__loop
67
+ cp a,kUp
68
+ jr z,__loop
69
+ cp a,kClear
70
+ jr z,__clearpop
71
+ cp a,kEnter
72
+ jr z,__done
73
+ call _ConvKeyToTok
74
+ call _GetTokString
75
+ pop ix
76
+ pop de
77
+ ld b,(hl)
78
+ inc hl
79
+ ld a,(ix+12)
80
+ sub a,b
81
+ jr nc,__notfull
82
+ ld b,(ix+12)
83
+ xor a,a
84
+ __notfull:
85
+ ld (ix+12),a
86
+ __draw:
19
87
ld a,(hl)
20
- or a,a
21
- jr z,donecopy
22
88
ld (de),a
23
89
inc hl
24
90
inc de
25
- jr copyloop ; copy the input prompt here
26
- donecopy:
27
- ld (de),a
28
- ld (0D00599h),a ; curUnder
29
- ld iy,0D00080h
30
- ld b,(iy+9)
31
- ld c,(iy+28) ; back up old flag values
32
- res 6,(iy+28)
33
- set 7,(iy+9)
34
- push ix
35
- push bc
36
- call 021320h ; _GetStringInput, get the input from the user
37
- pop bc
38
- res 4,b ; restore old flag values
39
- ld (iy+9),b
40
- ld (iy+28),c
41
- ld hl,(0D0244Eh) ; editSym
42
- call 020AE8h ; _VarNameToOP1HL, lookup the temporary input symbol
43
- call 02050Ch ; _ChkFindSym
91
+ call _PutC
92
+ djnz __draw
93
+ ld a,(ix+12)
94
+ or a,a
95
+ jr nz,__loop
96
+ __full:
97
+ ld a,' '
98
+ ld (curUnder),a
99
+ call _GetKey
100
+ cp a,kClear
101
+ jr z,__clear
102
+ cp a,kEnter
103
+ jr z,__exit
104
+ jr __full
105
+ __clearpop:
44
106
pop ix
45
- jr c,SomeError
46
- ex de,hl
47
- inc hl
48
- inc hl
49
- ld de,(ix+9) ; hl -> input string prompt
50
- ld bc,(ix+12) ; bc = input string length
51
- dec bc
52
- ldir
107
+ pop de
108
+ __clear:
109
+ __savecur := $+1
110
+ ld hl,0
111
+ ld (curRow),hl
112
+ ld a,(ix+6)
113
+ ld b,(ix+12)
114
+ ld (ix+12),a
115
+ sub a,b
116
+ ld b,a
117
+ inc b
118
+ __clearloop:
119
+ ld a,' '
120
+ call _PutC
121
+ djnz __clearloop
122
+ ld hl,(__savecur)
123
+ ld (curRow),hl
124
+ jr __start
125
+ __done:
126
+ pop ix
127
+ pop de
128
+ __exit:
129
+ ld a,' '
130
+ ld (curUnder),a
53
131
xor a,a
54
- ld (de),a ; null terminate the string
55
- SomeError:
56
- call 021578h ; DeleteTempEditEqu, delete the temporary input
132
+ ld (de),a
57
133
pop ix
58
134
ret
You can’t perform that action at this time.
0 commit comments