 .OPT NO LIST›;  SAVE #D1:PERHNDLR.M65›;›;›;  LOAD #D1:SIO.M65›;›;  *= $E739› .PAGE "Peripheral Handler"›  LIST › .LOCAL›;›; PHR called from init code at $C410›; right after DOS init›PHR› LDA WARMST  Peripheral Handler reset› BEQ ?POWRUP Go if powerup›;› LDA # <CHLINK-18 Else on reset› STA ZCHAIN› LDA # >CHLINK-18› STA ZCHAIN+1›;›?59205› LDY #18     Point Chlink› CLC         Check if more› LDA (ZCHAIN),Y handler to› TAX         load› INY› ADC (ZCHAIN),Y› BEQ ?EXIT1  None›;› LDA (ZCHAIN),Y Add 18 bytes› STA ZCHAIN+1 from Chlink› STX ZCHAIN  Return complement› JSR ADD18   of sum, c=0 y=$ff› BNE ?EXIT1›;› JSR ?59540  a=0 y=$ff x=lsb› BCS ?EXIT1› BCC ?59205››;›?POWRUP› LDA #0› STA CHLINK› STA CHLINK+1› LDA #$4F    Do are you there? poll› BNE ?59291  Just done to set DCB?›;›?59246› LDA #0      Daux1/2 to get› TAY         handler info› JSR POLL.PD Daux1/2=0› BPL ?59255  Flag from sio›;›?EXIT1› RTS         No pd›;›;›?59255› CLC         Got a pd› LDA MEMLO› ADC DVSTAT  lsb handler size› STA TEMP1› LDA MEMLO+1› ADC DVSTAT+1 msb› STA TEMP2› SEC› LDA MEMTOP  Check if under› SBC TEMP1   memtop› LDA MEMTOP+1› SBC TEMP2› BCS ?59298  Yes, ok›;›?59289› LDA #$4E    Else null poll›;›?59291› TAY› JSR POLL.PD› JMP ?59246›;›?59298› LDA DVSTAT+2 sio address› LDX MEMLO› STX DVSTAT+2› LDX MEMLO+1› STX DVSTAT+3› JSR PHDLOD› BMI ?59289› SEC› JSR L59550› BCS ?59289› BCC ?59246›; -----------------------------›; Poll device.›;  If on CIO open a=device name›;                 y=device number›POLL.PD› PHA› LDX #9›?POLL.2› LDA ?DCBDAT.1,X› STA DDEVIC,X Get 4 bytes› DEX          into dvstat› BPL ?POLL.2› STY DAUX2    Set daux to name› PLA          and number› STA DAUX1› JMP SIOV›;›?DCBDAT.1› .BYTE $4F   ddevic› .BYTE 1     dunit› .BYTE $40   dcomnd› .BYTE $40   dstats› .WORD DVSTAT dbuflo/hi› .WORD 30    dtimlo/hi› .WORD 4     dbytlo/hi›; ------------------------------›PHDLOD› STA TEMP2   Load handler› LDX #0      Temp2=sio addr› STX TEMP1› DEX› STX TEMP3   Temp3=$FF› LDA DVSTAT+2 memlo› ROR A› BCC ?59384  must be even› INC DVSTAT+2› BNE ?59384› INC DVSTAT+3 memlo+1›;›?59384› LDA DVSTAT+2 memlo› STA LOADAD› LDA DVSTAT+3 memlo+1› STA LOADAD+1› LDA # <?GET1 Set up› STA GBYTEA  indirect› LDA # >?GET1 subroutine› STA GBYTEA+1› LDA #$80› STA ZLOADA› JMP PDRELOC›;›?GET1› LDX TEMP3   Get byte› INX         routine› STX TEMP3› BEQ ?59431›;›?59423› LDX TEMP3   Error exit?› LDA ICAX4+$30,X› CLC› RTS›;›?59431› LDA #$80› STA TEMP3› JSR ?GETBLOCK› BPL ?59423› SEC› RTS›;›?GETBLOCK› LDX #11    Get next›;›?BLOCK.2› LDA ?DCBDAT.2,X load› STA DDEVIC,X block› DEX› BPL ?BLOCK.2› LDX TEMP1   new memlo› STX DAUX1› INX› STX TEMP1› LDA TEMP2› STA DDEVIC› JMP SIOV›;›?DCBDAT.2› .BYTE 0    ddevic› .BYTE 1     dunit› .BYTE '&    dcomnd› .BYTE $40   dstats› .WORD CASBUF dbuflo/hi› .WORD 30    dtimlo/hi› .WORD 128   dbytlo/hi› .WORD 0     daux1/2›;›?59485› STY TEMP1   Search› STA TEMP2   handler chain› LDA # <CHLINK-18› STA ZCHAIN› LDA # >CHLINK-18› STA ZCHAIN+1›;›?59499› LDY #$12› LDA (ZCHAIN),Y› TAX› INY› LDA (ZCHAIN),Y› CMP TEMP2› BNE ?59519› CPX TEMP1› BNE ?59519› CLC› RTS›;›?59519› CMP #0› BNE ?59529› CPX #0› BNE ?59529›;›?59527› SEC› RTS›;›?59529› STX ZCHAIN› STA ZCHAIN+1› JSR ADD18› BNE ?59527› BEQ ?59499  Always›;›?59540› SEC         Handler› PHP         warmstart init› BCS ?59584  Always›;›PDWARM› STA DVSTAT+3 Warmstart› STY DVSTAT+2 with chaining›;›L59550› PHP         Cold start init› LDA #0› TAY› JSR ?59485› BCS ?59598› LDY #$12› LDA DVSTAT+2› STA (ZCHAIN),Y› TAX› INY› LDA DVSTAT+3› STA (ZCHAIN),Y› STX ZCHAIN› STA ZCHAIN+1› LDA #0› STA (ZCHAIN),Y› DEY› STA (ZCHAIN),Y›;›?59584› JSR ?JINIT  Init handler› BCC ?59601  and update memlo›;› LDA DVSTAT+3› LDY DVSTAT+2› JSR PDUNLINK›;›?59598› PLP› SEC› RTS›;›?59601› PLP› BCS ?59613› LDA #0› LDY #$10› STA (ZCHAIN),Y› INY› STA (ZCHAIN),Y›;›?59613› CLC› LDY #16› LDA MEMLO› ADC (ZCHAIN),Y› STA MEMLO› INY› LDA MEMLO+1› ADC (ZCHAIN),Y› STA MEMLO+1› LDY #15› LDA #0› STA (ZCHAIN),Y› JSR ADD18› LDY #15› STA (ZCHAIN),Y› CLC› RTS›;›?JINIT› CLC         Init handler› LDA ZCHAIN  Get init address› ADC #12› STA TEMP1› LDA ZCHAIN+1› ADC #0› STA TEMP2› JMP (TEMP1) To handler init›;› JMP DOSETBV Not referenced›;›PDUNLINK› JSR ?59485  Handler› BCS ?59733  unlinking› TAY› LDA ZCHAIN› PHA› LDA ZCHAIN+1› PHA› STX ZCHAIN› STY ZCHAIN+1› LDA COLDST› BNE ?59705› LDY #16› CLC› LDA (ZCHAIN),Y› INY› ADC (ZCHAIN),Y› BNE ?59731› JSR ADD18› BNE ?59731›;›?59705› LDY #$12› LDA (ZCHAIN),Y› TAX› INY› LDA (ZCHAIN),Y› TAY› PLA› STA ZCHAIN+1› PLA› STA ZCHAIN› TYA› LDY #$13› STA (ZCHAIN),Y› DEY› TXA› STA (ZCHAIN),Y› CLC› RTS›;›?59731› PLA› PLA›;›?59733› SEC› RTS›;› .BYTE 0     Following was 800› .BYTE 0     entry to Sioutl› JMP SIOUTL  Not referenced›