Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Enable overriding of terminal IO words

  • Loading branch information...
commit 065bda047e7cf4612a0854422ec0c6a02d7cb0e3 1 parent b82d604
Eckhart Köppen authored May 20, 2012
22  generic/CoreForth.s
@@ -270,7 +270,7 @@ readline:
270 270
     movs r3, r1
271 271
     beq readline_end
272 272
 readline_loop:
273  
-    bl read_key
  273
+    bl readkey
274 274
     cmp r0, #13
275 275
     beq readline_end
276 276
     cmp r0, #127
@@ -306,13 +306,13 @@ readline_end:
306 306
  */
307 307
 read_widekey:
308 308
     push {r4, r5, lr}
309  
-    bl read_key
  309
+    bl readkey
310 310
     cmp r0, #27
311 311
     bne 1f
312  
-    bl read_key
  312
+    bl readkey
313 313
     cmp r0, '['
314 314
     bne 1f
315  
-    bl read_key
  315
+    bl readkey
316 316
     cmp r0, 'A'
317 317
     blt 3f
318 318
     cmp r0, 'Z'
@@ -330,7 +330,7 @@ read_widekey:
330 330
     subs r0, '0'
331 331
     muls r4, r4, r5
332 332
     adds r4, r0
333  
-    bl read_key
  333
+    bl readkey
334 334
     b 2b
335 335
 4:  movs r0, #0
336 336
     subs r0, r4
@@ -942,16 +942,19 @@ fill_done:
942 942
     defword ".", DOT
943 943
     .word DOTH, SPACE, EXIT
944 944
 
945  
-    defcode "(KEY)", XKEY
946  
-    bl read_key
  945
+    defcode "READKEY", READKEY
  946
+    bl readkey
947 947
     push {r0}
948 948
     NEXT
949 949
 
950  
-    defcode "KEY", KEY
  950
+    defcode "READWKEY", READWKEY
951 951
     bl read_widekey
952 952
     push {r0}
953 953
     NEXT
954 954
 
  955
+    defword "KEY", KEY, , DEFER_XT
  956
+    .word READWKEY
  957
+
955 958
     defcode "READLINE", READLINE
956 959
     pop {r1}
957 960
     pop {r0}
@@ -959,6 +962,9 @@ fill_done:
959 962
     push {r0}
960 963
     NEXT
961 964
 
  965
+    defword "ACCEPT", ACCEPT, , DEFER_XT
  966
+    .word READLINE
  967
+
962 968
     defword "DUMP", DUMP
963 969
     .word QDUP, QBRANCH, dump_end - .
964 970
     .word SWAP
2  lm3s811/lm3s811_board.s
@@ -271,7 +271,7 @@ init_board:
271 271
     .align 2, 0
272 272
     .ltorg
273 273
 
274  
-read_key:
  274
+readkey:
275 275
     push {r1, r2, r3, lr}
276 276
 2:  ldr r1, =addr_SBUF_TAIL
277 277
     ldrb r3, [r1]
8  stm32p103/stm32p103_board.s
@@ -148,10 +148,10 @@ init_board:
148 148
     .align 2, 0
149 149
     .ltorg
150 150
 
151  
-read_key_interrupt:
  151
+readkey_interrupt:
152 152
     mov pc, lr
153 153
 
154  
-read_key_polled:
  154
+readkey_polled:
155 155
     push {r1, r2, r3, lr}
156 156
     ldr r1, =UART2
157 157
     mov r2, #32
@@ -163,9 +163,9 @@ read_key_polled:
163 163
     pop {r1, r2, r3, pc}
164 164
 
165 165
 .ifdef UART_USE_INTERRUPTS
166  
-    .set read_key, read_key_interrupt
  166
+    .set readkey, readkey_interrupt
167 167
 .else
168  
-    .set read_key, read_key_polled
  168
+    .set readkey, readkey_polled
169 169
 .endif
170 170
 
171 171
 putchar:

0 notes on commit 065bda0

Please sign in to comment.
Something went wrong with that request. Please try again.