Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -1,47 +1,81 @@
|
|||
[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.
|
||||
EDSAC, Initial Orders 2.
|
||||
--------------------------------------------------------------------------------
|
||||
Sorts three variables x, y, x, stored in consecutive 35-bit locations.
|
||||
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.
|
||||
----------------------------------------------------------------------------]
|
||||
On EDSAC, whether a variable is an integer or a fixed-point real is a matter
|
||||
of interpretation. The integer N has the same bit-pattern as the fixed-point
|
||||
real N*(2^-34). In this program, variables are regarded as integers.
|
||||
NB Integers are here compared by subtraction and noting the sign of the result.
|
||||
It's assumed that the subtraction doesn't overflow the accumulator.
|
||||
This will be OK if the absolute values of the integers are less than 2^33.
|
||||
------------------------------------------------------------------------------]
|
||||
[Arrange the storage]
|
||||
T47K P96F [M parameter: main routine]
|
||||
T55K P128F [V parameter: variables to be sorted]
|
||||
T55K P56F [V parameter: variables to be sorted]
|
||||
T46K P62F [N parameter: print subroutine]
|
||||
T47K P120F [M parameter: main routine]
|
||||
|
||||
[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
|
||||
E25K TN [will be overwritten by the following print subroutine]
|
||||
GKT20FVDL8FA40DUDTFI40FA40FS39FG@S2FG23FA5@T5@E4@E13Z
|
||||
T#V [tell R2 where to store integers]
|
||||
[List of 35-bit integers separated by 'F', list terminated by '#TZ'.
|
||||
-12 is entered as -12 + 2^35. Uncomment the desired starting order.]
|
||||
[34359738356F0F77444#TZ]
|
||||
[34359738356F77444F0#TZ]
|
||||
[0F34359738356F77444#TZ]
|
||||
[0F77444F34359738356#TZ]
|
||||
77444F34359738356F0#TZ
|
||||
[77444F0F34359738356#TZ]
|
||||
|
||||
[Modified version of library subroutine P7.
|
||||
Prints signed integer left-justified. Integer is passed in 0D.]
|
||||
GKA3FT42@A47@T31@ADE10@T31@A46@T31@SDTDH44#@NDYFLDT4DS43@
|
||||
TFH17@S17@A43@G23@UFS43@T1FV4DAFG48@SFLDUFXFOFFFSFL4FT4DA47@
|
||||
T31@A1FA43@G20@XFT44#ZPFT43ZP1024FP610D@524DO26@XFSFL8FT4DE39@
|
||||
|
||||
[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]
|
||||
E25K TM GK
|
||||
[0] #F [figures shift]
|
||||
[1] NF [comma (in figures mode)]
|
||||
[2] !F [space]
|
||||
[3] @F [carriage return]
|
||||
[4] &F [line feed]
|
||||
[5] K4096F [null]
|
||||
[Enter here with accumulator = 0]
|
||||
[6] A4#V S#V [acc := z - x]
|
||||
E14@ [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]
|
||||
[14] TF [clear acc]
|
||||
A4#V S2#V [acc := z - y]
|
||||
E23@ [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]
|
||||
[23] TF [clear acc]
|
||||
A2#V S#V [acc := y - x]
|
||||
E32@ [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]
|
||||
[32] TF [clear acc]
|
||||
[Print variables after sorting]
|
||||
O@ [set teleprinter to figures mode]
|
||||
A#V TD A36@ GN O1@ O2@ [print 1st variable plus comma, space]
|
||||
A2#V TD A42@ GN O1@ O2@ [print 2nd variable plus comma, space]
|
||||
A4#V TD A48@ GN O3@ O4@ [print 3rd variable plus CR, LF]
|
||||
O5@ [print null to flush teleprinter buffer]
|
||||
ZF [halt the machine]
|
||||
E6Z [define entry point]
|
||||
PF [accumulator = 0 on entry]
|
||||
[end]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue