home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 September
/
Ahoy_Magazine_85-09_1985_Double_L.d64
/
auto-gen
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
2KB
|
100 lines
900 print"[147]":poke53280,6:poke53281,1
1000 printspc(15)"auto-gen"
1010 printspc(13)"sep 1, 1984"
1020 printspc(13)"david a jones"
1030 rem creates disk file of data statements containing image of memory
1040 :
1050 fl=0 : rem first memory location to be saved
1060 ll=0 : rem last memory location to be saved
1070 ln=1000 : rem output program line number
1080 lb=0 : rem low byte of 16 bit number
1090 hb=0 : rem high byte of 16 bit number
1100 hh=0 : rem temp store for hexideciaml conversion
1110 mm=0 : rem decimal value of number converted from string
1120 nd=10 : rem number of data items per line
1130 nl=2049 : rem pointer to start of next basic line
1140 x=0 : rem outer loop counter
1150 y=0 : rem inner loop counter
1160 z=0 : rem data item counter
1170 c$="," : rem comma
1180 d$=chr$(131): rem basic token for "data"
1190 s$=" " : rem space
1200 fi$="" : rem output file name
1210 nn$="" : rem number string input
1220 x$="" : rem 4 character string representing 1 memory location
1230 :
1240 : rem main program
1250 :
1260 print:input"first memory location";nn$
1270 mm=val(nn$)
1280 if left$(nn$,1)="$" then gosub 1830
1290 fl=mm
1300 print:input"last memory location";nn$
1310 mm=val(nn$)
1320 if left$(nn$,1)="$" then gosub 1830
1330 ll=mm
1340 print:input"starting line number";ln
1350 print:input"number of data items per line";nd
1360 print:input"output filename";fi$
1370 :
1380 open 15,8,15
1390 open 8,8,8,"0:"+fi$+",p,w"
1400 gosub 1920
1410 :
1420 print#8,chr$(1);chr$(8);: rem program load location
1430 :
1440 : rem main loop
1450 :
1460 for x=fl to ll step nd
1470 nl=nl+2+2+1+4*nd+1
1480 lb=nl-256*(int(nl/256)): hb=int(nl/256)
1490 print#8,chr$(lb);chr$(hb);: rem next basic line
1500 lb=ln-256*(int(ln/256)): hb=int(ln/256)
1510 print#8,chr$(lb);chr$(hb);: rem next line number
1520 print ln;: rem show user what's happening
1530 print#8,d$;: rem data token
1540 :
1550 for y=x to x+nd-1: rem 0 to 9 = 10 items
1560 x$=right$(" "+str$(peek(y)),3)
1570 :
1580 for i=1 to 3
1590 print#8,chr$(asc(mid$(x$,i,1)));
1600 next i
1610 :
1620 z=z+1
1630 if z<nd then print#8,c$;
1640 next y
1650 :
1660 print#8,chr$(0);: rem end of line terminator
1670 ln=ln+10
1680 z=0
1690 gosub 1920
1700 next x
1710 :
1720 : rem add end of program terminator
1730 :
1740 print#8,chr$(0);chr$(0);
1750 close 8
1760 gosub 1920
1770 close 15
1780 print:print"complete"
1790 end
1800 :
1810 : rem hex to decimal
1820 :
1830 mm=0: hh=0
1840 for x=2 to len(nn$)
1850 hh=asc(mid$(nn$,(x),1))-48
1860 mm=16*mm+hh+7*(hh>9)
1870 next
1880 return
1890 :
1900 : rem disk i/0 error
1910 :
1920 input#15,en$,em$,et$,es$: en=val(en$)
1930 if en=0 then 1970
1940 print"disk i/o error ";
1950 print en$,em$,et$,es$
1960 close 8: close 15: stop
1970 return