Vintage Computing
70 n=FILE
75 DISPLAY n
80 IF n>-1 THEN GOTO 70
85 DISPLAY 13,13: PRINT “Closing file...”
90 CLOSE
of the Propeller system counter register. For the 80 MHz
system clock of the Amigo, each tick of the clock is close
to 0.125 nanoseconds, so you can use CNT to perform
some timing tasks in your programs.
WORD and LONG work just like the BYTE command,
but with a two-byte or four-byte operand, respectively. Try
these commands on the video section of the main
memory. As expected, WORD ignores the top two bytes
of the 32-bit variable S, while LONG uses all four. You
may find these two commands helpful for some tasks with
your Amigo.
It won’t be gnat’s eyebrow precise due to the double-interpreted nature of Color BASIC, but may be close
enough for some of your programming needs. This next
code block (also in the downloads) creates a crude
stopwatch by counting clock ticks and doing some math:
CLS
S = “A””SHL 24 + “B””SHL 16 + “C””SHL 8 + “D”
WORD [2850] = S CD
LONG [2800] = S ABCD
PRINT WORD [2850]
16706
PRINT WORD [2800]
538976288
10 REM —- TIMER.BAS —-
15 CLS : PRINT “Press any key to start...”
20 IF INKEY =0 THEN GOTO 20
25 a = CNT
30 CLS : PRINT “Press any key to stop...”
35 LOCATE 15,15: PRINT “CNT = “;CNT
40 IF INKEY =0 THEN GOTO 35
45 b=CNT
50 CLS
55 PRINT “Start CNT = “;a
60 PRINT “Stop CNT = “;b
65 PRINT “Difference = “;b-a
70 t=(b-a)/100000*125
75 s=t/100000
The CNT command is read-only and returns the value
www.embeddedARM.com
dde
TS-4900
Computer on Module
WiFi and Bluetooth Enabled
1 GHz i.MX6 Computer Module
Single or Quad Core
TS-7970
Single Board Computer
om u C
1 GHz i.MX6 ARMCPU
Single or Quad Core
Up to 2 GB DDR3 RAM
4 GB MLC eMMC Flash
Choose your own adventure.
y
WiFi and Bluetooth
Board Support Packages,
Source Code and Toolchains
Available
56 July/August 2018