;  SAVE #D1:PARALLEL.M65›;  LOAD #D1:SELFTEST.M65› .PAGE "Parallel Device Handler"›  LIST› .LOCAL› *= $D100   Parallel device›?PDGETPUT› *= $D101   equates›?PDRESET› *= $D1FF›?PDSELECT› *= $D800› *= *+2     Rom checksum› *= *+1     revision number›?PDID1› *= *+1     Device id num ($80)› *= *+1     Device type›?PDIOV› *= *+3     i/o vector›?PDINTV› *= *+3     int vector›?PDID2› *= *+1     id number ($91)› *= *+1     name (ascii)›?PDDEVTB› *= *+2     open vector-1› *= *+2     close vector-1› *= *+2     get byte-1› *= *+2     put byte-1› *= *+2     status-1› *= *+2     special-1›?INITPD› *=  *+3     Jmp init›;› *= $C745›; Relocate routine to new address›PDRELOC› LDX #5      Clear 6 bytes›?RLOOP› LDA #0      from $2C9-$2CE› STA RUNADR,X Labels   Runadr› DEX          cleared  Hiused› BPL ?RLOOP   are      Zhiuse›;›?51023› LDA #0› STA LCOUNT  Temporary counter› JSR ?GETBYT› LDY #156    Error code› BCS ?RELXIT›;› STA HIBYTE  csum lsb› JSR ?GETBYT› LDY #156› BCS ?RELXIT›;› STA RECLEN  csum msb› LDA HIBYTE› CMP #$0B› BEQ ?51093›;› ROL A› TAX› LDA ?ADDRS,X› STA RUNADR› LDA ?ADDRS+1,X› STA RUNADR+1›;›?51069› LDA RECLEN› CMP LCOUNT› BEQ ?51023›;› JSR ?GETBYT› LDY #156› BCS ?RELXIT›;› JSR ?RUN› INC LCOUNT› BNE ?51069›;›?RELXIT› RTS         Return c=0 if ok›;›?51093› JSR ?GETBYT Handle› LDY #156    end record› BCS ?EXIT›;› STA RUNADR› JSR ?GETBYT› LDY #156› BCS ?EXIT›;› STA RUNADR+1› LDA RECLEN› CMP #1› BEQ ?51142› BCC ?51145›;› CLC› LDA RUNADR› ADC LOADAD› TAY› LDA RUNADR+1› ADC LOADAD+1›;›?SETRUNADR› STY RUNADR› STA RUNADR+1›;›?51142› LDY #1›?EXIT› RTS›;›?51145› LDY #0› LDA #0› BEQ ?SETRUNADR  Always›;›?GETBYT› JMP (GBYTEA) Get byte›?RUN› JMP (RUNADR) Exec run›;›?51157› LDY LCOUNT  Handle text› CPY #1      record› BEQ ?51174› BCS ?51281› STA RELADR› STA NEWADR› BCC ?51280  Go always›;›?51174› STA RELADR+1› STA NEWADR+1› LDX #0› LDA HIBYTE› BEQ ?51193›;› CMP #$0A› BEQ ?51212›;› LDX #2›;›?51193› CLC› LDA RELADR› ADC LOADAD,X› STA NEWADR› LDA RELADR+1› ADC LOADAD+1,X› STA NEWADR+1›;›?51212› CLC› LDA NEWADR› ADC RECLEN› PHA› LDA #0› ADC NEWADR+1› TAY› PLA› SEC› SBC #2› BCS ?OVRDEY›;› DEY›;›?OVRDEY› PHA› TYA› CMP HIUSED+1,X› PLA› BCC ?51257› BNE ?51248›;› CMP HIUSED,X› BCC ?51257›;›?51248› STA HIUSED,X› PHA› TYA› STA HIUSED+1,X› PLA›;›?51257› LDX HIBYTE› CPX #1› BEQ ?51280›;› CPY MEMTOP+1› BCC ?51280› BNE ?51276›;› CMP MEMTOP› BCC ?51280›;›?51276› PLA› PLA› LDY #157›;›?51280› RTS›;›?51281› SEC         Relocate text› PHA         into memory› LDA LCOUNT› SBC #2› CLC› ADC NEWADR› STA LTEMP› LDA #0› ADC NEWADR+1› STA LTEMP+1› PLA› LDY #0› STA (LTEMP),Y› JMP ?51280  Just to a rts›;›?51309› CLC         Handle word› ADC NEWADR  reference record› STA LTEMP   type› LDA #0› ADC NEWADR+1› STA LTEMP+1› LDY #0› LDA (LTEMP),Y› CLC› ADC LOADAD› STA (LTEMP),Y› INC LTEMP› BNE ?51338›;› INC LTEMP+1›;›?51338› LDA (LTEMP),Y› ADC LOADAD+1› STA (LTEMP),Y› RTS›;›?51346› LDX #0      Handle low-byte› LDY HIBYTE  and one-byte› CPY #4      record type› BCC ?51357›;› LDX #2›;›?51357› CLC› ADC NEWADR› STA LTEMP› LDA #0› ADC NEWADR+1› STA LTEMP+1› LDY #0› LDA (LTEMP),Y› CLC› ADC LOADAD,X› STA (LTEMP),Y› RTS›;›?51381› PHA› LDA LCOUNT› ROR A› PLA› BCS ?51410›;› CLC› ADC NEWADR› STA LTEMP› LDA #0› ADC NEWADR+1› STA LTEMP+1› LDY #0› LDA (LTEMP),Y› STA HIBYTE›;›?51409› RTS›;›?51410› CLC› ADC LOADAD› LDA #0› ADC LOADAD+1› ADC HIBYTE› LDY #0› STA (LTEMP),Y› BEQ ?51409  Always to rts›;›?ADDRS› .WORD ?51157› .WORD ?51157› .WORD ?51346› .WORD ?51346› .WORD ?51346› .WORD ?51346› .WORD ?51309› .WORD ?51309› .WORD ?51381› .WORD ?51381› .WORD ?51157› .WORD ?51093›;›JSLFTST› LDA #$FF    Select and› STA COLDST  exec selftest› LDA PORTB› AND #$7F› STA PORTB› JMP SLFTSV  Following on Reset›;›GPDINI› LDA #1      Init generic› STA SHPDVS  parallel device›;›?51473› LDA SHPDVS  handler.› STA ?PDSELECT Select device› LDA ?PDID1  Check id bytes› CMP #$80    skip if wrong› BNE ?51496›;› LDA ?PDID2› CMP #$91› BNE ?51496›;› JSR ?INITPD Initialize it›;›?51496› ASL SHPDVS  Next device› BNE ?51473  Do all 8 possible›;› LDA #0› STA ?PDSELECT Deselect pd› RTS›;›SIOUTL› LDA #1      Siov points here›  ASTA  CRITIC and tries pd› LDA DUNIT   before serial› PHA› LDA PDVMSK  See if any PD› BEQ ?NOTPD  No› LDX #8›;›?TRYPD› JSR ?SELECT Got device?› BEQ ?NOTPD  No go to serial io›;› TXA         Save device› PHA› JSR ?PDIOV  Try the io› PLA         Recover device› TAX› BCC ?TRYPD  Error, retry›;› LDA #0› STA SHPDVS› STA ?PDSELECT› BEQ ?SIOEND Always›;›?NOTPD› JSR SIOMAIN No pd›;›?SIOEND› PLA         Exit all sio› STA DUNIT› LDA #0›  ASTA  CRITIC› STY DSTATS› LDY DSTATS› RTS›;›PDEVID› LDX #8      Device id›;›?51568› ROR A       routine› BCS ?51574  set into vpirq›;› DEX         on reset/boot› BNE ?51568›;›?51574› LDA SHPDVS› PHA› LDA ?51745-1,X› STA SHPDVS› STA ?PDSELECT› JSR ?PDINTV› PLA› STA SHPDVS› STA ?PDSELECT› PLA› TAX› PLA› RTI›;›OPEN.PD› LDY #1      Parallel device› JMP ?51676  vectors›;›CLOSE.PD› LDY #3› JMP ?51676›;›GET.PD› LDY #5› JMP ?51676›;›PUT.PD› LDY #7› JMP ?51676›;›STATUS.PD› LDY #9› JMP ?51676›;›SPECL.PD› LDY #11› JMP ?51676›;›?SELECT› DEX         Select next› BPL ?51643  parallel device›;› LDA #0› STA SHPDVS› STA ?PDSELECT› RTS›;›?51643› LDA PDVMSK› AND ?51745,X› BEQ ?SELECT› STA SHPDVS› STA ?PDSELECT› RTS›;›?51658› LDA ?PDDEVTB,Y Invoke› PHA         parallel device› DEY         handler› LDA ?PDDEVTB,Y› PHA› LDA PPTMPA› LDX PPTMPX› LDY #146› RTS›;›?51676› STA PPTMPA› STX PPTMPX›  ALDA  CRITIC› PHA› LDA #1›  ASTA  CRITIC› LDX #8›;›?51693› JSR ?SELECT› BEQ ?51715›;› TXA› PHA› TYA› PHA› JSR ?51658› BCC ?51739›;› STA PPTMPA› PLA› PLA› JMP ?51717›;›?51715› LDY #130›;›?51717› LDA #0› STA SHPDVS› STA ?PDSELECT› PLA›  ASTA  CRITIC› LDA PPTMPA› STY PPTMPX› LDY PPTMPX› RTS›;›?51739› PLA› TAY› PLA› TAX› BCC ?51693›;›?51745› .BYTE $80,$40,$20,$10› .BYTE $08,$04,$02,$01›;›INITPD› ALDX  ICAX5Z Load and› LDA ICAX4,X init peripheral› JSR PHDLOD  handler› BCS ?51796›;› CLC› JSR L59550› BCS ?51796›;›  ALDX  ICAX5Z› LDA ICAX3,X› JSR ERR130B› BCS ?51796›;›  ALDX  ICAX5Z› STA ICHID,X› STA ICHIDZ› LDA #3› STA ICCOMT› JMP IOC7›;›?51796› JMP ERR130›;›