Rev Author Line No. Line
4985 kaklik 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title> words/accept.asm </title>
6 <meta name="keywords" content="amforth programming language Forth ATmega ATMEL">
7 <meta name="description" content="amforth - laguage Forth for ATMEL ATmega">
8 <!-- AUTOINCLUDE START "Page/Head.en.ihtml" DO NOT REMOVE -->
9 <link rel="StyleSheet" href="../../../../Web/CSS/MLAB.css" type="text/css" title="MLAB Basic Style">
10 <link rel="StyleSheet" href="../../../../Web/CSS/MLAB_Print.css" type="text/css" media="print">
11 <link rel="shortcut icon" type="image/x-icon" href="../../../../Web/PIC/MLAB.ico">
12 <script type="text/javascript" src="../../../../Web/JS/MLAB_Menu.js"></script>
13 <!-- AUTOINCLUDE END -->
14 </head>
15  
16 <body lang="en">
17  
18 <!-- AUTOINCLUDE START "Page/Header.en.ihtml" DO NOT REMOVE -->
19 <!-- ============== HEADER ============== -->
20 <div class="Header">
21 <script type="text/javascript">
22 <!--
23 SetRelativePath("../../../../");
24 DrawHeader();
25 // -->
26 </script>
27 <noscript>
28 <p><b> JavaScript is required for including of the header </b></p>
29 </noscript>
30 </div>
31 <!-- AUTOINCLUDE END -->
32  
33 <!-- AUTOINCLUDE START "Page/Menu.en.ihtml" DO NOT REMOVE -->
34 <!-- ============== MENU ============== -->
35 <div class="Menu">
36 <script type="text/javascript">
37 <!--
38 SetRelativePath("../../../../");
39 DrawMenu();
40 // -->
41 </script>
42 <noscript>
43 <p><b> JavaScript is required for including of the menu </b><p>
44 </noscript>
45 </div>
46 <!-- AUTOINCLUDE END -->
47  
48 <!-- ============== TEXT ============== -->
49 <div class="Text">
50  
51 <h1> words/accept.asm </h1>
52  
53 <p>
54 <input type=button onClick="history.back()" value="Back">
55 <input type=button onClick="history.forward()" value="Forward">
56 <a href="../WordList.en.html">Jump to Vocabulary</a>
57 </p>
58  
59 <pre>
60 ; ( addr n1 -- n2 ) System
61 ; R( -- )
62 ; reads a line with with KEY into addr until n2 characters are reveived or cr/lf detected.
63 VE_ACCEPT:
64 .db $06, &quot;accept&quot;,0
65 .dw VE_HEAD
66 .set VE_HEAD = VE_ACCEPT
67 XT_ACCEPT:
68 .dw DO_COLON
69 PFA_ACCEPT:
70 .dw XT_DUP ; ( -- addr n1 n1)
71 .dw XT_TO_R
72 .dw XT_TO_R
73 PFA_ACCEPT1: ; ( -- addr )
74 .dw XT_KEY ; ( -- addr k )
75 .dw XT_DUP ; ( -- addr k k )
76 .dw XT_DOLITERAL
77 .dw 10
78 .dw XT_NOTEQUAL
79 .dw XT_DOCONDBRANCH
80 .dw PFA_ACCEPT2
81 .dw XT_DUP
82 .dw XT_DOLITERAL
83 .dw 13
84 .dw XT_NOTEQUAL
85 .dw XT_DOCONDBRANCH
86 .dw PFA_ACCEPT2
87 ; check backspace
88 .dw XT_DUP
89 .dw XT_DOLITERAL
90 .dw 8
91 .dw XT_EQUAL
92 .dw XT_DOCONDBRANCH
93 .dw PFA_ACCEPT3
94 ; delete previous character
95 ; check beginning of line
96 .dw XT_R_FROM ; ( -- addr k n1 )
97 .dw XT_R_FETCH ; ( -- addr k n1 n2)
98 .dw XT_OVER ; ( -- addr k n1 n2 n1)
99 .dw XT_TO_R
100 .dw XT_EQUAL ; ( -- addr k f )
101 .dw XT_DOCONDBRANCH
102 .dw PFA_ACCEPT5
103 ; we are at the beginning of the line, ignore this character
104 .dw XT_DROP ; ( -- addr )
105 .dw XT_DOBRANCH
106 .dw PFA_ACCEPT1
107 PFA_ACCEPT5:
108 .dw XT_DUP ; ( -- addr k k )
109 .dw XT_EMIT ; ( -- addr k )
110 .dw XT_SPACE ; ( -- addr k )
111 .dw XT_EMIT ; ( -- addr )
112 .dw XT_1MINUS ; ( -- addr--)
113 .dw XT_R_FROM
114 .dw XT_1PLUS
115 .dw XT_DOBRANCH
116 .dw PFA_ACCEPT4
117 PFA_ACCEPT3:
118 ; check for remaining control characters, replace them with blank
119 .dw XT_DUP ; ( -- addr k k )
120 .dw XT_BL
121 .dw XT_LESS
122 .dw XT_DOCONDBRANCH
123 .dw PFA_ACCEPT6
124 .dw XT_DROP
125 .dw XT_BL
126 PFA_ACCEPT6:
127 ; emit the key
128 .dw XT_DUP ; ( -- addr k k)
129 .dw XT_EMIT ; ( -- addr k)
130 ; now store the key
131 .dw XT_OVER ; ( -- addr k addr
132 .dw XT_CSTORE ; ( -- addr)
133 .dw XT_1PLUS ; ( -- addr++)
134 .dw XT_R_FROM ; ( -- addr n1)
135 .dw XT_1MINUS ; ( -- addr n1--)
136 PFA_ACCEPT4:
137 .dw XT_DUP
138 .dw XT_TO_R
139 .dw XT_EQUALZERO
140 .dw XT_DOCONDBRANCH
141 .dw PFA_ACCEPT1
142 .dw XT_DUP
143 PFA_ACCEPT2:
144 .dw XT_SLASHKEY
145 .dw XT_DROP
146 .dw XT_DROP
147 .dw XT_R_FROM
148 .dw XT_R_FROM
149 .dw XT_SWAP
150 .dw XT_MINUS
151 .dw XT_CR
152 .dw XT_EXIT
153 </pre>
154  
155 <p>
156 <input type=button onClick="history.back()" value="Back">
157 <input type=button onClick="history.forward()" value="Forward">
158 <a href="../WordList.en.html">Jump to Vocabulary</a>
159 </p>
160  
161 </div>
162  
163 <!-- AUTOINCLUDE START "Page/Footer.en.ihtml" DO NOT REMOVE -->
164 <!-- ============== FOOTER ============== -->
165 <div class="Footer">
166 <script type="text/javascript">
167 <!--
168 SetRelativePath("../../../../");
169 DrawFooter();
170 // -->
171 </script>
172 <noscript>
173 <p><b> JavaScript is required for including of the footer </b></p>
174 </noscript>
175 </div>
176 <!-- AUTOINCLUDE END -->
177  
178 </body>
179 </html>