September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,19 +1,27 @@
|
|||
* Do-While
|
||||
DOWHILE CSECT
|
||||
USING DOWHILE,12 set base register
|
||||
LR 12,15 load base register
|
||||
SR 6,6 v=0
|
||||
LOOP LA 6,1(6) repeat; v=v+1
|
||||
STC 6,WTOTXT v
|
||||
OI WTOTXT,X'F0' make printable
|
||||
WTO MF=(E,WTOMSG) display v
|
||||
LR 4,6 v
|
||||
SRDA 4,32 shift to reg 5
|
||||
D 4,=F'6' v/6 so r4=remain & r5=quotient
|
||||
LTR 4,4 until v mod 6=0
|
||||
BNZ LOOP loop
|
||||
ENDLOOP BR 14 return to caller
|
||||
WTOMSG DS 0F full word alignment for wto
|
||||
WTOLEN DC AL2(5),H'0' length of wto buffer (4+1)
|
||||
WTOTXT DC C' ' wto text
|
||||
DOWHILE CSECT , This program's control section
|
||||
BAKR 14,0 Caller's registers to linkage stack
|
||||
LR 12,15 load entry point address into Reg 12
|
||||
USING DOWHILE,12 tell assembler we use Reg 12 as base
|
||||
XR 9,9 clear Reg 9 - divident value
|
||||
LA 6,6 load divisor value 6 in Reg 6
|
||||
LA 8,WTOLEN address of WTO area in Reg 8
|
||||
LOOP DS 0H
|
||||
LA 9,1(,9) add 1 to divident Reg 9
|
||||
ST 9,FW2 store it
|
||||
LM 4,5,FDOUBLE load into even/odd register pair
|
||||
STH 9,WTOTXT store divident in text area
|
||||
MVI WTOTXT,X'F0' first of two bytes zero
|
||||
OI WTOTXT+1,X'F0' make second byte printable
|
||||
WTO TEXT=(8) print it (Write To Operator macro)
|
||||
DR 4,6 divide Reg pair 4,5 by Reg 6
|
||||
LTR 5,5 test quotient (remainder in Reg 4)
|
||||
BNZ RETURN if one: 6 iterations, exit loop.
|
||||
B LOOP if zero: loop again.
|
||||
RETURN PR , return to caller.
|
||||
FDOUBLE DC 0FD
|
||||
DC F'0'
|
||||
FW2 DC F'0'
|
||||
WTOLEN DC H'2' fixed WTO length of two
|
||||
WTOTXT DC CL2' '
|
||||
END DOWHILE
|
||||
|
|
|
|||
7
Task/Loops-Do-while/Agena/loops-do-while.agena
Normal file
7
Task/Loops-Do-while/Agena/loops-do-while.agena
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
scope
|
||||
local i := 0;
|
||||
do
|
||||
inc i, 1;
|
||||
print( i )
|
||||
as ( i % 6 ) <> 0
|
||||
epocs
|
||||
5
Task/Loops-Do-while/BASIC/loops-do-while-2.basic
Normal file
5
Task/Loops-Do-while/BASIC/loops-do-while-2.basic
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
a=0
|
||||
REPEAT
|
||||
INCR a
|
||||
PRINT a
|
||||
UNTIL MOD(a,6) == 0
|
||||
4
Task/Loops-Do-while/BASIC/loops-do-while-3.basic
Normal file
4
Task/Loops-Do-while/BASIC/loops-do-while-3.basic
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
10 LET X=0
|
||||
20 LET X=X+1
|
||||
30 PRINT X
|
||||
40 IF X/6<>INT (X/6) THEN GOTO 20
|
||||
6
Task/Loops-Do-while/Bc/loops-do-while.bc
Normal file
6
Task/Loops-Do-while/Bc/loops-do-while.bc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
i = 0
|
||||
for (;;) {
|
||||
++i /* increments then prints i */
|
||||
if (i % 6 == 0) break
|
||||
}
|
||||
quit
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
int val = 0;
|
||||
do{
|
||||
val++;
|
||||
cout << val << endl;
|
||||
std::cout << val << std::endl;
|
||||
}while(val % 6 != 0);
|
||||
|
|
|
|||
2
Task/Loops-Do-while/DUP/loops-do-while-1.dup
Normal file
2
Task/Loops-Do-while/DUP/loops-do-while-1.dup
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[1+$.' ,]⇒A {operator definition: PUSH 1, ADD, DUP, print top of stack to SDTOUT, print whitespace}
|
||||
[1+$.' ,]a: {function definition}
|
||||
2
Task/Loops-Do-while/DUP/loops-do-while-2.dup
Normal file
2
Task/Loops-Do-while/DUP/loops-do-while-2.dup
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[1+$.' ,]⇒A
|
||||
0 A[$6/%][A]# {PUSH 0, execute operator A, [DUP, PUSH 6, MOD/DIV, POP][execute operator A]#}
|
||||
2
Task/Loops-Do-while/DUP/loops-do-while-3.dup
Normal file
2
Task/Loops-Do-while/DUP/loops-do-while-3.dup
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[1+$.' ,]a:
|
||||
0 a;![$6/%][a;!]#
|
||||
1
Task/Loops-Do-while/DUP/loops-do-while-4.dup
Normal file
1
Task/Loops-Do-while/DUP/loops-do-while-4.dup
Normal file
|
|
@ -0,0 +1 @@
|
|||
1 2 3 4 5 6
|
||||
8
Task/Loops-Do-while/Dc/loops-do-while.dc
Normal file
8
Task/Loops-Do-while/Dc/loops-do-while.dc
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
0 si [i = 0]sz
|
||||
[2Q]sA [A = code to break loop]sz
|
||||
[
|
||||
li 1 + p [print it = i + 1]sz
|
||||
d si [i = it, leave it on stack]sz
|
||||
6 % 0 =A [call A if 0 == it % 6]sz
|
||||
0 0 =B [continue loop]sz
|
||||
]sB 0 0 =B
|
||||
9
Task/Loops-Do-while/Gambas/loops-do-while.gambas
Normal file
9
Task/Loops-Do-while/Gambas/loops-do-while.gambas
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Public Sub Main()
|
||||
Dim siCount As Short
|
||||
|
||||
Repeat
|
||||
Inc siCount
|
||||
Print siCount;;
|
||||
Until siCount Mod 6 = 0
|
||||
|
||||
End
|
||||
|
|
@ -4,8 +4,11 @@ import "fmt"
|
|||
|
||||
func main() {
|
||||
var value int
|
||||
for ok := true; ok; ok = value%6 != 0 {
|
||||
for {
|
||||
value++
|
||||
fmt.Println(value)
|
||||
if value%6 != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
7
Task/Loops-Do-while/Haskell/loops-do-while-3.hs
Normal file
7
Task/Loops-Do-while/Haskell/loops-do-while-3.hs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
main :: IO ()
|
||||
main =
|
||||
mapM_ print . reverse $
|
||||
until
|
||||
(\(x:_) -> (x > 0) && (mod x 6 == 0))
|
||||
(\xs@(x:_) -> succ x : xs)
|
||||
[0]
|
||||
5
Task/Loops-Do-while/HolyC/loops-do-while.holyc
Normal file
5
Task/Loops-Do-while/HolyC/loops-do-while.holyc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
U8 i = 0;
|
||||
do {
|
||||
i++;
|
||||
Print("%d\n", i);
|
||||
} while (i % 6 != 0);
|
||||
9
Task/Loops-Do-while/Kotlin/loops-do-while.kotlin
Normal file
9
Task/Loops-Do-while/Kotlin/loops-do-while.kotlin
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// version 1.0.6
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
var value = 0
|
||||
do {
|
||||
println(++value)
|
||||
}
|
||||
while (value % 6 != 0)
|
||||
}
|
||||
5
Task/Loops-Do-while/SPL/loops-do-while.spl
Normal file
5
Task/Loops-Do-while/SPL/loops-do-while.spl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
n = 0
|
||||
>
|
||||
n += 1
|
||||
#.output(n)
|
||||
< n%6
|
||||
6
Task/Loops-Do-while/Stata/loops-do-while-1.stata
Normal file
6
Task/Loops-Do-while/Stata/loops-do-while-1.stata
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local n 0
|
||||
local q 1
|
||||
while `q' | mod(`n',6) {
|
||||
local q 0
|
||||
di `++n'
|
||||
}
|
||||
5
Task/Loops-Do-while/Stata/loops-do-while-2.stata
Normal file
5
Task/Loops-Do-while/Stata/loops-do-while-2.stata
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
local n 0
|
||||
while 1 {
|
||||
di `++n'
|
||||
if mod(`n',6)==0 continue, break
|
||||
}
|
||||
6
Task/Loops-Do-while/Stata/loops-do-while-3.stata
Normal file
6
Task/Loops-Do-while/Stata/loops-do-while-3.stata
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
mata
|
||||
n=0
|
||||
do {
|
||||
printf("%f\n",++n)
|
||||
} while (mod(n,6))
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
val = 0
|
||||
do
|
||||
{
|
||||
Print(++val)
|
||||
} while (val % 6 isnt 0)
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
var val = 0
|
||||
repeat {
|
||||
val++
|
||||
val += 1
|
||||
print(val)
|
||||
} while val % 6 != 0
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
var val = 0
|
||||
do {
|
||||
val++
|
||||
println(val)
|
||||
repeat {
|
||||
val++
|
||||
print(val)
|
||||
} while val % 6 != 0
|
||||
|
|
|
|||
5
Task/Loops-Do-while/Swift/loops-do-while-3.swift
Normal file
5
Task/Loops-Do-while/Swift/loops-do-while-3.swift
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var val = 0
|
||||
do {
|
||||
val++
|
||||
println(val)
|
||||
} while val % 6 != 0
|
||||
5
Task/Loops-Do-while/Zkl/loops-do-while.zkl
Normal file
5
Task/Loops-Do-while/Zkl/loops-do-while.zkl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
val := 0;
|
||||
do {
|
||||
val+=1;
|
||||
val.print(" ");
|
||||
} while(val % 6 != 0);
|
||||
Loading…
Add table
Add a link
Reference in a new issue