56 lines
1.2 KiB
Plaintext
56 lines
1.2 KiB
Plaintext
[ Integer comparison
|
|
==================
|
|
|
|
A program for the EDSAC
|
|
|
|
Illustrates the use of the E
|
|
(branch on accumulator sign
|
|
bit clear) and G (branch on
|
|
accumulator sign bit set)
|
|
orders
|
|
|
|
The integers to be tested, x
|
|
and y, should be stored in
|
|
addresses 13@ and 14@
|
|
|
|
Output: the program causes the
|
|
machine to print
|
|
'+' if x > y,
|
|
'=' if x = y,
|
|
'-' if x < y.
|
|
|
|
Works with Initial Orders 2 ]
|
|
|
|
T56K [ load point ]
|
|
GK [ base address ]
|
|
|
|
O15@ [ figure shift ]
|
|
|
|
A13@ [ a = x ]
|
|
S14@ [ a -= y ]
|
|
G10@ [ if a<0 go to 10 ]
|
|
|
|
S12@ [ a -= 1 ]
|
|
E8@ [ if a>=0 go to 8 ]
|
|
|
|
O17@ [ write '=' ]
|
|
ZF [ halt ]
|
|
|
|
[ 8 ] O16@ [ write '+' ]
|
|
ZF [ halt ]
|
|
|
|
[ 10 ] O18@ [ write '-' ]
|
|
ZF [ halt ]
|
|
|
|
[ 12 ] P0D [ const: 1 ]
|
|
|
|
[ 13 ] P16D [ x = 37 ]
|
|
[ 14 ] P14F [ y = 28 ]
|
|
|
|
[ 15 ] #F [ figure shift ]
|
|
[ 16 ] ZF [ + character ]
|
|
[ 17 ] VF [ = character ]
|
|
[ 18 ] AF [ - character ]
|
|
|
|
EZPF [ begin execution ]
|