X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=fifth.git;a=blobdiff_plain;f=tools%2Ffsimport.bas;fp=tools%2Ffsimport.bas;h=fc5e6142c7e064fa36451cf2f22026eb7d5e83d2;hp=0000000000000000000000000000000000000000;hb=7ad7475c2abf891a92b457339aaa0c20c40634d1;hpb=791dce846c524feca7b344307597c1d1224ba1de diff --git a/tools/fsimport.bas b/tools/fsimport.bas new file mode 100755 index 0000000..fc5e614 --- /dev/null +++ b/tools/fsimport.bas @@ -0,0 +1,134 @@ +DECLARE SUB bytew (fi&, d&, addr&) +DECLARE SUB byter (fi&, addr&, d&) +DECLARE SUB dwordw (fi&, b&, a&) +DEFLNG A-Z + +DECLARE SUB savepath () +DECLARE SUB getson (a$) +DECLARE SUB start () + +DIM SHARED mitus, sona$(1 TO 50) +DIM SHARED byte AS STRING * 1 +DIM SHARED length +DIM SHARED srcfile$ + +start + +OPEN "..\disk.raw" FOR BINARY AS #1 +savepath +SEEK #1, 2000101 +OPEN srcfile$ FOR BINARY AS #2 +2 +IF EOF(2) <> 0 THEN GOTO 1 +GET #2, , byte +length = length + 1 +PUT #1, , byte +GOTO 2 +1 +CLOSE #2 +dwordw 1, length - 1, 2000000 +CLOSE #1 + +SYSTEM + +SUB byter (fi, addr, d) +SEEK #1, addr + 1 +GET fi, , byte +d = ASC(byte) +END SUB + +SUB bytew (fi, d, addr) +SEEK #1, addr + 1 +byte = CHR$(d) +PUT #1, , byte +END SUB + +SUB dwordr (fi, a, f) +byter fi, a, b +byter fi, a + 1, c +byter fi, a + 2, d +byter fi, a + 3, e +f = e * 16777216 +f = f + d * 65536 + c * 256 + b +END SUB + +SUB dwordw (fi, b, a) +c = b +d = c \ 16777216 +c = c - (d * 16777216) + +e = c \ 65536 +c = c - (e * 65536) + +f = c \ 256 +c = c - (f * 256) + +bytew fi, c, a +bytew fi, f, a + 1 +bytew fi, e, a + 2 +bytew fi, d, a + 3 +END SUB + +DEFSNG A-Z +SUB getson (a$) +mitus = 0 + +d = 1 +FOR b = 1 TO LEN(a$) +c$ = RIGHT$(LEFT$(a$, b), 1) +IF c$ = " " THEN +d = 1 +ELSE +IF d = 1 THEN +mitus = mitus + 1 +sona$(mitus) = "" +d = 0 +END IF +sona$(mitus) = sona$(mitus) + c$ +END IF +NEXT b +END SUB + +SUB savepath +a$ = COMMAND$ + "\" +f$ = "" +ext$ = "" +t$ = "" +m = 0 +FOR b = 1 TO LEN(a$) + c$ = RIGHT$(LEFT$(a$, b), 1) + IF c$ = "." THEN m = 1: GOTO 3 + IF c$ = "\" THEN + IF ext$ = "" THEN ext$ = "list" +4 IF LEN(ext$) < 4 THEN ext$ = ext$ + "_": GOTO 4 + t$ = t$ + ext$ + f$ + "\" + f$ = "" + ext$ = "" + GOTO 3 + END IF + IF m = 0 THEN f$ = f$ + c$ ELSE ext$ = ext$ + c$ +3 +NEXT b +t$ = LEFT$(t$, LEN(t$) - 1) + +' PRINT a$ +' PRINT t$ + +t$ = t$ + CHR$(254) +SEEK #1, 2000005 +PUT #1, , t$ + + + + +END SUB + +SUB start + +IF COMMAND$ = "" THEN END + +srcfile$ = COMMAND$ + + +END SUB +