For use in
machine language entry.
by Clayton Walnum
M/L Editor provides an easy method to enter our machine language listings. It won't allow you to skip lines or enter bad data. For convenience, you may enter listings in multiple sittings. When you're through typing a listing with M/L Editor, you'll have a complete, runnable object file on your disk. There is one hitch: it's for disk users only. My appolgies to those with cassette systems.
Listing 1 is M/L Editor's BASIC listing. Type it in and, when it's free of typos, save a copy to disk, then run it.
On a first run, you'll be asked if you're starting a new listing or continuing from a previously saved point. Press S to start, or C to continue.
You'll then be asked for a filename. If you're starting a new listing, type in the filename you want to save the program under, then press RETURN. If there's already a file by that name on the disk, you'll be asked if you wish to delete it. Press Y to delete the file, or N to enter a new filename.
If you're continuing a file, type in the name you gave the file when you started it. If the program can't find the file, you'll get an error message and be prompted for another filename. Otherwise, M/L Editor will calculate where you left off, then go on to the data entry screen.
Each machine language program in ANALOG Computing is represented by a list of BASIC data statements. Every line contains 16 bytes, plus a checksum. Only the numbers following the word DATA need to be considered.
M/L Editor will display, at the top of the screen, the number of the line you're currently working on. As you go through the line, you'll be prompted for each entry. Simply type the number and press RETURN. If you press RETURN without a number, the default is the last value entered.
This feature provides a quick way to type in lines with repetitions of the same number. As an added convenience, the editor will not respond to the letter keys (except Q for "quit"). You must either enter a number or press RETURN.
When you finish a line, M/L Editor will compare the entries' checksum with the magazine's checksum. If they match, the screen will clear, and you may go on to the next line.
If the checksums don't match, you'll hear a buzzing sound. The screen will turn red, and the cursor will be placed back at the first byte of data. Compare the magazine listing byte by byte with your entries. If a number's correct, press RETURN.
If you find an error, make the correction. When all data's valid, the screen will return to grey, and you'll be allowed to begin the next line.
Make sure you leave your disk in the drive while typing. The data is saved continuously.
You may stop at any time (except when you have a red screen) by entering the letter Q for byte #1. The file will be closed, and the program will return you to BASIC. When you've completed a file, exit M/L Editor in the same way.
When you've finished typing a program, the file you've created will be ready to run. In most cases, it should be loaded from DOS via the L option. Some programs may have special loading instructions; be sure to check the program's article.
If you want the program to run automatically when you boot the disk, simply name the file AUTORUN.SYS (make sure you have DOS on the disk).
|The two-letter checksum code preceding the line numbers here is not a part of the BASIC program. For further information, see the "BASIC Editor II," in issue 47.|
AZ 10 DIM BF(16),N$(4),A$(1),B$(1),F$(15)
LF 11 DIM MOD$(4)
BN 20 LINE=1000:RETRN=155:BACKSP=126:CHKS
GO 30 GOSUB 450:POSITION 10,6:? "tart or
ontinue? ";:GOSUB 500:? CHR$(A)
ZG 40 POSITION 10,8:? "FILENAME";:INPUT F
$:POKE 752,1:? " "
FE 50 IF LEN(F$)<3 THEN POSITION 20,10:?
" ":GOTO 40
NF 60 IF F$(1,2)<>"D:" THEN F1$="D:":Fl$(
KL 70 F1S=FS
TN 80 IF CHR$(A)="S" THEN 120
FD 90 TRAP 430:OPEN #2,4,0,F1$:TRAP 110
HQ 100 FOR X=1 TO 16:GET #2,A:NEXT X:LINE
WM 110 CLOSE #2:OPEN #2,9,0,F1$:GOTO 170
VT 120 TRAP 160:OPEN #2,4,0,F1$:GOSUB 440
:POSITION 10,10:? "FILE ALREADY EXISTS
ZU 130 POSITION 10,12:? "ERASE IT? ";:GOS
UB 500:POKE 752,1:? CHR$(A)
VH 140 IF CHR$(A)="N" OR CHR$(A)="n" THEN
CLOSE )72:GOT0 30
QG 150 IF CHR$(A)<>"Y" AND CHR$(A)<>"y" T
BH 160 CLOSE #2:OPEN ):2,8,0,F1$
IE 170 GOSUB 450:POSITION 10,1:? "
GH 180 L1=3:FOR X=1 TO 16:POSITION 13*(X<
10)+12*(X>9),X+2:POKE 752,0:? "BYTE #"
;X;": ";:GOSUB 310
KH 190 IF EDIT AND L=0 THEN BYTE=BF(X):GO
FY 200 BYTE=VAL(N$)
OZ 201 MOD$=N$
BU 210 POSITION 22,X+2:? BYTE;" "
YZ 220 BF(X)=BYTE:CHKSUM=CHKSUM+BYTE*X:IF
CHKSUM>9999 THEN CHKSUM=CHKSUM-10000
MS 230 NEXT X:CHKSUM=CHKSUM+LINE:IF CHKSU
M>9999 THEN CHKSUM=CHKSUM-10000
IG 240 POSITION 12,X+2 POKE 752,0:? "CHEC
KSUM: ";:L1=4:GOSUB 310
EW 250 IF EDIT AND L=0 THEN 270
QM 260 C=VAL(N$)
SY 270 POSITION 22,X+2:? C;" "
IL 280 IF C=CHKSUM THEM 300
DI 290 GOSUB 440:EDIT=1:CHKSUM=0:GOTO 180
LW 300 FOR X=1 TO 16:PUT #2,BF(X):NENT X:
FV 310 L=0
KZ 320 GOSUB 500:IF (A=ASC("Q") OR A=ASC(
"q")) AND X=1 AND NOT EDIT THEN 420
PO 330 IF A<>RETRN AND A<>BACKSP AND (A<4
8 OR A>57) THEN 320
DX 331 IF A=RETRN AND N$="" THEN N$=MOD$
TD 335 IF A=RETRN AND L=0 AND K>1 THEN 35
JR 340 IF ((A=RETRN AND NOT EDIT) OR A=B
ACKSP) AND L=0 THEN 320
DW 350 IF A=RETRN THEN POKE 752,1:? " ":R
GG 360 IF A<> BACKSP THEN 400
SA 370 IF L>1 THEN N$=N$(1,L-1):GOTO 390
AS 380 N$=""
RE 390 ? CHR$(BACKSP);:L=L-l:GOTO 320
BB 400 L=L+1:IF L>L1 THEN A=RETRN:GOTO 35
WX 410 N$(L)=CHR$(A):? CHR$(A);:GOTO 320
KN 420 GRAPHICS 0:END
YT 430 GOSUB 440:POSITION 10,10:? "NO SUC
H FILE!":FOR X=1 TO 1000:NEXT X:CLOSE
FD 440 POKE 710,48:SOUND 0,100,12,8:FOR X
=1 TO 50:NEXT X:SOUND 0,0,0,0:RETURN
MY 450 GRAPHICS 23:POKE 16,112:POKE 53774
,112:POKE 559,0:POKE 710,4
XR 460 DL=PEEK(560)+256*PEEK(561)+4:POKE
HW 470 FOR X=3 TO 39 STEP 2:POKE DL+X,2:N
EXT X:FOR X=4 TO 40 STEP 2:POKE DL+X,0
ZW 480 POKE DL+41,65:POKE DL+42,PEEK(560)
:POKE DL+43,PEEK(561):POKE 87,0
AC 490 POSITION 2,0:? "analog ml editor":
WZ 500 OPEN #1,4,0,"K:":GET #1,A:CLOSE #1