2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,3 +1,9 @@
|
|||
{{omit from|GUISS|No loops and we cannot read values}}
|
||||
Start an integer value at 1024. Loop while it is greater than 0.
|
||||
|
||||
;Task:
|
||||
Start an integer value at '''1024'''.
|
||||
|
||||
Loop while it is greater than zero.
|
||||
|
||||
Print the value (with a newline) and divide it by two each time through the loop.
|
||||
<br><br>
|
||||
|
|
|
|||
19
Task/Loops-While/360-Assembly/loops-while-1.360
Normal file
19
Task/Loops-While/360-Assembly/loops-while-1.360
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
* While 27/06/2016
|
||||
WHILELOO CSECT program's control section
|
||||
USING WHILELOO,12 set base register
|
||||
LR 12,15 load base register
|
||||
LA 6,1024 v=1024
|
||||
LOOP LTR 6,6 while v>0
|
||||
BNP ENDLOOP .
|
||||
CVD 6,PACKED convert v to packed decimal
|
||||
OI PACKED+7,X'0F' prepare unpack
|
||||
UNPK WTOTXT,PACKED packed decimal to zoned printable
|
||||
WTO MF=(E,WTOMSG) display v
|
||||
SRA 6,1 v=v/2 by right shift
|
||||
B LOOP end while
|
||||
ENDLOOP BR 14 return to caller
|
||||
PACKED DS PL8 packed decimal
|
||||
WTOMSG DS 0F full word alignment for wto
|
||||
WTOLEN DC AL2(8),H'0' length of wto buffer (4+1)
|
||||
WTOTXT DC CL4' ' wto text
|
||||
END WHILELOO
|
||||
18
Task/Loops-While/360-Assembly/loops-while-2.360
Normal file
18
Task/Loops-While/360-Assembly/loops-while-2.360
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
* While 27/06/2016
|
||||
WHILELOO CSECT
|
||||
USING WHILELOO,12 set base register
|
||||
LR 12,15 load base register
|
||||
LA 6,1024 v=1024
|
||||
DO WHILE=(LTR,6,P,6) do while v>0
|
||||
CVD 6,PACKED convert v to packed decimal
|
||||
OI PACKED+7,X'0F' prepare unpack
|
||||
UNPK WTOTXT,PACKED packed decimal to zoned printable
|
||||
WTO MF=(E,WTOMSG) display
|
||||
SRA 6,1 v=v/2 by right shift
|
||||
ENDDO , end while
|
||||
BR 14 return to caller
|
||||
PACKED DS PL8 packed decimal
|
||||
WTOMSG DS 0F full word alignment for wto
|
||||
WTOLEN DC AL2(8),H'0' length of wto buffer (4+1)
|
||||
WTOTXT DC CL4' ' wto text
|
||||
END WHILELOO
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
WHILE 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
|
||||
LA 13,0 inidicate caller no savearea
|
||||
USING WHILE,12 tell assembler we use Reg 12 as base
|
||||
XR 3,3 Register 3 zero.
|
||||
XR 4,4 clear even divident reg
|
||||
LA 5,1024 load odd divident reg
|
||||
LA 9,2 divisor in reg 9
|
||||
LA 8,WTOLEN address of WTO area in Reg 8
|
||||
MVC WTOTXT,=C'1024'
|
||||
WTO TEXT=(8) write to operator initial value 1024
|
||||
LOOP DS 0H
|
||||
DR 4,9 divide r4/5 by r9
|
||||
CLR 3,4 less than zero?
|
||||
BL RETURN yes, return
|
||||
CVD 5,PACKED convert result to (packed) decimal
|
||||
OI PACKED+7,X'0F' prepare unpack
|
||||
XC WTOTXT,WTOTXT clear wto text
|
||||
UNPK WTOTXT,PACKED packed decimal to zoned (printable)
|
||||
WTO TEXT=(8) and write-to-operator
|
||||
B LOOP loop.
|
||||
RETURN PR , return to caller.
|
||||
WTOLEN DC H'4' fixed WTO length of four
|
||||
WTOTXT DS CL4
|
||||
PACKED DS CL8
|
||||
END WHILE
|
||||
12
Task/Loops-While/Elena/loops-while.elena
Normal file
12
Task/Loops-While/Elena/loops-while.elena
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#import system.
|
||||
|
||||
#symbol program =
|
||||
[
|
||||
#var(type:int)i := 1024.
|
||||
#loop (i > 0)?
|
||||
[
|
||||
console writeLine:i.
|
||||
|
||||
i := i / 2.
|
||||
].
|
||||
].
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
body ...
|
||||
(loop))))
|
||||
|
||||
(define n 0)
|
||||
(while (< n 10)
|
||||
(define n 1024)
|
||||
(while (positive? n)
|
||||
(displayln n)
|
||||
(set! n (add1 n)))
|
||||
(set! n (sub1 n)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue