sta $00        ;store job code to job queue
         cli            ;enable interrupts
         wjloop
         lda $00        ;wait for job to finish
         bmi wjloop
         ldx oldid      ;restore old data block id
         stx $47
         rts            ;and exit
         newid .hex  00 ;storage fo? new data block id
         oldid .hex  00 ;storage for old data block id
         
         end
      
      22 ERROR - ERROR PRESENT CHECK
      
      You can make a simpler protection check by using DBWRITE to
      create a DOS 22 error, and then do nothing more than check the
      drive error channel for the proper error code. The BASIC code would
      read as follows:
      
               10 REM: CHECK FOR 22 ERROR
               20 OPEN 15,8,15,"I":REM INITIALIZE DRIVE
               30 OPEN 2,8,2,"#": REM RESERVE BUFFER FOR SECTOR READ
               40 PRINT#15,"U1:2 0 01 00":REM READ TRACK/SECTOR 1/0
               50 GET#15,A$:REM READ ERROR CHANNEL:CLOSE 2:ClOSE 15
               60 IF A$="2" THEN PRINT "DATA BLOCK NOT FOUND!":END:REM
               PROTECTION PASSED
               70 PRINT "DATA BLOCK WAS FOUND":REM PROTECTION FAILED
         
      A machine-language routine to do the same would read as follows:

               .org $c000
               
               lda #$00       ;open cmd channel
               jsr $ffbd      ;SETNAM
               lda #$0f
               ldx #$08       ;to drive 8
               tay
               jsr $ffba      ; SETLFS
               jsr $ffc0      : OPEN
               lda #$01       ;open buffer channel
               ldx #pound
               jsr $ffbd
               lda #$02
               ldx #$08
               tay
               jsr $ffba
               jsr $ffc0
               jsr $ffcc      ;clear channels CLRCHN
               ldx #$0f       ;output "u1" command
      
            K.J. REVEALED TRILOGY    PAGE [144]    (C)1990 K.J.P.B.

<<previous page - next page>>