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/digit.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/digit.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 ; ( c base -- number flag ) Numeric IO
61 ; R( -- )
62 ; convert character to number, set flag if successful
63 VE_DIGIT:
64 .db $05, &quot;digit&quot;
65 .dw VE_HEAD
66 .set VE_HEAD = VE_DIGIT
67 XT_DIGIT:
68 .dw DO_COLON
69 PFA_DIGIT:
70 .dw XT_SWAP
71 ; [char] 0 -
72 .dw XT_DOLITERAL
73 .dw $30 ; '0'
74 .dw XT_MINUS
75  
76 ; dup 9 &gt;
77 .dw XT_DUP
78 .dw XT_DOLITERAL
79 .dw 9
80 .dw XT_GREATER
81 .dw XT_DOCONDBRANCH
82 .dw PFA_DIGIT1
83 ; if
84 ; we had a non-numeric character
85 .dw XT_DOLITERAL
86 .dw $df
87 .dw XT_AND ; make uppercase
88  
89 .dw XT_DOLITERAL
90 .dw 7
91 .dw XT_MINUS ; finally 'a' -&gt; 10
92  
93 .dw XT_DUP
94 .dw XT_DOLITERAL
95 .dw 10
96 .dw XT_LESS
97 .dw XT_DOCONDBRANCH
98 .dw PFA_DIGIT1
99 ; invalid character
100 .dw XT_DROP
101 .dw XT_ZERO
102 .dw XT_EXIT
103 PFA_DIGIT1:
104 ; ( b n -- n f)
105 ; compare with the limits: less than base and and not negative
106 .dw XT_SWAP
107 .dw XT_OVER
108 .dw XT_GREATER
109  
110 .dw XT_OVER
111 .dw XT_LESSZERO
112 .dw XT_EQUALZERO
113 .dw XT_AND
114 .dw XT_EXIT
115 </pre>
116  
117 <p>
118 <input type=button onClick="history.back()" value="Back">
119 <input type=button onClick="history.forward()" value="Forward">
120 <a href="../WordList.en.html">Jump to Vocabulary</a>
121 </p>
122  
123 </div>
124  
125 <!-- AUTOINCLUDE START "Page/Footer.en.ihtml" DO NOT REMOVE -->
126 <!-- ============== FOOTER ============== -->
127 <div class="Footer">
128 <script type="text/javascript">
129 <!--
130 SetRelativePath("../../../../");
131 DrawFooter();
132 // -->
133 </script>
134 <noscript>
135 <p><b> JavaScript is required for including of the footer </b></p>
136 </noscript>
137 </div>
138 <!-- AUTOINCLUDE END -->
139  
140 </body>
141 </html>