Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,47 @@
|
|||
[Sort three variables, for Rosetta Code.
|
||||
EDSAC, Initial Orders 2]
|
||||
[---------------------------------------------------------------------------
|
||||
Sorts three 35-bit variables x, y, x, stored at 0#V, 2#V, 4#V respectively.
|
||||
Uses the algortihm:
|
||||
if x > z then swap( x,z)
|
||||
if y > z then swap( y,z)
|
||||
if x > y then swap( x,y)
|
||||
At most two swaps are carried out in any particular case.
|
||||
----------------------------------------------------------------------------]
|
||||
[Arrange the storage]
|
||||
T47K P96F [M parameter: main routine]
|
||||
T55K P128F [V parameter: variables to be sorted]
|
||||
|
||||
[Compressed form of library subroutine R2.
|
||||
Reads integers at load time and is then overwritten.]
|
||||
GKT20FVDL8FA40DUDTFI40FA40FS39FG@S2FG23FA5@T5@E4@E13Z
|
||||
T#V [tell R2 where to store integers]
|
||||
[EDIT: List of 35-bit integers separated by 'F', list terminated by '#TZ'.]
|
||||
987654321F500000000F123456789#TZ
|
||||
|
||||
[Main routine]
|
||||
E25K TM GK
|
||||
[0] A4#V S#V [accumulator := z - x]
|
||||
E8@ [skip the swap if x <= z]
|
||||
TD [0D := z - x]
|
||||
A#V U4#V [z := x]
|
||||
AD [acc := old z]
|
||||
T#V [x := old z]
|
||||
[8] TF [clear acc]
|
||||
A4#V S2#V [acc := z - y]
|
||||
E17@ [skip the swap if y <= z]
|
||||
TD [0D := z - y]
|
||||
A2#V U4#V [z := y]
|
||||
AD [acc := old z]
|
||||
T2#V [y := old z]
|
||||
[17] TF [clear acc]
|
||||
A2#V S#V [acc := y - x]
|
||||
E26@ [skip the swap if x <= y]
|
||||
TD [0D := y - x]
|
||||
A#V U2#V [y := x]
|
||||
AD [acc := old y]
|
||||
T#V [x := old y]
|
||||
[26] ZF [halt the machine]
|
||||
EZ [define entry point]
|
||||
PF [acc = 0 on entry]
|
||||
[end]
|
||||
Loading…
Add table
Add a link
Reference in a new issue