Application Note
AN1060
—
Rev. 1.0
310
MOTOROLA
1598 GOSUB 8020
1599 WEND
1600 XMT = 0: RCV = 0
’
POINTERS TO XMIT AND RECEIVE BYTES
1610 A$ = CHR$(CODE%(XMT))
1620 GOSUB 6500
’
SEND FIRST BYTE
1625 FOR I = 1 TO CODESIZE% - 1
’
ZERO BASED ARRAY 0 -> CODESIZE-1
1630 A$ = CHR$(CODE%(I))
’
SEND SECOND BYTE TO GET ONE IN QUEUE
1635 GOSUB 6500
’
SEND IT
1640 GOSUB 8000
’
GET BYTE FOR VERIFICATION
1650 RCV = I - 1
1660 LOCATE 10,1:PRINT "Verifying byte #"; I; " "
1664 IF CHR$(CODE%(RCV)) = B$ THEN 1670
1665 K=CODE%(RCV):GOSUB 8500
1666 LOCATE 1,1:PRINT "Byte #"; I; " ", " - Sent "; HX$;
1668 K=ASC(B$):GOSUB 8500
1669 PRINT " Received "; HX$;
1670 NEXT I
1680 GOSUB 8000
’
GET BYTE FOR VERIFICATION
1690 RCV = CODESIZE% - 1
1700 LOCATE 10,1:PRINT "Verifying byte #"; CODESIZE%; " "
1710 IF CHR$(CODE%(RCV)) = B$ THEN 1720
1713 K=CODE(RCV):GOSUB 8500
1714 LOCATE 1,1:PRINT "Byte #"; CODESIZE%; " ", " - Sent "; HX$;
1715 K=ASC(B$):GOSUB 8500
1716 PRINT " Received "; HX$;
1720 LOCATE 8, 1: PRINT : PRINT "Done!!!!"
4900 CLOSE
4910 INPUT "Press [RETURN] to quit...", Q$
5000 END
5900
’
***********************************************************************
5910
’
* SUBROUTINE TO READ IN ONE BYTE FROM A DISK FILE
5930
’
* RETURNS BYTE IN A$
5940
’
***********************************************************************
6000 FLAG = 0
6010 IF EOF(1) THEN FLAG = 1: RETURN
6020 A$ = INPUT$(1, #1)
6030 RETURN
6490
’
***********************************************************************
6492
’
* SUBROUTINE TO SEND THE STRING IN A$ OUT TO THE DEVICE
6494
’
* OPENED AS FILE #2.
6496
’
***********************************************************************
6500 PRINT #2, A$;
6510 RETURN
6590
’
***********************************************************************
6594
’
* SUBROUTINE THAT CONVERTS THE HEX DIGIT IN A$ TO AN INTEGER
6596
’
***********************************************************************
7000 X = INSTR(H$, A$)
7010 IF X = 0 THEN FLAG = 1
7020 X = X - 1
7030 RETURN