DataBasic Development Program Example
This DataBasic program provides a menu and selections for editing, compiling, running, and debugging DataBasic programs.
This program allows you to store source code in one file and object code in another. If the letter 'B' is used as the file-name, then the source code is stored in file 'BP', the object code is stored in file 'BOC', and 'BASIC' is displayed as the file name on the menu screen.
You can change the above file names by changing lines 017, 018, 019, and 020.
BAS.DEV 001 ************************************************** 002 ***** DataBasic PROGRAMMING AID ***** 003 ***** Programmer Name, Date ***** 004 ************************************************** 005 EQU NILL TO "" 006 CLR=@(-1); EOL=@(-4); EOS=@(-3) 007 FLAG=0; PROMPT "" 008 FLSH=@(-130); NORM=@(-128) 009 DIM M(25); MAT M=NILL; GOSUB MSGS 010 ************************************************** 011 ***** GET FILE AND ITEM NAMES ***** 012 ************************************************** 013 PROCREAD WHICH ELSE GO GTF2 014 FIL=EXTRACT(WHICH,2,0,0) 015 FLAG=1 016 GTFL: IF FIL=NILL THEN FLAG=0; GO GTF2 017 IF FIL="B" THEN 018 FILD="BASIC" 019 SFILE="BP" 020 OFILE="BOC" 021 END ELSE 022 FILD=FIL; SFILE=FIL; OFILE=FIL 023 END 024 GO GTF4 025 GTF2: PRINT "ENTER FILE NAME...":CHAR(208): 026 INPUT FIL 027 IF FIL=NILL THEN STOP 028 GO GTFL 029 GTF4: OPEN SFILE TO FILE ELSE 030 PRINT "CAN'T OPEN FILE '":SFILE:"'" 031 GO GTF2 032 END 033 IF FLAG=0 THEN GO GTF8 034 ITEM.ID=EXTRACT(WHICH,3,0,0) 035 GTF6: IF ITEM.ID=NILL THEN GO GTF8 ELSE GO MENU 036 GTF8: PRINT "ENTER ITEM-ID...":CHAR(208): 037 INPUT ITEM.ID 038 GO GTF6 039 ************************************************** 040 ***** DISPLAY MENU AND PROMPT FOR CHOICE ***** 041 ************************************************** 042 MENU: PRINT CLR 043 READV JUNK FROM FILE,ITEM.ID,1 ELSE... GOSUB NEW1 044 PRINT @(15,0):M(19) 045 PRINT @(15,1):M(20) 046 PRINT @(60,2):"FILE: ":FILD 047 PRINT @(60,3):"ITEM: ":ITEM.ID 048 PRINT @(0,3):M(1) 049 TX=2; LN=4 050 LOOP UNTIL M(TX)=NILL DO 051 PRINT @(5,LN):M(TX) 052 TX=TX+1; LN=LN+1 053 REPEAT 054 PRINT @(0,LN+1):"CHOICE... ": 055 INPUT CHOICE 056 ************************************************** 057 ***** EVALUATE CHOICE AND GO DO IT ***** 058 ************************************************** 059 BEGIN CASE 060 CASE CHOICE=NILL 061 PRINT @(66,4):SPACE(9):@(0,18); STOP 062 CASE CHOICE="E"; GO EDUT 063 CASE CHOICE="S"; GO SEDT 064 CASE CHOICE="C"; GO COMP 065 CASE CHOICE="CM"; GO COMP 066 CASE CHOICE="CL"; GO COMP 067 CASE CHOICE="R"; GO RNIT 068 CASE CHOICE="RC"; GO RNCT 069 CASE CHOICE="L"; GO CTLG 070 CASE CHOICE="PR"; GO CLPT 071 CASE CHOICE="B"; GO BLST 072 CASE CHOICE="V"; GO BVFY 073 CASE CHOICE="DS"; GO DELS 074 CASE CHOICE="DO"; GO DELO 075 CASE CHOICE="DT"; GO DELT 076 CASE CHOICE="DC"; GO DELC 077 END CASE 078 GO MENU 079 ************************************************** 080 ***** EDIT SOURCE CODE ITEM ***** 081 ************************************************** 082 EDUT: DATA "TB 09,13,17,21,25,29,40,68","P... L22","P" 083 STMT="EDIT ":SFILE:" ":ITEM.ID 084 DOPF: PERFORM STMT 085 GO MENU 086 SEDT: STMT="SE ":SFILE:" ":ITEM.ID 087 GO DOPF 088 ************************************************** 089 ***** COMPILE PROGRAM ***** 090 ************************************************** 091 COMP: STMT="BASIC ":OFILE:" ":ITEM.ID 092 IF CHOICE="CM" THEN STMT=STMT:" (M)" 093 IF CHOICE="CL" THEN STMT=STMT:" (L)" 094 IF FIL="B" THEN 095 OPEN OFILE TO DFIL ELSE NULL 096 ST1="COPY ":SFILE:" ":ITEM.ID 097 DATA "(BOC)" 098 PERFORM ST1 099 END 100 PERFORM STMT 101 IF FIL="B" THEN DELETE DFIL,ITEM.ID 102 GO PRMP 103 ************************************************** 104 ***** RUN PROGRAM ***** 105 ************************************************** 106 RNIT: STMT="RUN ":OFILE:" ":ITEM.ID 107 DOIT: PERFORM STMT 108 GO PRMP 109 ************************************************** 110 ***** EXECUTE CATALOGED PROGRAM ***** 111 ************************************************** 112 RNCT: STMT=ITEM.ID 113 GO DOIT 114 ************************************************** 115 ***** CATALOG ITEM ***** 116 ************************************************** 117 CTLG: STMT="CATALOG ":OFILE:" ":ITEM.ID 118 GO DOIT 119 ************************************************** 120 ** COPY LISTING OF SOURCE CODE TO LINE PRINTER ** 121 ************************************************** 122 CLPT: STMT="COPY ":SFILE:" ":ITEM.ID:" (P)" 123 GO DOPF 124 ************************************************** 125 *** EXECUTE 'BLIST' COMMAND (FORMATTED PRINTING) *** 126 ************************************************** 127 BLST: STMT="BLIST ":SFILE:" ":ITEM.ID 128 PRINT @(0,3):EOS 129 PRINT M(22); PRINT M(23); PRINT M(24) 130 PRINT ">":; INPUT OPTS 131 IF OPTS=NILL THEN GO DOPF 132 STMT=STMT:" (":OPTS:")" 133 GO DOPF 134 ************************************************** 135 ***** BVERIFY OBJECT CODE ***** 136 ************************************************** 137 BVFY: STMT="BVERIFY ":OFILE:" ":ITEM.ID 138 GO DOIT 139 ************************************************** 140 ***** DELETE SOURCE CODE ITEM ***** 141 ************************************************** 142 DELS: STMT="DELETE ":SFILE:" ":ITEM.ID 143 DATA "","" 144 PERFORM STMT 145 PRINT "'":ITEM.ID:"' DELETED" 146 GO PRMP 147 ************************************************** 148 ***** DELETE OBJECT CODE ***** 149 ************************************************** 150 DELO: ITM="$":ITEM.ID 151 DEL2: STMT="DELETE ":OFILE:" ":ITM 152 DATA "","" 153 PERFORM STMT 154 PRINT "'":ITM:"' DELETED" 155 GO PRMP 156 ************************************************** 157 ***** DELETE SYMBOL TABLE ***** 158 ************************************************** 159 DELT: ITM="*":ITEM.ID 160 GO DEL2 161 ************************************************** 162 ***** DELETE CATALOG ***** 163 ************************************************** 164 DELC: STMT="DELETE-CATALOG ":ITEM.ID 165 GO DOIT 166 ************************************************** 167 ***** PROVIDE PROMPT BEFORE RETURN TO MENU ***** 168 ************************************************** 169 PRMP: PRINT CHAR(216):; INPUT X,1 170 GO MENU 171 ************************************************* 172 ***** DISPLAY 'NEW ITEM' FLAG ***** 173 ************************************************* 175 NEW1: PRINT @(66,4):FLSH:"NEW ITEM":NORM 176 RETURN 177 ************************************************* 178 ***** TEXT FOR MENU AND OPTIONS ***** 179 ************************************************* 180 MSGS: M(1)="SELECTIONS:" 181 M(2)="E - EDIT" 182 M(3)="S - SCREEN EDIT" 183 M(4)="C - COMPILE" 184 M(5)="CM - COMPILE WITH SYMBOL TABLE (M)" 185 M(6)="CL - COMPILE WITH LIST (P)" 186 M(7)="L - CATALOG PROGRAM" 187E1 M(8)="R - RUN PROGRAM" 188 M(9)="RC - RUN (EXECUTE) CATALOGED PROGRAM" 189 M(10)="PR - COPY TO PRINTER" 190 M(11)="B - BLIST" 191 M(12)="V - VERIFY OBJECT CODE OF... CATALOGED PROGRAM" 192 M(13)="DS - DELETE SOURCE CODE ITEM" 193 M(14)="DO - DELETE OBJECT CODE" 194 M(15)="DT - DELETE SYMBOL TABLE" 195 M(16)="DC - DELETE CATALOGED PROGRAM" 196 M(19)="DataBasic DEVELOPMENTAL... ASSISTANCE PROGRAM" 197 M(20)=STR("-",43) 198 M(22)="OPTIONS:" 199 M(23)="(See pages 4-5 and 4-6 of D/B Ref. Man.)" 200 M(24)="A,B,C,D,E,F,I,K,L,M,N,P,S,U,X,Z... n{,m}, Return" 201 RETURN 202 ************************************************* 201 FINI: END