home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_26_1988_Transactor_Publishing.d64 / driversetup.src < prev    next >
Text File  |  2023-02-26  |  5KB  |  231 lines

  1. .opt nos
  2. ;put"@0:driversetup.src
  3. ;* * * * * * * * * * * * * * * * *
  4. ;*                               *
  5. ;* c-128 centronics printer...   *
  6. ;* driver setup module           *
  7. ;*                               *
  8. ;* written  1-08-87  w.j. brier  *
  9. ;*                               *
  10. ;* revised                       *
  11. ;*                               *
  12. ;* copyright (c) 1987            *
  13. ;*                               *
  14. ;* sys 5632,dn,lf    to enable   *
  15. ;* sys 5632,0        to disable  *
  16. ;*                               *
  17. ;* see the documentation for...  *
  18. ;* instructions on using this... *
  19. ;* utility with your software.   *
  20. ;*                               *
  21. ;* * * * * * * * * * * * * * * * *
  22.               ;
  23.               ;
  24.               ;
  25. ;* * * * * * * * * * * * * * * * *
  26. ;*                               *
  27. ;*  <<< program assignments >>>  *
  28. ;*                               *
  29. ;* * * * * * * * * * * * * * * * *
  30.               ;
  31.               ;
  32.               ;
  33. ;system vectors & pointers...
  34.               ;
  35. ierror =$0300 ;basic error vector
  36.               ;
  37. iopen  =$031a ;kernal open vector
  38. iclose =$031c ;kernal close vector
  39. ickout =$0320 ;kernal ckout vector
  40. iclrch =$0322 ;kernal clrchn vector
  41. ibsout =$0326 ;kernal chrout vector
  42.               ;
  43. mmu    =$ff00 ;configuration
  44.               ;
  45.               ;
  46. ;printer driver jump table...
  47.               ;
  48. open   =$1a00 ;kernal open patch
  49. close  =$1a03 ;kernal close patch
  50. ckout  =$1a06 ;kernal chkout patch
  51. clrch  =$1a09 ;kernal clrchn patch
  52. bsout  =$1a0c ;kernal chrout patch
  53. setprt =$1a0f ;port setup
  54.               ;
  55.               ;
  56. ;printer driver control flags...
  57.               ;
  58. pdev   =$1a1e ;port device number
  59. lfflg  =$1a1f ;linefeed flag
  60.               ;
  61.               ;
  62. ;alternate indirect vector storage...
  63.               ;
  64. opena  =$1a12 ;open exit
  65. closea =$1a14 ;close exit
  66. ckouta =$1a16 ;chkout exit
  67. clrcha =$1a18 ;clrchn exit
  68. bsouta =$1a1a ;chrout exit
  69.               ;
  70. resrvd =$1a1c ;reserved
  71.               ;
  72.       *=$1600 ;5632
  73.               ;
  74.               ;
  75. ;=================================
  76.        ;
  77. ;driver enable/disable
  78.        ;
  79.        stx lfflg ;save linefeed flag
  80.        ;
  81.        ldx #0
  82.        ldy mmu ;get configuration
  83.        stx mmu ;enable roms
  84.        ;
  85.        tax
  86.        bne endr ;enable driver
  87.        ;
  88.        jmp dadr ;disable driver
  89.        ;
  90. ;---------------------------------
  91.        ;
  92. ;enable driver
  93.        ;
  94. endr   cpx #4 ;check device number
  95.        bcs endr02
  96.        ;
  97. endr01 ldx #9 ;illegal device
  98.        jmp (ierror) ;abort
  99.        ;
  100. endr02 cpx #8
  101.        bcs endr01 ;out of range
  102.        ;
  103.        tya
  104.        pha ;save configuration
  105.        stx pdev ;set device number
  106.        ;
  107.        clc
  108.        lda lfflg
  109.        and #1 ;mask garbage
  110.        ror a ;rotate twice
  111.        ror a
  112.        sta lfflg ;set up flag
  113.        ;
  114.        ;
  115. ;set up new vectors...
  116.        ;
  117.        ldx iopen ;open vector
  118.        ldy iopen+1
  119.        cpx #<open
  120.        bne endr03
  121.        ;
  122.        cpy #>open
  123.        bne endr03
  124.        ;
  125.        jmp endr04 ;skip setup
  126.        ;
  127. endr03 stx opena
  128.        sty opena+1
  129.        ;
  130.        ldx #<open ;new vector
  131.        ldy #>open
  132.        stx iopen
  133.        sty iopen+1
  134.        ;
  135.        ldx iclose ;close vector
  136.        ldy iclose+1
  137.        stx closea
  138.        sty closea+1
  139.        ;
  140.        ldx #<close ;new vector
  141.        ldy #>close
  142.        stx iclose
  143.        sty iclose+1
  144.        ;
  145.        ldx ickout ;ckout vector
  146.        ldy ickout+1
  147.        stx ckouta
  148.        sty ckouta+1
  149.        ;
  150.        ldx #<ckout ;new vector
  151.        ldy #>ckout
  152.        stx ickout
  153.        sty ickout+1
  154.        ;
  155.        ldx iclrch ;clrchn vector
  156.        ldy iclrch+1
  157.        stx clrcha
  158.        sty clrcha+1
  159.        ;
  160.        ldx #<clrch ;new vector
  161.        ldy #>clrch
  162.        stx iclrch
  163.        sty iclrch+1
  164.        ;
  165.        ldx ibsout ;chrout vector
  166.        ldy ibsout+1
  167.        stx bsouta
  168.        sty bsouta+1
  169.        ;
  170.        ldx #<bsout ;new vector
  171.        ldy #>bsout
  172.        stx ibsout
  173.        sty ibsout+1
  174.        ;
  175.        jsr setprt ;set up user port
  176.        ;
  177. endr04 pla ;old configuration
  178.        sta mmu
  179.        ;
  180.        rts
  181.        ;
  182. ;---------------------------------
  183.        ;
  184. ;disable driver
  185.        ;
  186. dadr   tya
  187.        pha ;save old configuration
  188.        ;
  189.        ;
  190. ;check for enabled driver...
  191.        ;
  192.        ldx iopen ;open vector
  193.        ldy iopen+1
  194.        cpx #<open
  195.        bne endr04 ;not enabled
  196.        ;
  197.        cpy #>open
  198.        bne endr04
  199.        ;
  200.        ;
  201. ;restore vectors...
  202.        ;
  203.        ldx opena ;old open
  204.        ldy opena+1
  205.        stx iopen
  206.        sty iopen+1
  207.        ;
  208.        ldx closea ;old close
  209.        ldy closea+1
  210.        stx iclose
  211.        sty iclose+1
  212.        ;
  213.        ldx clrcha ;old clrchn
  214.        ldy clrcha+1
  215.        stx iclrch
  216.        sty iclrch+1
  217.        ;
  218.        ldx ckouta ;old ckout
  219.        ldy ckouta+1
  220.        stx ickout
  221.        sty ickout+1
  222.        ;
  223.        ldx bsouta ;old bsout
  224.        ldy bsouta+1
  225.        stx ibsout
  226.        sty ibsout+1
  227.        jmp endr04
  228.        ;
  229. ;=================================
  230. .end
  231.