Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
32
Task/Repeat-a-string/8080-Assembly/repeat-a-string.8080
Normal file
32
Task/Repeat-a-string/8080-Assembly/repeat-a-string.8080
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
org 100h
|
||||
jmp demo
|
||||
|
||||
; Repeat the string at DE into HL, B times
|
||||
repeat: mvi c,'$' ; string terminator
|
||||
xra a ; repeat 0x?
|
||||
ora b
|
||||
mov m,c ; then empty string
|
||||
rz
|
||||
rpt1: push d ; save begin of string to repeat
|
||||
chcpy: ldax d ; copy character from input to output
|
||||
mov m,a
|
||||
inx d ; advance pointers
|
||||
inx h
|
||||
cmp c ; end of string?
|
||||
jnz chcpy
|
||||
pop d ; restore begin of string to repeat
|
||||
dcx h ; move back past terminator in copy
|
||||
dcr b ; done yet?
|
||||
jnz rpt1 ; if not add another copy
|
||||
ret
|
||||
|
||||
demo: lxi d,ha ; get string to repeat
|
||||
lxi h,buf ; place to store result
|
||||
mvi b,5 ; repeat 5 times
|
||||
call repeat
|
||||
lxi d,buf ; print result using CP/M call
|
||||
mvi c,9
|
||||
jmp 5
|
||||
|
||||
ha: db 'ha$' ; string to repeat
|
||||
buf: ds 32 ; place to store repeated string
|
||||
12
Task/Repeat-a-string/Chipmunk-Basic/repeat-a-string.basic
Normal file
12
Task/Repeat-a-string/Chipmunk-Basic/repeat-a-string.basic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
100 cls
|
||||
110 print stringrepeat$("rosetta",1)
|
||||
120 print stringrepeat$("ha",5)
|
||||
130 print stringrepeat$("*",5)
|
||||
140 end
|
||||
150 function stringrepeat$(s$,n)
|
||||
160 cad$ = ""
|
||||
170 for i = 1 to n
|
||||
180 cad$ = cad$+s$
|
||||
190 next i
|
||||
200 stringrepeat$ = cad$
|
||||
210 end function
|
||||
7
Task/Repeat-a-string/EasyLang/repeat-a-string.easy
Normal file
7
Task/Repeat-a-string/EasyLang/repeat-a-string.easy
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
func$ rep s$ n .
|
||||
for i to n
|
||||
r$ &= s$
|
||||
.
|
||||
return r$
|
||||
.
|
||||
print rep "ha" 5
|
||||
17
Task/Repeat-a-string/GW-BASIC/repeat-a-string.basic
Normal file
17
Task/Repeat-a-string/GW-BASIC/repeat-a-string.basic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
100 CLS : rem 100 HOME for Applesoft BASIC
|
||||
110 S$ = "rosetta" : N = 1
|
||||
120 GOSUB 210
|
||||
130 PRINT CAD$
|
||||
140 S$ = "ha" : N = 5
|
||||
150 GOSUB 210
|
||||
160 PRINT CAD$
|
||||
170 S$ = "*" : N = 5
|
||||
180 GOSUB 210
|
||||
190 PRINT CAD$
|
||||
200 END
|
||||
210 REM FUNCTION STRINGREPEAT$(S$,N)
|
||||
220 CAD$ = ""
|
||||
230 FOR I = 1 TO N
|
||||
240 CAD$ = CAD$+S$
|
||||
250 NEXT I
|
||||
260 RETURN
|
||||
1
Task/Repeat-a-string/Inform-7/repeat-a-string-2.inf
Normal file
1
Task/Repeat-a-string/Inform-7/repeat-a-string-2.inf
Normal file
|
|
@ -0,0 +1 @@
|
|||
(str* "ha" 5)
|
||||
18
Task/Repeat-a-string/Minimal-BASIC/repeat-a-string.basic
Normal file
18
Task/Repeat-a-string/Minimal-BASIC/repeat-a-string.basic
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
100 REM Repeat a string
|
||||
110 LET S$ = "rosetta"
|
||||
120 LET N = 1
|
||||
130 GOSUB 210
|
||||
140 LET S$ = "ha"
|
||||
150 LET N = 5
|
||||
160 GOSUB 210
|
||||
170 LET S$ = "*"
|
||||
180 LET N = 5
|
||||
190 GOSUB 210
|
||||
200 STOP
|
||||
210 REM FUNCTION StringRepeat$(S$,N)
|
||||
220 FOR I = 1 TO N
|
||||
230 PRINT S$;
|
||||
240 NEXT I
|
||||
250 PRINT
|
||||
260 RETURN
|
||||
270 END
|
||||
20
Task/Repeat-a-string/Quite-BASIC/repeat-a-string.basic
Normal file
20
Task/Repeat-a-string/Quite-BASIC/repeat-a-string.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
100 CLS
|
||||
110 LET S$ = "rosetta"
|
||||
115 LET N = 1
|
||||
120 GOSUB 210
|
||||
130 PRINT C$
|
||||
140 LET S$ = "ha"
|
||||
145 LET N = 5
|
||||
150 GOSUB 210
|
||||
160 PRINT C$
|
||||
170 LET S$ = "*"
|
||||
175 LET N = 5
|
||||
180 GOSUB 210
|
||||
190 PRINT C$
|
||||
200 END
|
||||
210 REM FUNCTION STRINGREPEAT$(S$,N)
|
||||
220 LET C$ = ""
|
||||
230 FOR I = 1 TO N
|
||||
240 LET C$ = C$ + S$
|
||||
250 NEXT I
|
||||
260 RETURN
|
||||
21
Task/Repeat-a-string/XBasic/repeat-a-string.basic
Normal file
21
Task/Repeat-a-string/XBasic/repeat-a-string.basic
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
PROGRAM "Repeat a string"
|
||||
VERSION "0.0000"
|
||||
|
||||
DECLARE FUNCTION Entry ()
|
||||
DECLARE FUNCTION StringRepeat$ (s$, n)
|
||||
|
||||
FUNCTION Entry ()
|
||||
|
||||
PRINT StringRepeat$ ("rosetta", 1)
|
||||
PRINT StringRepeat$ ("ha", 5)
|
||||
PRINT StringRepeat$ ("*", 5)
|
||||
|
||||
END FUNCTION
|
||||
FUNCTION StringRepeat$ (s$, n)
|
||||
cad$ = ""
|
||||
FOR i = 1 TO n
|
||||
cad$ = cad$ + s$
|
||||
NEXT i
|
||||
RETURN cad$
|
||||
END FUNCTION
|
||||
END PROGRAM
|
||||
Loading…
Add table
Add a link
Reference in a new issue