$cpu 80286 $com 2048 $compile exe "4.exe" DECLARE SUB ExeC (oof$) DECLARE SUB UnloadFont () DECLARE SUB LoadFont (f$) DECLARE SUB PRINT2 (t$, cv!) DECLARE SUB Font (t$, cl!) DECLARE SUB Errorr (Msg$) DECLARE FUNCTION ReadLn$ (ln!) DECLARE SUB Comport (Port$) DECLARE SUB ClrBot () DECLARE SUB Corr (n$) DECLARE SUB ReadKey (prm$, t$, chrs!, brd$, rd!) DECLARE FUNCTION GetPrmt$ (pt$) DIM ENV(1 TO 500) AS shared STRING DIM ENV1(1 TO 500) AS shared STRING DIM mxenv AS shared INTEGER SHARED wt$ dim LastTyped AS shared STRING DIM Lstln AS shared INTEGER DIM HRes AS shared INTEGER DIM txt(255) AS shared STRING shared CPort$ SHARED CMM SHARED DFnt SHARED CMmPrt shared tmrr shared Egaa tmrr = 30 LoadFont "C:\ASCIN.FNT" if ucase$(ltrim$(rtrim$(command$)))<>"EGA" then screen 12:HRes=1:DFnt=1:Lstln=30 else egaa=1 if ucase$(ltrim$(rtrim$(command$)))="EGA" then Screen 9:HRes = 1:DFnt = 1:LstLn=25:egaa=1 if ucase$(ltrim$(rtrim$(command$)))="TEXT" then screen 0:HRes=0:DFnt=0:Lstln=25 ver$ = "1.00" PRINT PRINT2 " RK-DOS Version " + ver$, 15 PRINT ENV(1) = "$ $L$P$G" ENV1(1) = "PATH" mxenv = 1 nn = 0 OPEN "C:\YOUNICKS.FAT" for input as #4 wt$=curdir$ 10 ReadKey GetPrmt(ENV(1)), cmd$, 70, Msg$, nn wt$=curdir$ cmd$ = LTRIM$(cmd$) IF cmd$ = "" GOTO 10 IF MID$(cmd$, 1, INSTR(cmd$, " ")) = "" THEN ff$ = cmd$: cmdlne$ = "" ELSE ff$ = MID$(cmd$, 1, INSTR(cmd$, " ") - 1): cmdlne$ = MID$(cmd$, INSTR(cmd$, " ") + 1, LEN(cmd$) - INSTR(cmd$, " ")) IF UCASE$(ff$) = "EXIT" THEN UnloadFont: END if ucase$(ff$) = "FREE" then Print2 "Memmory left:"+str$(fre(-1))+" bytes",15:print:goto 10 if ucase$(ff$) = "SEND" then if cmdlne$="" then Print2 "Syntax: SEND msg",7:print :goto 10 else if cmm=1 then print #3,cmdlne$:goto 10 else print2 "Com port not open",7:Print "":goto 10 IF UCASE$(ff$) = "CLS" or ucase$(ff$)="CLEAR" THEN CLS : GOTO 10 IF UCASE$(ff$) = "PROMPT" THEN if cmdlne$="" then print2 ENV(1),7:print:goto 10 else ENV(1) = cmdlne$: GOTO 10 IF UCASE$(ff$) = "NOWAIT" THEN nn = 0: GOTO 10 IF UCASE$(ff$) = "WAIT" THEN IF cmdlne$ = "" THEN PRINT2 "WAIT message is"+Msg$, 7: PRINT : GOTO 10 ELSE nn = 1: Corr cmdlne$: Msg$ = cmdlne$: GOTO 10 IF UCASE$(ff$) = "DOS" THEN IF cmdlne$ = "" THEN PRINT2 "Syntax: DOS dos_prog", 7: PRINT : GOTO 10 ELSE ClrBot: SHELL (cmdlne$):wt$=curdir$: GOTO 10 IF UCASE$(ff$) = "COM_ON" THEN IF cmdlne$ = "" THEN PRINT2 "Syntax: COM_ON comport#: speed", 7: PRINT : GOTO 10 ELSE Comport cmdlne$:cmm=1: GOTO 10 IF UCASE$(ff$) = "LINES" THEN IF cmdlne$ <> "" AND (VAL(cmdlne$) = 25 OR VAL(cmdlne$) = 43 OR VAL(cmdlne$) = 50) THEN Screen 0:WIDTH 80, VAL(cmdlne$): Lstln = VAL(cmdlne$): HRes = 0: GOTO 10 ELSE PRINT2 "Syntax: LINES {25,43,50}", 7: PRINT:GOTO 10 IF UCASE$(ff$) = "LOWRES" THEN Lstln = 25: SCREEN 0: width 80,25:HRes = 0: GOTO 10 IF UCASE$(ff$) = "HIRES" AND HRes = 0 THEN Lstln = 30: SCREEN 12: HRes = 1: GOTO 10 IF UCASE$(ff$) = "VER" AND HRes = 1 THEN PRINT2 "RK-DOS Version " + ver$, 15: PRINT : PRINT : GOTO 10 IF UCASE$(ff$) = "VER" AND HRes = 0 THEN COLOR 15, 1: PRINT "RK-DOS Version " + ver$: PRINT : COLOR 7, 0: GOTO 10 IF UCASE$(ff$) = "FONT" THEN IF cmdlne$ <> "" AND (rtrim$(ltrim$(cmdlne$)) = "ON" OR rtrim$(ltrim$(cmdlne$)) = "OFF") THEN ExeC rtrim$(ltrim$(cmdlne$)): GOTO 10 ELSE PRINT2 "FONT is "+foro$, 7: PRINT : GOTO 10 if ucase$(ff$) = "LOADFONT" then if cmdlne$="" then print2 "Syntax: LOADFONT fontname",7:print :goto 10 else Unloadfont:LoadFont cmdlne$: goto 10 if ucase$(ff$) = "UNLOADFONT" then UnLoadFont: goto 10 if ucase$(ff$) = "MOVE" then if cmdlne$="" then print2 "X="+str$(csrlin-1)+" Y="+str$(pos(0)),7:print: goto 10 else locate val(mid$(cmdlne$,1,instr(cmdlne$," ")-1)),val(mid$(cmdlne$,instr(cmdlne$," ")+1,len(cmdlne$)-instr(cmdlne$," "))):goto 10 if ucase$(ff$) = "TERM" then gosub CMPRT:goto 10 if ucase$(ff$) = "COM_OFF" then if cmm=0 then print2 "Com port not open",7:print:goto 10 else close #3:cmm=0:com(cmmprt) off:goto 10 if ucase$(ff$) = "TIMER" then if cmdlne$="" then Print2 "TIMER ="+str$(tmrr),7:print:goto 10 else tmrr=val(cmdlne$):goto 10 if ucase$(ff$) = "DIR" then s$="dir "+cmdlne$:shell s$:s$="":goto 10'ListFls:goto 10 if mid$(ff$,1,3) = "!AT" then if cmm=0 then print2 "Com port not open",7:print else Print #3,mid$(ff$,2,len(ff$)-1)+ " "+cmdlne$ if ucase$(ff$) = "AR" then Arch cmdlne$:goto 10 if ucase$(ff$) = "//?" then Hlppr:goto 10 PRINT2 "Unkown command:"+ ff$,7 PRINT GOTO 10 CMPRT: if cmm=0 then Print2 "Com port not open",7:print:goto 121 Com (cmmprt) off Connect for q=1 to 39 Print2 chr$(219),8 print2 chr$(219),15 next q print 121 RETURN SUB ClrBot x% = CSRLIN: y% = POS(0) LOCATE Lstln, 1, 0 PRINT STRING$(80, 32); LOCATE x%, y%, 1 END SUB SUB Comport (Port$) close #3 f$ = "COM" + RTRIM$(LTRIM$(Port$)) OPEN f$ AS #3 COM(VAL(Port$)) ON ON COM(VAL(Port$)) GOSUB CMPRT cmmprt=val(Port$) cport$=port$ END SUB SUB Corr (n$) lnn$ = UCASE$(MID$(n$, 1, 1)) FOR q = 2 TO LEN(n$) IF MID$(n$, q, 1) = " " OR MID$(n$, q, 1) = chr$(255) THEN lnn$ = lnn$ + " ": GOTO 122 IF MID$(n$, q, 1) <> "&" AND cptl = 0 THEN lnn$ = lnn$ + LCASE$(MID$(n$, q, 1)) IF cptl = 1 THEN lnn$ = lnn$ + UCASE$(MID$(n$, q, 1)): cptl = 0 IF MID$(n$, q, 1) = "." OR MID$(n$, q, 1) = "&" THEN cptl = 1 122 NEXT q n$ = lnn$ END SUB SUB Errorr (Msg$) Print2 Msg$,14 END SUB SUB ExeC (oof$) IF oof$ = "ON" THEN DFnt = 1 IF oof$ = "OFF" THEN DFnt = 0 END SUB SUB Font (t$, cl) IF cl = -1 THEN ELSE f$ = "C" + LTRIM$(RTRIM$(STR$(cl))): DRAW "X" + VARPTR$(f$) IF txt(32) = "" THEN LOCATE 1, 1: PRINT "System Error. Unable to continue.": END FOR qww = 1 TO LEN(t$) IF ASC(MID$(t$, qww, 1)) = 0 THEN DRAW "X" + VARPTR$(txt(32)) ELSE DRAW "X" + VARPTR$(txt(ASC(MID$(t$, qww, 1)))): DRAW "BL": GOTO 1011 1011 NEXT qww END SUB FUNCTION GetPrmt$ (pt$) FOR q = 1 TO LEN(pt$) IF MID$(pt$, q, 1) = "$" AND UCASE$(MID$(pt$, q + 1, 1)) = "P" THEN q = q + 1: mm$ = mm$ + wt$: GOTO nextl IF MID$(pt$, q, 1) = "$" AND UCASE$(MID$(pt$, q + 1, 1)) = "G" THEN q = q + 1: mm$ = mm$ + ">": GOTO nextl IF MID$(pt$, q, 1) = "$" AND UCASE$(MID$(pt$, q + 1, 1)) = "_" THEN q = q + 1: mm$ = mm$ + CHR$(10)+chr$(13): GOTO nextl IF MID$(pt$, q, 1) = "$" AND UCASE$(MID$(pt$, q + 1, 1)) = "T" THEN q = q + 1: mm$ = mm$ + TIME$: GOTO nextl IF MID$(pt$, q, 1) = "$" AND UCASE$(MID$(pt$, q + 1, 1)) = "D" THEN q = q + 1: mm$ = mm$ + DATE$: GOTO nextl if mid$(pt$,q,1)="$" and ucase$(mid$(pt$,q+1,1))="L" then q=q+1:mm$=mm$+"<":goto nextl mm$ = mm$ + MID$(pt$, q, 1) nextl: NEXT q GetPrmt$ = mm$ END FUNCTION SUB LoadFont (f$) open f$ for random as #1 if lof(1)=0 then close 1:MakFnt f$ else close 1 if egaa=1 then screen 9 else screen 12 OPEN f$ FOR INPUT AS #1: t = 0 DO UNTIL EOF(1) LINE INPUT #1, a$ txt(t) = a$ t = t + 1 LOOP CLOSE 1 END SUB SUB PRINT2 (t$, cv) IF HRes = 1 AND DFnt = 1 THEN ELSE GOTO 2111 x = -2: y = -2 IF x = -2 THEN x = (POS(0) * 8) - 7: g = -2 IF y = -2 THEN y = CSRLIN * 16: n = -2 d$ = "BM" + LTRIM$(RTRIM$(STR$(x))) + "," + LTRIM$(RTRIM$(STR$(y))) + " C" + LTRIM$(RTRIM$(STR$(cv))) 3 DRAW "X" + VARPTR$(d$) Font t$, cv IF LEN(t$) >= 80 THEN EXIT SUB LOCATE CSRLIN, POS(0) + LEN(t$) if csrlin=lstln then clrbot:print:locate lstln-1,1 if pos(0)=80 then print EXIT SUB 2111 COLOR cv PRINT t$; END SUB SUB ReadKey (prm$, t$, chrs, brd$, rd) brd$=ltrim$(rtrim$(brd$)) if csrlin=lstln then clrbot:print:locate lstln-1,1 t$ = "" PRINT2 prm$, 7 DO UNTIL i$ = CHR$(13) OR i$ = CHR$(27) if q=tmrr and mid$(brd$,1,2)="$$" then t$=mid$(brd$,3,len(brd$)-2) : Print2 t$,7:print:clrbot:exit sub IF q = tmrr and mid$(brd$,1,2)<>"$$" THEN IF POS(0) > 1 THEN PRINT : PRINT2 "Computer>" + brd$, 7: print:q = 0: PRINT2 prm$ + t$, 7: ELSE PRINT "IS2000>"; TAB(10); brd$: : q = 0: PRINT2 prm$ + t$, 7 IF i$ = CHR$(8) THEN IF LEN(t$) = 0 THEN i$ = "": GOTO 60 ELSE t$ = MID$(t$, 1, LEN(t$) - 1): LOCATE CSRLIN, POS(0) - 1: PRINT " "; : LOCATE CSRLIN, POS(0) - 1 i$ = UCASE$(INKEY$) x% = CSRLIN: y% = POS(0) IF TIME$ <> oldtm$ AND HRes = 0 THEN COLOR 15, 1: LOCATE Lstln, 1, 0: PRINT TIME$; STRING$(80 - LEN(TIME$), 32); : COLOR 7, 0: LOCATE x%, y%, 1: oldtm$ = TIME$: IF q < tmrr AND rd = 1 THEN q = q + 1 IF TIME$ <> oldtm$ AND HRes = 1 THEN COLOR 15: LOCATE Lstln, 1, 0: PRINT TIME$ + STRING$(80 - LEN(TIME$), 32); : COLOR 7: LOCATE x%, y%, 1: oldtm$ = TIME$: IF q < tmrr AND rd = 1 THEN q = q + 1 IF i$ = "" THEN GOTO 60 IF i$ = CHR$(0) + "=" THEN GOSUB 1009 if i$ = chr$(0) + ";" then SCRNSVR : cls : print2 prm$+t$,7 oldtm$ = TIME$ q = 0 IF (ASC(i$) > -1 AND ASC(i$) < 32) THEN GOTO 60 IF i$ = CHR$(13) OR i$ = CHR$(27) THEN GOTO 70 IF HRes = 1 THEN PRINT2 UCASE$(i$), 7 IF HRes = 0 THEN PRINT UCASE$(i$); t$ = t$ + i$ IF LEN(t$) >= chrs THEN t$ = MID$(t$, 1, LEN(t$) - 1): LOCATE CSRLIN, POS(0) - 1: PRINT " "; : LOCATE CSRLIN, POS(0) - 1 60 LOOP 70 PRINT2 "", 7 LastTyped = t$ if csrlin=Lstln-1 or csrlin=lstln then ClrBot:locate lstln,1 :print:locate lstln-1,1 else print EXIT SUB 1009 t$ = t$ + MID$(LastTyped, 1, chrs - LEN(t$) - 1) LOCATE CSRLIN, LEN(prm$) + 1, 1: PRINT2 t$, 7 RETURN END SUB FUNCTION ReadLn$ (ln) FOR q = 1 TO 80 mm$ = mm$ + CHR$(SCREEN(ln, q)) + CHR$(SCREEN(ln, q, 1)) NEXT q ReadLn$ = mm$ END FUNCTION SUB UnloadFont FOR q = 0 TO 255 txt(q) = "" NEXT q END SUB SUB WriteLn (Msg$, ln, bg) x% = CSRLIN: y% = POS(0) IF ln = 0 OR ln > 25 THEN EXIT SUB LOCATE ln, 1, 0 FOR q = 1 TO LEN(Msg$) STEP 2 COLOR ASC(MID$(Msg$, q + 1, 1)), bg PRINT MID$(Msg$, q, 1); NEXT q LOCATE x%, y%, 1 END SUB SUB connect if cmm=0 then print2 "Com port not open",7:print:exit sub Print2 "Terminal Emulation",14:print DO UNTIL ch$ = CHR$(27) ch$ = INKEY$ if ch$=chr$(13) then ch$=chr$(13)+chr$(10) IF ch$ <> "" THEN PRINT #3, ch$; IF LOC(3) <> 0 THEN inchar$ = INPUT$(1, #3) ELSE inchar$ = "" IF inchar$ = CHR$(8) AND POS(0) > 1 THEN LOCATE csrlin, POS(0) - 1 PRINT " "; LOCATE csrlin, POS(0) - 1 ELSEIF inchar$ = CHR$(8) AND POS(0) = 1 AND CSRLIN > 1 THEN LOCATE CSRLIN - 1, 79 PRINT " "; LOCATE , POS(0) - 1 end if if inchar$=chr$(8) then inchar$="" if pos(0)=79 then print IF inchar$ = CHR$(13) then locate csrlin,1 ELSE if inchar$=chr$(10) then cxx%=pos(0):print:locate csrlin,cxx%:cxx%=0 else Print2 inchar$,14 'IF inchar$ = CHR$(168) THEN END LOOP print #3,"+++" PRINT #3, "ATH" PRINT #3, "ATS0=0" print Print2 "Flushing com port buffer",8:print close #3 cmm=0 cmm=1 delay 1 Comport cport$ END SUB sub MakFnt (f$) SCREEN 9: CLS OPEN f$ FOR OUTPUT AS #1 FOR c = 0 TO 31: PRINT #1, "": NEXT c FOR q = 32 TO 170 IF q = 0 THEN d = 32 ELSE d = q LOCATE 1, 1: PRINT CHR$(d); GetFnt 33, 15, 33, lt$ CLS tt = LEN(lt$) + tt IF tt > 25000 THEN CLOSE 1:Exit sub PRINT #1, lt$ DRAW "X" + VARPTR$(lt$) NEXT q CLOSE 1 end sub SUB GetFnt (a, bg, os, f$) 'LINE (d * 8, m)-((d + 1) * 8, 15 + m), 1, B d = a - os: u = 15: r = 0 FOR x = (d) * 8 TO (1 + d) * 8 FOR y = 0 + m TO 15 + m u = u - 1 IF POINT(x, y) = bg THEN ELSE GOTO 310 uh$ = LTRIM$(RTRIM$(STR$(u))) ur$ = LTRIM$(RTRIM$(STR$(u - 1))) lt$ = lt$ + "BU" + uh$ + "DBD" + ur$ PSET (x, y), 14 310 NEXT y r = r + 1: u = 15 lt$ = lt$ + "br" NEXT x f$ = lt$ END SUB sub Hlppr print2 "-- COMMANDS --",15:print dchk print2 "EXIT - Quits RK-DOS",1:print dchk print2 "FREE - Displays the amount of free low memmory",2:print dchk print2 "SEND - Sends text to an open com port",3:print dchk print2 "CLS - Clears the screen",4:print dchk print2 "NOWAIT - Turns off the reminder",5:print dchk print2 "WAIT - Turns on the reminder",6:print dchk print2 "PROMPT - Changes the prompt",7:print dchk print2 "DOS - Runs a dos program",8:print dchk print2 "LINES - Changes the number of lines on the screen",9:print dchk print2 "COM_ON - Opens a com port",10:print dchk print2 "LOWRES - Changes to text mode",11:print dchk print2 "HIRES - Changes to VGA graphics mode",12:print dchk print2 "VER - Displays the RK-DOS version",13:print dchk print2 "FONT - Turns the Font on or off",14:print dchk print2 "LOADFONT - Loads a font",15:print dchk print2 "UNLOADFONT - Unloads the font from memmory",14:print dchk print2 "MOVE - Moves to a line and position on the screen",13:print dchk print2 "TERM - Activates the terminal emulation",12:print dchk print2 "COM_OFF - Closes the open com port",11:print dchk print2 "TIMER - Sets the timer for the WAIT statement",10:print dchk end sub SUB SCRNSVR if hres=1 then else goto 102 cls rot=240-45 if rtrim$(ltrim$(lcase$(command$)))="ega" then screen 9:mma=25:ht=100 else SCREEN 12:mma=30:ht=200 SZ = 200 'HT = 200 WZ = 0 DO UNTIL INKEY$ = CHR$(13) QW = RND * 43 + 1 QW = WZ * 5 FOR AD = 0 TO 16 LINE (320 - SZ + QW, ROT + HT + AD)-(320 + SZ - QW, 240 + HT + AD), 2 NEXT AD IF WZ < 39 AND D = 0 THEN WZ = WZ + 1 ELSE D = 1 IF WZ > 0 AND D = 1 THEN WZ = WZ - 1 ELSE D = 0 LOCATE mma, 1: PRINT "" LOOP exit sub 102 cls a$= chr$(176)+chr$(177)+chr$(178)+chr$(219)+chr$(219)+chr$(178)+chr$(177)+chr$(176) b$= chr$(219)+chr$(178)+chr$(177)+chr$(176)+chr$(176)+chr$(177)+chr$(178)+chr$(219) for q=1 to 10 f$=f$+a$ g$=g$+b$ next q color 15,1 locate ,,0 do until inkey$=chr$(13) print f$; delay .1 print g$; delay .1 loop color 7,0 locate ,,1 end sub SUB DCHK if csrlin=lstln-1 or csrlin=lstln then locate lstln,1:print:locate lstln-1,1 end sub FUNCTION FORO$ if DFnt=1 then FORO$="on" if DFnt=0 then FORO$="off" end function SUB WriteFat (f$, ext$, hh, mm, dd, mn, yy) f$ = f$ + STRING$(8, 32): f$ = MID$(f$, 1, 8) ext$ = ext$ + " ": ext$ = MID$(ext$, 1, 3) tt$ = f$ + ext$ + CHR$(hh) + CHR$(mm) + CHR$(dd) + CHR$(mn) + CHR$(yy) CLOSE 4 open "C:\YOUNICKS.FAT" for input as #4 do until eof(4) line input #4,ff$ if ucase$(ff$)=ucase$(tt$) then exst=1:close 4:goto 111 loop close 4 OPEN "C:\YOUNICKS.FAT" FOR APPEND AS #4 PRINT #4, tt$ CLOSE 4 111 OPEN "C:\YOUNICKS.FAT" FOR INPUT AS #4 END SUB SUB ListFls lbl$=dir$("*.*",8) print " Label in drive C is "+lbl$ do until eof(4) line input #4,ffm$ f$=mid$(ffm$,1,8) ext$=mid$(ffm$,9,3) hh$=rtrim$(ltrim$(str$(asc(mid$(ffm$,11,1))))) mm$=rtrim$(ltrim$(str$(asc(mid$(ffm$,12,1))))) dd$=rtrim$(ltrim$(str$(asc(mid$(ffm$,13,1))))) mn$=rtrim$(ltrim$(str$(asc(mid$(ffm$,14,1))))) yy$=rtrim$(ltrim$(str$(asc(mid$(ffm$,15,1))))) if len(hh$)=1 then hh$="0"+hh$ if len(mm$)=1 then mm$="0"+mm$ if len(dd$)=1 then dd$="0"+dd$ if len(mn$)=1 then mn$="0"+mn$ if len(yy$)=1 then yy$="0"+yy$ print2 f$+" "+ext$+" "+hh$+":"+mm$+" "+dd$+"/"+mn$+"/"+yy$,7:print loop RestFat print end sub sub RestFat close 4 open "C:\YOUNICKS.FAT" for input as #4 end sub sub arch (dd$) dim b as string * 1 if instr(dd$,"-")= 0 or dd$="" or instr(dd$,"A:") = 0 then print2 "Syntax: AR -{l|a|r} A:archive [F:file] ",7:print:exit sub else arcc$=mid$(dd$,instr(dd$,"A:")+2,len(dd$)-2-instr(instr(dd$,"A:"),dd$," ")) if instr(dd$,"F:")=0 then fspc$="*.*" else fspc$=mid$(dd$,instr(dd$,"F:")+2,12) crf$=dir$(fspc$) if instr(arcc$,".")=0 then arcc$=arcc$+".A" print2 "Opening archive "+arcc$,7:print open arcc$ for binary as #5 if mid$(dd$,instr(dd$,"-")+1,1)="A" then goto 12 if mid$(dd$,instr(dd$,"-")+1,1)="L" then goto 13 if mid$(dd$,instr(dd$,"-")+1,1)="R" then goto 14 print2 "Invaild switch: "+mid$(dd$,instr(dd$,"-"),2) ,7:print:close 5:exit sub 12 do until crf$="" print2 "Proccessing "+crf$,7:print open crf$ for binary as #6 put #5,,crf$ ddd=lof(6) put #5,,ddd for q=0 to lof(6) get #6,q,b put #5,,b next q close 6 crf$=dir$ loop close 5 exit sub 13 Print "Not availble yet (L)" close 5 exit sub 14 Print "Not availble yet (R)" close 5 end sub