         nam   CC3Disk
         ttl   os9 device driver    

* Disassembled 98/08/23 20:52:25 by Disasm v1.6 (C) 1988 by RML

         ifp1
         use   defsfile
         endc
tylg     set   Drivr+Objct   
atrv     set   ReEnt+rev
rev      set   $01
         mod   eom,name,tylg,atrv,start,size
u0000    rmb   1
u0001    rmb   3
u0004    rmb   4
u0008    rmb   7
u000F    rmb   35
u0032    rmb   29
u004F    rmb   1
u0050    rmb   58
u008A    rmb   29
u00A7    rmb   2
u00A9    rmb   1
u00AA    rmb   1
u00AB    rmb   2
u00AD    rmb   1
u00AE    rmb   1
u00AF    rmb   2
u00B1    rmb   4
u00B5    rmb   1
size     equ   .
         fcb   $FF 
name     equ   *
         fcs   /CC3Disk/
         fcb   $09 
start    equ   *
         lbra  L002B
         lbra  L00A2
         lbra  L014B
         lbra  L007B
         lbra  L0349
         lbra  L007D
L0028    fcb   $00,$01,$0a
L002B    clra
         sta   <u0032
         ldx   u0001,u
         leax  $08,x
         lda   #$D0
         sta   ,x
         lbsr  L033F
         lda   ,x
         lda   #$FF
         ldb   #$04
         leax  u000F,u
L0041    sta   ,x
         sta   <$15,x
         leax  <$26,x
         decb  
         bne   L0041
         leax  >L019E,pcr
         stx   <$00FC
         pshs  y
         leay  >u00B5,u
         tfr   y,d
         leay  >L0436,pcr
         leax  >L0028,pcr
         os9   F$IRQ    
         puls  y
         bcs   L007C
         ldd   #$0100
         pshs  u
         os9   F$SRqMem 
         tfr   u,x
         puls  u
         bcs   L007C
         stx   >u00AB,u
L007B    clrb  
L007C    rts   
L007D    leay  >u00B1,u
         ldx   #$0000
         os9   F$VIRQ   
         ldx   #$0000
         os9   F$IRQ    
         pshs  u
         ldu   >u00AB,u
         ldd   #$0100
         os9   F$SRtMem 
         puls  u
         clra  
         sta   >$FF40
         sta   <u0032
L00A1    rts   
L00A2    lda   #$91
         cmpx  #$0000
         bne   L00F4
         bsr   L00F4
         bcs   L00A1
         ldx   $08,y
         pshs  y,x
         ldy   >u00A7,u
         ldb   #$14
L00B8    lda   b,x
         sta   b,y
         decb  
         bpl   L00B8
         lda   <$10,y
         ldy   $02,s
         ldb   <$24,y
         bita  #$02
         beq   L00D0
         bitb  #$01
         beq   L00E6
L00D0    bita  #$04
         beq   L00D8
         bitb  #$02
         beq   L00E6
L00D8    bita  #$01
         beq   L00E3
         lda   <$27,y
         suba  #$02
         bcs   L00E6
L00E3    clrb  
         puls  pc,y,x
L00E6    comb  
         ldb   #$F9
         puls  pc,y,x
L00EB    bcc   L00F4
         pshs  x,b,a
         lbsr  L03C4
         puls  x,b,a
L00F4    pshs  x,b,a
         bsr   L00FF
         puls  x,b,a
         bcc   L00A1
         lsra  
         bne   L00EB
L00FF    lbsr  L01ED
         bcs   L00A1
         ldx   $08,y
         pshs  y,cc
         ldb   #$80
         bsr   L012D
L010C    bita  >$FF48
         bne   L0123
         leay  -$01,y
         bne   L010C
         lda   >u00A9,u
         ora   #$08
         sta   >$FF40
         puls  y,cc
         lbra  L031A
L0123    lda   >$FF4B
         sta   ,x+
         stb   >$FF40
         bra   L0123
L012D    orcc  #$50
         stb   >$FF48
         ldy   #$FFFF
         ldb   #$28
         orb   >u00A9,u
         stb   >$FF40
         ldb   #$A8
         orb   >u00A9,u
         lbsr  L033F
         lda   #$02
         rts   
L014B    lda   #$91
L014D    pshs  x,b,a
         bsr   L0170
         puls  x,b,a
         bcs   L0160
         tst   <$28,y
         bne   L015E
         bsr   L01AE
         bcs   L0160
L015E    clrb  
L015F    rts   
L0160    lsra  
         lbeq  L02E9
         bcc   L014D
         pshs  x,b,a
         lbsr  L03C4
         puls  x,b,a
         bra   L014D
L0170    lbsr  L01ED
         bcs   L015F
         ldx   $08,y
         ldb   #$A0
L0179    pshs  y,cc
         bsr   L012D
L017D    bita  >$FF48
         bne   L0194
         leay  -$01,y
         bne   L017D
         lda   >u00A9,u
         ora   #$08
         sta   >$FF40
         puls  y,cc
         lbra  L02E9
L0194    lda   ,x+
         sta   >$FF4B
         stb   >$FF40
         bra   L0194
L019E    leas  $0C,s
         puls  y,cc
         ldb   >$FF48
         bitb  #$04
         lbne  L031A
         lbra  L02EC
L01AE    pshs  x,b,a
         ldx   $08,y
         pshs  x
         ldx   >u00AB,u
         stx   $08,y
         ldx   $04,s
         lbsr  L00FF
         puls  x
         stx   $08,y
         bcs   L01E4
         lda   #$20
         pshs  u,y,a
         ldy   >u00AB,u
         tfr   x,u
L01D0    ldx   ,u
         cmpx  ,y
         bne   L01E0
         leau  u0008,u
         leay  $08,y
         dec   ,s
         bne   L01D0
         bra   L01E2
L01E0    orcc  #$01
L01E2    puls  u,y,a
L01E4    puls  pc,x,b,a
L01E6    pshs  a
         ldb   <$15,x
         bra   L0223
L01ED    lbsr  L02B0
         lbsr  L0265
         pshs  a
         lda   >u00AD,u
         beq   L0205
         lda   >u00A9,u
         ora   #$40
         sta   >u00A9,u
L0205    incb  
         stb   >$FF4A
         ldx   >u00A7,u
         ldb   <$15,x
         lda   <$10,x
         lsra  
         eora  <$24,y
         anda  #$02
         pshs  a
         lda   $01,s
         tst   ,s+
         beq   L0223
         lsla  
         lslb  
L0223    stb   >$FF49
         ldb   #$15
         pshs  b
         ldb   <$24,y
         andb  #$02
         beq   L0233
         lsl   ,s
L0233    cmpa  ,s+
         bra   L0241
         ldb   >u00A9,u
         orb   #$10
         stb   >u00A9,u
L0241    ldb   >u00AA,u
         bne   L024E
         ldb   ,s
         cmpb  <$15,x
         beq   L025B
L024E    sta   >$FF4B
         ldb   <$22,y
         andb  #$03
         eorb  #$1B
         lbsr  L031E
L025B    puls  a
         sta   <$15,x
         sta   >$FF49
         clrb  
         rts   
L0265    tstb  
         bne   L0279
         tfr   x,d
         cmpd  #$0000
         beq   L02AB
         ldx   >u00A7,u
         cmpd  $01,x
         bcs   L027D
L0279    comb  
         ldb   #$F1
         rts   
L027D    stb   >u00AE,u
         clr   ,-s
         ldb   <$10,x
         lsrb  
         ldb   >u00AE,u
         bcc   L02A1
         bra   L0297
L028F    com   >u00AD,u
         bne   L0297
         inc   ,s
L0297    subb  $03,x
         sbca  #$00
         bcc   L028F
         bra   L02A7
L029F    inc   ,s
L02A1    subb  $03,x
         sbca  #$00
         bcc   L029F
L02A7    addb  $03,x
         puls  a
L02AB    rts   
L02AC    fcb   $01,$02,$04,$40
L02B0    clr   >u00AA,u
L02B4    lda   <$21,y
         cmpa  #$04
         bcs   L02BF
         comb  
         ldb   #$F0
         rts   
L02BF    pshs  x,b,a
         leax  >L02AC,pcr
         ldb   a,x
         stb   >u00A9,u
         leax  u000F,u
         ldb   #$26
         mul   
         leax  d,x
         cmpx  >u00A7,u
         beq   L02E0
         stx   >u00A7,u
         com   >u00AA,u
L02E0    clr   >u00AD,u
         lbsr  L03EC
         puls  pc,x,b,a
L02E9    ldb   >$FF48
L02EC    bitb  #$F8
         beq   L0304
         bitb  #$80
         bne   L0306
         bitb  #$40
         bne   L030A
         bitb  #$20
         bne   L030E
         bitb  #$10
         bne   L0312
         bitb  #$08
         bne   L0316
L0304    clrb  
         rts   
L0306    comb  
         ldb   #$F6
         rts   
L030A    comb  
         ldb   #$F2
         rts   
L030E    comb  
         ldb   #$F5
         rts   
L0312    comb  
         ldb   #$F7
         rts   
L0316    comb  
         ldb   #$F3
         rts   
L031A    comb  
         ldb   #$F4
         rts   
L031E    bsr   L033D
L0320    ldb   >$FF48
         bitb  #$01
         beq   L0348
         ldd   #$00F0
         std   >u00B1,u
         bra   L0320
L0330    lda   #$08
         ora   >u00A9,u
         sta   >$FF40
         stb   >$FF48
         rts   
L033D    bsr   L0330
L033F    lbsr  L0342
L0342    lbsr  L0345
L0345    lbsr  L0348
L0348    rts   
L0349    ldx   $06,y
         ldb   $02,x
         cmpb  #$04
         beq   L035B
         cmpb  #$03
         lbeq  L03C4
         comb  
         ldb   #$D0
         rts   
L035B    pshs  u,y
         ldd   #$1A00
         os9   F$SRqMem 
         bcs   L03C2
         ldx   $02,s
         stu   >$00AF,x
         ldx   <u0050
         lda   $06,x
         ldb   <$00D0
         ldy   ,s
         ldx   $06,y
         ldx   $04,x
         ldy   #$1A00
         os9   F$Move   
         bcs   L03B2
         puls  u,y
         pshs  u,y
         lbsr  L02B0
         ldx   $06,y
         ldb   $07,x
         bitb  #$01
         beq   L039E
         com   >u00AD,u
         ldb   >u00A9,u
         orb   #$40
         stb   >u00A9,u
L039E    lda   $09,x
         ldx   >u00A7,u
         lbsr  L01E6
         bcs   L03C2
         ldb   #$F0
         ldx   >u00AF,u
         lbsr  L0179
L03B2    ldu   $02,s
         pshs  b,cc
         ldu   >u00AF,u
         ldd   #$1A00
         os9   F$SRtMem 
         puls  b,cc
L03C2    puls  pc,u,y
L03C4    lbsr  L02B4
         ldx   >u00A7,u
         clr   <$15,x
         lda   #$05
L03D0    ldb   <$22,y
         andb  #$03
         eorb  #$4B
         pshs  a
         lbsr  L031E
         puls  a
         deca  
         bne   L03D0
         ldb   <$22,y
         andb  #$03
         eorb  #$0B
         lbsr  L031E
         rts   
L03EC    pshs  y,x,b,a
         ldd   #$00F0
         std   >u00B1,u
         lda   >u00A9,u
         ora   #$08
         sta   >$FF40
         lda   <u0032
         bmi   L0416
         bne   L0418
         ldx   #$A000
L0407    nop   
         nop   
         lbrn  L0416
         lbrn  L0416
         nop   
         leax  -$01,x
         bne   L0407
L0416    bsr   L041B
L0418    clrb  
         puls  pc,y,x,b,a
L041B    lda   #$01
         sta   <u0032
         ldx   #$0001
         leay  >u00B1,u
         clr   $04,y
         ldd   #$00F0
         os9   F$VIRQ   
         bcc   L0434
         lda   #$80
         sta   <u0032
L0434    clra  
         rts   
L0436    pshs  a
         lda   <u008A
         beq   L0440
         bsr   L041B
         bra   L044F
L0440    sta   >$FF40
         lda   >u00B5,u
         anda  #$FE
         sta   >u00B5,u
         clr   <u0032
L044F    puls  pc,a
         emod
eom      equ   *
