Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
15
Task/Binary-digits/Chipmunk-Basic/binary-digits.basic
Normal file
15
Task/Binary-digits/Chipmunk-Basic/binary-digits.basic
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
10 for c = 1 to 3
|
||||
20 read n
|
||||
30 print n;"-> ";vin$(n)
|
||||
40 next c
|
||||
80 end
|
||||
100 sub vin$(n)
|
||||
110 b$ = ""
|
||||
120 n = abs(int(n))
|
||||
130 '
|
||||
140 b$ = str$(n mod 2)+b$
|
||||
150 n = int(n/2)
|
||||
160 if n > 0 then 130
|
||||
170 vin$ = b$
|
||||
180 end sub
|
||||
200 data 5,50,9000
|
||||
5
Task/Binary-digits/Draco/binary-digits.draco
Normal file
5
Task/Binary-digits/Draco/binary-digits.draco
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
proc main() void:
|
||||
writeln(5:b);
|
||||
writeln(50:b);
|
||||
writeln(9000:b);
|
||||
corp
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
tobin=: -.&' '@":@#:
|
||||
tobin=: '01'{~#:
|
||||
tobin 5
|
||||
101
|
||||
tobin 50
|
||||
|
|
|
|||
25
Task/Binary-digits/MACRO-11/binary-digits.macro11
Normal file
25
Task/Binary-digits/MACRO-11/binary-digits.macro11
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
.TITLE BINARY
|
||||
.MCALL .TTYOUT,.EXIT
|
||||
BINARY::MOV #3$,R5
|
||||
BR 2$
|
||||
1$: JSR PC,PRBIN
|
||||
2$: MOV (R5)+,R0
|
||||
BNE 1$
|
||||
.EXIT
|
||||
3$: .WORD ^D5, ^D50, ^D9000, 0
|
||||
|
||||
; PRINT R0 AS BINARY WITH NEWLINE
|
||||
PRBIN: MOV #3$,R1
|
||||
1$: MOV #'0,R2
|
||||
ROR R0
|
||||
ADC R2
|
||||
MOVB R2,(R1)+
|
||||
TST R0
|
||||
BNE 1$
|
||||
2$: MOVB -(R1),R0
|
||||
.TTYOUT
|
||||
BNE 2$
|
||||
RTS PC
|
||||
.BYTE 0,0,12,15
|
||||
3$: .BLKB 16 ; BUFFER
|
||||
.END BINARY
|
||||
9
Task/Binary-digits/SETL/binary-digits.setl
Normal file
9
Task/Binary-digits/SETL/binary-digits.setl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
program binary_digits;
|
||||
loop for n in [5, 50, 9000] do
|
||||
print(bin n);
|
||||
end loop;
|
||||
|
||||
op bin(n);
|
||||
return reverse +/[str [n mod 2, n div:=2](1) : until n=0];
|
||||
end op;
|
||||
end program;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import "/fmt" for Fmt
|
||||
import "./fmt" for Fmt
|
||||
|
||||
System.print("Converting to binary:")
|
||||
for (i in [5, 50, 9000]) Fmt.print("$d -> $b", i, i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue