;  SAVE #D1:DISKOPS.M65›;›;›;  LOAD #D1:PARALLEL.M65›;›;›;    *= $C58B› .PAGE "Disk Handler and Boot"›  LIST  › .LOCAL ›;›INITDOS› LDA WARMST  If a 0 here› BEQ ?READD  then try to boot› LDA BOOT?   Else on reset &› AND #1      if no disk boot› BEQ ?NODISK just rts; else› JMP ?XPROG  goto booted pgm›;›?READD› LDA #1      Check status› STA DUNIT   on D1:› LDA #'S› STA DCOMND  Change to› JSR DSKINV  check all› BMI ?NODISK›;›?READ1› LDA #0      Read sector 1› STA DAUX2› LDA #1› STA DAUX1› LDA #0      into page 4› STA DBUFLO› LDA #4› STA DBUFHI›;›?XREAD1› JSR ?GET1   Go read 1st› BPL ?GOT1ST and exit if ok›;›?ERROR› JSR ?NOBOOT› LDA CASSBT  If cassette go› BEQ ?READ1  try it›;›?NODISK› RTS ›;›;›?GOT1ST› LDX #3›;›?COPY4› LDA $0400,X Copy first› STA DFLAGS,X four bytes to› DEX         DFlags & Bootad› BPL ?COPY4› LDA BOOTAD  Copy Bootad to› STA RAMLO   Ramlo/hi› LDA BOOTAD+1› STA RAMHI› LDA $0404   Bytes 5 and 6› STA DOSINI  to Dosini› LDA $0405› STA DOSINI+1›;›?SAVBUF› LDY #127    Boot secs SD›;›?SLOOP› LDA $0400,Y ; Copy from› STA (RAMLO),Y ;    page4 to› DEY         ;    address in› BPL ?SLOOP  ;     Ramlo/hi› CLC         Bump pointer› LDA RAMLO   by 128› ADC #$80› STA RAMLO› LDA RAMHI› ADC #0› STA RAMHI› DEC DBSECT  Dec sectors to› BEQ ?DONE   do and› INC DAUX1   point to next›;›?NEXT› JSR ?GET1   Get it and if› BPL ?SAVBUF ok, move to Ram› JSR ?NOBOOT Oops› LDA CASSBT› BNE ?ERROR› BEQ ?NEXT   Go always›;›?DONE› LDA CASSBT› BEQ ?NOTAPE› JSR ?GET1›;›?NOTAPE› JSR ?XBOOT› BCS ?ERROR› JSR ?XPROG› INC BOOT?› RTS ›;›?XBOOT› CLC         Exec boot loader› LDA BOOTAD› ADC #6› STA RAMLO› LDA BOOTAD+1› ADC #0› STA RAMHI› JMP (RAMLO)›;›?XPROG› JMP (DOSINI)›;›;›?NOBOOT› LDX # <MSGBERR Display› LDY # >MSGBERR boot error› TXA         message› LDX #0› STA ICBAL,X› TYA › STA ICBAH,X› LDA #9› STA ICCOM,X› LDA #$FF› STA ICBLL,X› JMP CIOV›;›?GET1› LDA CASSBT  Get next› BEQ ?GETSEC block or sector› JMP RBLOKV›;›?GETSEC› LDA #'R› STA DCOMND› LDA #1› STA DUNIT› JMP DSKINV›;›BOOTTAPE› LDA WARMST  Attempt› BEQ ?READC  cassette boot› LDA BOOT?   If no tape› AND #2      boot flagged› BEQ ?CQUIT  then exit› JMP ?XTAPE›;›?READC› LDA CKEY    Start pressed?› BEQ ?CQUIT  No› LDA #$80    Continuous› STA FTYPE   records› INC CASSBT  Flag tape boot› JSR CSOPIV  Open cassette› JSR ?XREAD1 Read first block› LDA #0› STA CASSBT  Clear› STA CKEY    these› ASL BOOT?   Make Boot?=2› LDA DOSINI  Set› STA CASINI  reset› LDA DOSINI+1 vector› STA CASINI+1›;›?CQUIT› RTS ›;›;›?XTAPE› JMP (CASINI)›;›;›DSKINI› LDA #160    Init Disk i/o› STA DSKTIM› LDA #$80    Single density› STA DSCTLN  sector size› LDA #0› STA DSCTLN+1› RTS ›;›DODISK› LDA #$31    Disk i/o› STA DDEVIC› LDA DSKTIM› LDX DCOMND  This is why you› CPX #'!     can't use Dskinv› BEQ ?TIME   to format ED› LDA #7      Read/Write time›;›?TIME› STA DTIMLO› LDX #$40    From disk› LDA DCOMND› CMP #'P› BEQ ?ISPUT› CMP #'W› BNE ?STAT?›;›?ISPUT› LDX #$80    To disk›;›?STAT?› CMP #'S› BNE ?NOTS› LDA # <DVSTAT Read status› STA DBUFLO› LDA # >DVSTAT› STA DBUFHI› LDY #4› LDA #0› BEQ ?XSIO   go always›;›?NOTS› LDY DSCTLN› LDA DSCTLN+1›;›?XSIO› STX DSTATS› STY DBYTLO› STA DBYTHI› JSR SIOV› BPL ?CONT› RTS         exit on error›;›?CONT› LDA DCOMND› CMP #'S› BNE ?REPORT› JSR ?SETBUF› LDY #2      Get disk format› LDA (BUFADR),Y time from› STA DSKTIM  status frame›;›?REPORT› LDA DCOMND› CMP #'!› BNE ?ENDREP› JSR ?SETBUF Format report,› LDY #$FE    Want zero so›;›?BUMP2› INY         allow for pre-› INY         increment here.›;›?FF?› LDA (BUFADR),Y Look for› CMP #$FF    two bytes of $FF› BNE ?BUMP2› INY         Code designed› LDA (BUFADR),Y for 810 drive› INY         which returns› CMP #$FF    bad sector list› BNE ?FF?    into buffer.› DEY         Point to byte› DEY         before the $FF's› STY DBYTLO  and report as› LDA #0      sector size› STA DBYTHI›;›?ENDREP› LDY DSTATS› RTS ›;›?SETBUF› LDA DBUFLO  Set buffer› STA BUFADR  address› LDA DBUFHI› STA BUFADR+1› RTS ›