Help W/In-Line Code 2/2

 BBS: Inland Empire Archive
Date: 02-09-93 (08:46)             Number: 331
From: TOM HAMMOND                  Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Help W/In-Line Code   2/2      Conf: (2) Quik_Bas
'*** PART 2 OF 2 FROM TOM HAMMOND ***

'NOTE:  This code WILL NOT run as-is.  Please see Part 1 of 2 for
'       decsription of problem.

    ' Disk Head Cleaning Program
    ' Author: Bruce LaVigne
    ' Written: 1/11/84 for the Madison IBM PC User's Group
    ' Consult your drive manufacturer for cleaning recommendations

    DEF SEG : COLOR 7, 0: CLS

    LOCATE 1, 26
    PRINT "*** Disk Head Cleaner ***"

    ' initialize variables for reading assembly
    CLEAN$ = ""
    CHSUM = 0

    ' read assembly program into string
    FOR I = 0 TO 63
        READ BYTE
        CLEAN$ = CLEAN$ + CHR$(BYTE)
        CHSUM = CHSUM + BYTE
    NEXT

    READ CHECK
    IF CHSUM <> CHECK THEN
        PRINT "Bad checksum-retype data"
        END
    END IF

110
    LOCATE 4, 1
    PRINT "Clean which drive? (A or B): ";

115
    DO: DR$ = UCASE$(INKEY$): LOOP UNTIL LEN(DR$)

    ' Compute Drive #
    DR$ = LEFT$(DR$, 1)
    DRV = (ASC(DR$) AND &H5F) - 65

    IF DRV < 0 OR DRV > 1 THEN
        BEEP
        GOTO 110
    END IF

    POINTER = VARPTR(CLEAN$) + 1
    ASSEM = PEEK(POINTER) + 256 * PEEK(POINTER + 1)

    ' set drive number to clean
    POKE ASSEM + 13, DRV

    ' compute relocation address
    TADR = ASSEM + 11: TADRH = INT(TADR / 256)

    IF TADR > 32767 THEN
        TADR = TADR - 65536!
    END IF

    TADRL = TADR AND &HFF

    ' put new address pointer in
    POKE ASSEM + 44, TADRL: POKE ASSEM + 45, TADRH

    LOCATE 10, 12
    COLOR 0, 7

    PRINT ">> Put cleaning disk in drive "; DR$; ": and press any key <<"
    LOCATE 12, 18
    PRINT ">> Or press <Q>uit or <C>hange drives <<"

220
    DO: A$ = UCASE$(INKEY$): LOOP UNTIL LEN(A$)

    IF A$ = "Q" THEN
        GOTO 295
    ELSEIF A$ = "C" THEN
        COLOR 7, 0, 0
        CLS
        GOTO 290
    ELSE
        GOTO 220
    END IF

    LOCATE 10, 1
    COLOR 7, 0
    PRINT SPC(78);
    LOCATE 12, 1
    PRINT SPC(78);

    LOCATE 10, 30
    COLOR 31, 0
    PRINT "*** Cleaning ***"
    COLOR 7, 0

    ' call actual disk routine
    CALL ASSEM

    LOCATE 10, 1
    PRINT SPC(78);

    LOCATE 6, 1
    PRINT "Clean another disk? <Y>es or <N>o  ";

280
    A$ = INKEY$
    SELECT CASE UCASE$(A$)
        CASE "Y"
            GOTO 290
        CASE "N"
            GOTO 295
        CASE ELSE
            GOTO 280
    END SELECT

290
    LOCATE 6, 1
    PRINT SPC(78);
    GOTO 110

295
    DEF SEG
    COLOR 7, 0
    KEY OFF
    CLS

    END

    DATA 49,192,205,26,81,82,184,1,4,185,1,0,186,0,0,205,19
    DATA 49,192,205,26,60,0,91,88,80,83,116,7,129,195,176,0
    DATA 21,24,0,129,195,34,2,21,0,0,190,11,1,128,52,39,57
    DATA 200,119,209,57,211,119,205,88,88,49,192,205,19,203

    ' checksum
    DATA 5785
---
 * Origin: Night Shift BBS (314)635-7588 HST 14.4 (1:289/15)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET