54 lines
1.1 KiB
Text
54 lines
1.1 KiB
Text
[ Loop with downward counter
|
|
==========================
|
|
|
|
A program for the EDSAC
|
|
|
|
Prints the integers 10 down to 0
|
|
|
|
The counter is stored at address 20@
|
|
|
|
Its initial value is 9 * 2^12
|
|
(9 in the high 5 bits, representing
|
|
the character '9') and it counts
|
|
down in steps of 2^12
|
|
|
|
Works with Initial Orders 2 ]
|
|
|
|
T56K [ set load point ]
|
|
GK [ set base address ]
|
|
|
|
[ orders ]
|
|
|
|
O14@ [ print figure shift ]
|
|
O15@ [ print '1' ]
|
|
O16@ [ print '0' ]
|
|
O17@ [ print CR ]
|
|
O18@ [ print LF ]
|
|
|
|
[ 5 ] O20@ [ print c ]
|
|
O17@ [ print CR ]
|
|
O18@ [ print LF ]
|
|
|
|
T19@ [ acc := 0 ]
|
|
A20@ [ acc += c ]
|
|
S15@ [ acc -:= character '1' ]
|
|
U20@ [ c := acc ]
|
|
|
|
E5@ [ branch on non-negative ]
|
|
|
|
ZF [ stop ]
|
|
|
|
[ constants ]
|
|
|
|
[ 14 ] #F [ πF -- figure shift ]
|
|
[ 15 ] QF [ character '1' ]
|
|
[ 16 ] PF [ character '0' ]
|
|
[ 17 ] @F [ θF -- CR ]
|
|
[ 18 ] &F [ ΔF -- LF ]
|
|
|
|
[ variables ]
|
|
|
|
[ 19 ] P0F [ used to clear acc ]
|
|
[ 20 ] OF [ character c = '9' ]
|
|
|
|
EZPF [ start when loaded ]
|