Task

Write a    for    loop which writes a countdown from   10   to   0.



Related tasks

   Loop over multiple arrays simultaneously
   Loops/Break
   Loops/Continue
   Loops/Do-while
   Loops/Downward for
   Loops/For
   Loops/For with a specified step
   Loops/Foreach
   Loops/Increment loop index within loop body
   Loops/Infinite
   Loops/N plus one half
   Loops/Nested
   Loops/While
   Loops/with multiple ranges
   Loops/Wrong ranges


[ 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 ]