home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !FALCON / RG / RES_RIPR.ZIP / RES_RIPR / RIPPER3.S < prev    next >
Encoding:
Text File  |  2005-04-30  |  63.6 KB  |  3,056 lines

  1. **************************
  2. **** RESERVOIR RIPPER ****
  3. **** Coded by Mr Pink ****
  4. * (C)1995 RESERVOIR GODS *
  5. **************************
  6.  
  7.  
  8. ; # = $2b (scan code)
  9.  
  10. DEBUG    equ    0
  11.  
  12. BSS_DEBUG    equ    0
  13. new_bss_ikbd    equ    0
  14.  
  15. vars_y    equ    90
  16. regs_y    equ    40
  17. vecs_y    equ    6*7
  18.  
  19. timer_a_ex    equ    0
  20. timer_b_ex    equ    1
  21. timer_c_ex    equ    2
  22. timer_d_ex    equ    3
  23. vbl_ex        equ    4
  24. vbl_q_ex    equ    5
  25. trap_1_ex    equ    6
  26. trap_2_ex    equ    7
  27. trap_13_ex    equ    8
  28. trap_14_ex    equ    9
  29. ikbd_ex        equ    10
  30. blitter_ex    equ    11
  31. line_a_ex    equ    12
  32. line_f_ex    equ    13
  33. hbl_ex        equ    14
  34. error_ex    equ    15
  35. rs232_ex    equ    16
  36. mono_ex        equ    17
  37. mmu_ex        equ    18
  38. trace_ex    equ    19
  39. alt_help_ex    equ    20
  40. fdi_ex        equ    21
  41. reset_ex    equ    22
  42. vbr_ex        equ    23
  43.  
  44. * .RIP FORMAT:
  45. * 0 LONG: "GRIP"
  46. * 4 WORD: Version Number
  47. * 6 WORD: Res
  48. * 8 WORD: X Pixels
  49. *10 WORD: Y Pixels
  50. *12 WORD: Line length (bytes)
  51. *14 WORD: Pal type
  52.  
  53.     IFNE    BSS_DEBUG
  54.     INCLUDE    "j:\asm\bssdebug\examples\devpac\macros.sh"
  55.     ENDC
  56.  
  57. start_ripper
  58.     move.l  a7,a5
  59.         move.l  4(a5),a5
  60.     lea    $80(a5),a0
  61.     move.l    a0,cmd_adr
  62.         move.l  12(a5),d0
  63.         add.l   20(a5),d0
  64.         add.l   28(a5),d0
  65.         add.l   #$100,d0
  66.         move.l  d0,-(sp)
  67.         move.l  a5,-(sp)
  68.         move    d0,-(sp)
  69.         move    #$4a,-(sp)
  70.         trap    #1
  71.         add.l   #12,sp
  72.  
  73.     clr.w    -(a7)
  74.     pea    $200000
  75.     trap    #1
  76.  
  77.     IFNE    BSS_DEBUG
  78.     SetBreak    <"save_pic_lines">,BREAKSimple,0,<"">
  79.     SetBreak    <"save_true">,BREAKSimple,0,<"">
  80.     SetWatch    <"pic_x">,WATCHWord
  81.     SetWatch    <"pic_y">,WATCHWord
  82.     SetWatch    <"pic_res">,WATCHWord
  83.     SetWatch    <"cur_pic_adr">,WATCHLong
  84.     SetWatch    <"line_length">,WATCHLong
  85.     ENDC
  86.  
  87.     move.w    #$59,-(a7)    ;get monitor
  88.     trap    #14
  89.     addq.l    #2,a7
  90.     cmp.w    #2,d0
  91.     bne.s    not_vga
  92.     st.b    vga_flag
  93. not_vga
  94.     IFEQ    DEBUG
  95.     bsr    save_system
  96.     ENDC
  97.  
  98.     move.l    #start_ripper,$30.w
  99.     move.l    #end_ripper,$432.w
  100.  
  101.     dc.w    $a00a
  102.  
  103.     lea    intro_txt(pc),a0
  104.     bsr    gemdos_print
  105.     bsr    wait_key
  106.  
  107.     bsr    do_first_menu
  108.     beq.s    do_tsr
  109. term
  110.  
  111.     clr.w    -(a7)
  112.     trap    #1
  113. do_tsr
  114.  
  115. install_vbr
  116. ;    lea    my_vector_table,a0
  117. ;    movec    a0,VBR
  118.  
  119.     btst    #2,(install_bits+vbr_ex)
  120.     beq.s    .non_lucky
  121.     move.l    #'XGRB',my_vector_table_name
  122. .non_lucky
  123.     clr.b    check_bit
  124.     bsr    do_installation
  125.     move.b    #1,check_bit
  126.  
  127.     move.l    #test_reset,my_vector_table+4
  128.  
  129.     IFNE    DEBUG
  130.     bra    init_ripper
  131.     ENDC
  132.  
  133.     bsr    get_drive_dir
  134.     move.l    cmd_adr,a2
  135.     move.b    (a2)+,d0
  136.     subq.w    #1,d0
  137.     bmi.s    no_command
  138.  
  139. .cpy    move.b    (a2)+,(a0)+
  140.     dbra    d0,.cpy
  141.  
  142.     pea    null(pc)
  143.     pea    null(pc)
  144.     pea    ddir
  145.     pea    $4b0000
  146.     trap    #1
  147.     lea    16(a7),a7
  148.  
  149. no_command
  150.     move.w    #0,-(a7)
  151.     move.l    #end_ripper-start_ripper+$100,-(a7)
  152.     move.w    #$31,-(a7)
  153.     trap    #1
  154.  
  155.     rts
  156.  
  157. null    dc.l    0
  158.  
  159. test_reset:
  160.     move.l    #-1,$ffff9800.w
  161.     move.w    #-1,$ffff8240.w
  162.     bra.s    test_reset
  163.  
  164. get_drive_dir
  165.     move.w  #$19,-(sp)      ; Get current drive 
  166.     trap    #1              
  167.         addq.l  #2,sp
  168.         move.w    d0,d1
  169.         add.b   #65,d0          ; alter from number to letter  
  170.         move.b  d0,ddir        ; store
  171.  
  172.     clr.b    ddir+2
  173.  
  174.     addq.w    #1,d1
  175.     move.w    d1,-(a7)
  176.     pea    ddir+2
  177.     move.w    #$47,-(a7)
  178.     trap    #1
  179.     addq.l    #8,a7
  180.  
  181.     lea    ddir,a0
  182. .notend    tst.b    (a0)+
  183.     bne.s    .notend
  184.     move.b    #'\',-1(a0)
  185.     clr.b    (a0)
  186.     rts
  187.  
  188.  
  189. do_first_menu:
  190.     bsr    save_screen_info
  191.     bsr    save_pal
  192.     bsr    wait_vbl
  193.     bsr    init_screen
  194.     bsr    init_ikbd
  195.     bsr    do_vector_install_menu
  196.     move.w    d0,-(a7)
  197.     bsr    restore_ikbd    
  198.     bsr    restore_screen_info
  199.     bsr    restore_pal
  200.     tst.w    (a7)+
  201.     rts
  202.  
  203.  
  204. gemdos_print:    pea    (a0)
  205.         move.w    #9,-(a7)
  206.         trap    #1
  207.         addq.w    #6,a7
  208.         rts
  209.  
  210. wait_key:    move.w    #$b,-(a7)    ;interogate keyboard
  211.         trap    #1
  212.         addq.l    #2,a7
  213.         tst    d0        ;is there junk in key buffer?
  214.         beq.s    cnecin        ;no, just wait for key
  215.         bsr.s    cnecin        ;clear key buffer
  216.         bra.s    wait_key    ;check buffer status
  217. cnecin:        move.w    #8,-(a7)    ;get key
  218.         trap    #1
  219.         addq.l    #2,a7        ;returned in D0
  220.         rts
  221.  
  222.  
  223. init_ripper:
  224.     move.l    a7,old_stack+2
  225.     lea    rip_stack,a7
  226.     move.w    sr,-(a7)
  227.     move.w    #$2700,sr
  228.     clr.b    begin_ripping_flag
  229.     clr.b    new_config
  230.     bsr    save_screen_info
  231.     lea    cur_system_vars,a0
  232.     bsr    save_cur_system
  233.     bsr    get_current_vecs
  234.     IFEQ    DEBUG
  235.     bsr    restore_system
  236.     ENDC
  237.     move.l    mfp_sei,d0
  238.     beq.s    .non_mfp
  239.     move.w    d0,a0
  240.     swap    d0
  241.     bclr.b    d0,(a0)
  242. .non_mfp
  243.     clr.b    $fffffa07.w        ;iera
  244.     clr.b    $fffffa13.w        ;imra
  245.     move.b    #%01000000,$fffffa09.w    ;ierb
  246.     move.b    #%01000000,$fffffa15.w    ;imrb
  247.     move.l    #temp_vbl,$70.w
  248.     move.w    #$2300,sr
  249.     bsr    save_pal
  250.     bsr    wait_vbl
  251.     bsr    init_screen
  252.     bsr    init_ikbd
  253.     bsr    get_pic_info
  254.     bsr    print_ripper_menu_txt    
  255.     cmp.b    #reset_ex,vec_family
  256.     beq    do_vec_menu
  257.     move.b    #3,$fffffc00.w
  258.     move.b    #$96,$fffffc00.w
  259. do_ripper_menu:
  260.     tst.b    key_table+$3b
  261.     bne    show_screen
  262.     tst.b    key_table+$3c
  263.     bne    do_vec_menu
  264.     tst.b    key_table+$3d
  265.     bne    do_save_file
  266.     tst.b    key_table+$3e
  267.     bne    do_save_god_file
  268.     tst.b    key_table+$44
  269.     beq.s    do_ripper_menu
  270.     bsr    restore_ikbd
  271.     bsr    wait_vbl
  272.     bsr    restore_screen_info    
  273.     bsr    restore_pal
  274.     move.w    #$2700,sr
  275.     lea    cur_system_vars,a0
  276.     bsr    restore_cur_system
  277.     tst.b    new_config
  278.     beq.s    .no_new
  279.     clr.b    check_bit
  280.     bsr    do_installation
  281.     move.b    #1,check_bit
  282. .no_new
  283.     move.w    (a7)+,sr
  284. old_stack
  285.     lea    $12345678,a7
  286.     rts
  287.  
  288. print_ripper_menu_txt:
  289.  
  290.     lea    ripper_txt,a0
  291.     move.l    #320-16*3,d0
  292.     moveq    #0,d1
  293.     bsr    print_string
  294.  
  295.     lea    coder_txt,a0
  296.     move.l    #320-16*3,d0
  297.     moveq    #20,d1
  298.     bsr    print_string
  299.  
  300.     lea    rg_txt,a0
  301.     move.l    #320-23*3,d0
  302.     moveq    #30,d1
  303.     bsr    print_string
  304.  
  305.     lea    menu_txt,a0
  306.     moveq    #0,d0
  307.     moveq    #40,d1
  308.     bsr    print_string
  309.  
  310.     lea    entry_txt,a0
  311.     move.l    #320,d0
  312.     moveq    #40,d1
  313.     bsr    print_string
  314.  
  315.     moveq    #0,d0
  316.     move.b    vec_family,d0
  317.     move.l    (v_txt_adrs,d0.w*4),a0
  318.     move.l    #320+6*15,d0
  319.     moveq    #40,d1
  320.     bsr    print_string
  321.  
  322.     lea    variables_txt,a0
  323.     moveq    #0,d0
  324.     move.l    #vars_y,d1
  325.     bsr    print_string
  326.  
  327.     move.w    pic_res,d0
  328.     move.l    (res_txts,d0.w*4),a0
  329.     moveq    #6*6,d0
  330.     move.l    #vars_y,d1
  331.     bsr    print_string
  332.  
  333.  
  334.     lea    st_txt,a0
  335.     tst.w    pic_pal
  336.     beq.s    .stpal
  337.     lea    falcon_txt,a0
  338. .stpal    move.l    #45*6,d0
  339.     move.l    #vars_y,d1
  340.     bsr    print_string
  341.  
  342.     lea    word_txts,a6
  343. .loop1    move.l    (a6)+,a0
  344.     cmpa.l    #0,a0
  345.     beq.    .el1
  346.     moveq    #0,d0
  347.     move.w    (a0),d0
  348.     bsr    conv_long_ascii
  349.     lea    long_string+6,a0
  350.     moveq    #0,d0
  351.     move.w    (a6)+,d0
  352.     move.w    (a6)+,d1
  353.     mulu    #6,d1
  354.     add.l    #vars_y,d1
  355.     pea    (a6)
  356.     bsr    print_string
  357.     move.l    (a7)+,a6
  358.     bra.s    .loop1    
  359.  
  360. .el1    lea    byte_txts,a6
  361. .loop2    move.l    (a6)+,a0
  362.     cmpa.l    #0,a0
  363.     beq.    .el2
  364.     moveq    #0,d0
  365.     move.b    (a0),d0
  366.     bsr    conv_long_ascii
  367.     lea    long_string+6,a0
  368.     moveq    #0,d0
  369.     move.w    (a6)+,d0
  370.     move.w    (a6)+,d1
  371.     mulu    #6,d1
  372.     add.l    #vars_y,d1
  373.     pea    (a6)
  374.     bsr    print_string
  375.     move.l    (a7)+,a6
  376.     bra.s    .loop2
  377.  
  378. .el2    lea    screen_vars+4,a6
  379.     moveq    #7,d7
  380.     moveq    #6*5,d6
  381. .loop3    moveq    #0,d0
  382.     move.w    (a6)+,d0
  383.     bsr    conv_long_ascii
  384.     lea    long_string+6,a0
  385.     move.l    d6,d0
  386.     move.l    #vars_y+6*2,d1
  387.     movem.l    d6-7/a6,-(a7)
  388.     bsr    print_string
  389.     movem.l    (a7)+,d6-7/a6
  390.     add.l    #6*10,d6
  391.     dbra    d7,.loop3
  392.  
  393.     moveq    #5,d7
  394.     moveq    #6*5,d6
  395. .loop4    moveq    #0,d0
  396.     move.w    (a6)+,d0
  397.     bsr    conv_long_ascii
  398.     lea    long_string+6,a0
  399.     move.l    d6,d0
  400.     move.l    #vars_y+6*3,d1
  401.     movem.l    d6-7/a6,-(a7)
  402.     bsr    print_string
  403.     movem.l    (a7)+,d6-7/a6
  404.     add.l    #6*10,d6
  405.     dbra    d7,.loop4
  406.  
  407.     moveq    #0,d0
  408.     move.w    screen_vars+34,d0        
  409.     bsr    conv_long_ascii
  410.     lea    long_string+6,a0
  411.     move.l    d6,d0
  412.     move.l    #vars_y+6*3,d1
  413.     movem.l    d6-7/a6,-(a7)
  414.     bsr    print_string
  415.     movem.l    (a7)+,d6-7/a6
  416.     add.l    #6*10,d6
  417.  
  418.     moveq    #0,d0
  419.     move.w    screen_vars+38,d0        
  420.     bsr    conv_long_ascii
  421.     lea    long_string+6,a0
  422.     move.l    d6,d0
  423.     move.l    #vars_y+6*3,d1
  424.     movem.l    d6-7/a6,-(a7)
  425.     bsr    print_string
  426.     movem.l    (a7)+,d6-7/a6
  427.     add.l    #6*10,d6
  428.  
  429.     rts
  430.  
  431.  
  432. show_screen
  433.     bsr    wait_vbl
  434.     bsr    restore_screen_info    
  435.     bsr    restore_pic_pal
  436. .wt    tst.b    key_table+$3b
  437.     bne.s    .wt
  438. show_loop
  439.     tst.b    key_table+$3c
  440.     bne.s    start_st_pal
  441.     tst.b    key_table+$3d
  442.     bne.s    start_falc_pal    
  443.     tst.b    key_table+$3b
  444.     beq.s    show_loop
  445.  
  446.     bsr    wait_vbl
  447.     bsr    set_my_screen
  448.     bsr    set_resolution
  449.     bsr    set_my_pal
  450. .wt    tst.b    key_table+$3b
  451.     bne.s    .wt    
  452.     bra    do_ripper_menu
  453.  
  454. start_st_pal:
  455.     clr.w    pic_pal
  456.     bsr    restore_pic_pal
  457.     bsr    unset_falc_pal
  458. .wt    tst.b    key_table+$3c
  459.     beq    show_loop
  460.     bra.s    .wt
  461.  
  462. start_falc_pal:
  463.     move.w    #1,pic_pal
  464.     bsr    restore_pic_pal
  465.     bsr    unset_st_pal
  466. .wt    tst.b    key_table+$3d
  467.     beq    show_loop
  468.     bra.s    .wt
  469.  
  470.  
  471. get_current_vecs:
  472.     lea    new_adrs,a0
  473.     lea    install_bits,a1
  474.     movec    VBR,a2
  475. .loop    moveq    #0,d0
  476.     move.w    (a0)+,d0
  477.     bmi.s    .last
  478.     move.w    (a0)+,d1
  479.     move.l    (a2,d1),d1
  480.     cmp.l    (a0)+,d1
  481.     beq.s    .ok
  482.     bclr    #0,(a1,d0.w)
  483.     bra.s    .loop
  484. .ok    bset    #0,(a1,d0.w)
  485.     bra.s    .loop
  486. .last
  487.     move.l    $456.w,a0
  488.     move.w    $454.w,d2
  489.     move.l    #new_vbl_lister,d0
  490. .find    move.l    (a0)+,d1
  491.     beq.s    .novbl
  492.     cmp.l    d0,d1
  493.     beq.s    .got
  494.     dbra    d2,.find
  495. .novbl    bclr    #0,vbl_q_ex(a1)
  496.     rts
  497. .got    bset    #0,vbl_q_ex(a1)
  498.     rts
  499.  
  500.  
  501. do_vec_menu:
  502.     bsr    clear_my_screen
  503.  
  504.     bsr    do_vector_install_menu
  505.     bne.s    .no_new
  506.     st.b    new_config
  507. .no_new
  508.     bsr    clear_my_screen
  509.     bsr    print_ripper_menu_txt
  510.     bra    do_ripper_menu
  511.  
  512. do_save_god_file
  513.     st.b    god_mode
  514.     bra.s    dosavefile
  515. do_save_file
  516.     clr.b    god_mode
  517. dosavefile
  518.     lea    enter_file_txt,a0
  519.     moveq    #0,d0
  520.     move.l    #160,d1
  521.     bsr    print_string
  522.     
  523. .wt1    tst.b    key_table+$3c
  524.     bne.s    .wt1
  525.  
  526.     bsr    enter_file_name
  527.     bmi    .err
  528.     IFEQ    DEBUG
  529.     bsr    restore_system
  530.     ELSE
  531.     bsr    restore_ikbd
  532.     ENDC
  533.     IFNE    new_bss_ikbd
  534.     bsr    init_ikbd
  535.     move.l    $84.w,old_bss_trap_1+2
  536.     move.l    #bss_trap_1,$84.w
  537.     move.l    $b4.w,old_bss_trap_13+2
  538.     move.l    #bss_trap_13,$b4.w
  539.     ENDC
  540.     bsr    save_file
  541. .err    bsr    clear_my_screen
  542.     bsr    print_ripper_menu_txt
  543.     bsr    init_ikbd
  544.     bra    do_ripper_menu
  545.  
  546.  
  547. get_pic_info:
  548.     move.l    #'GRIP',magic
  549.     lea    screen_vars(pc),a0
  550.     bfextu    (a0){0:24},d0
  551.     move.l    d0,pic_adr
  552.     move.l    d0,cur_pic_adr
  553.  
  554.     moveq    #0,d0
  555.     move.w    40(a0),d0        ;line length (words)
  556.     add.w    d0,d0            ;length in bytes
  557.     move.w    d0,line_length        ;save
  558.  
  559.     bsr    get_pic_res
  560.  
  561.     move.w    28(a0),d0        ;82AA - VDE
  562.     sub.w    26(a0),d0        ;82A8 - VDB
  563.     move.w    38(a0),d1        ;82C0 - VCO
  564.  
  565.     btst    #1,d1            ;interlace mode
  566.     bne.s    .nint            ;yes
  567.     lsr.w    d0
  568. .nint    btst    #0,d1            ;line doubling?
  569.     beq.s    .nol
  570.     lsr.w    d0    
  571. .nol    move.w    d0,pic_y        ;store y size
  572.     mulu    40(a0),d0        ;line_width*y lines
  573.     add.l    d0,d0            ;*2 file length in bytes
  574.     move.l    d0,pic_length
  575.     rts
  576.  
  577. get_pic_res:
  578.     move.b    44(a0),d0            ;8260
  579.     move.w    36(a0),d1            ;8266
  580.     btst    #10,d1
  581.     bne    .two_colour
  582.     btst    #8,d1
  583.     bne    .true_colour
  584.     btst    #4,d1
  585.     bne    .eight_colour
  586.     tst.b    d0
  587.     beq    .sixteen_colour
  588.     cmp.b    #1,d0
  589.     beq    .four_colour
  590. .two_colour    
  591.     clr.w    pic_res
  592.     move.w    40(a0),d0        ;8210 - line width (words)
  593.     lsl.w    #4,d0            ;*16
  594.     move.w    d0,pic_x        ;x pixels
  595.     rts
  596. .four_colour
  597.     moveq    #62,d0
  598.     tst.b    vga_flag
  599.     beq.s    .nvga
  600.     moveq    #23,d0
  601. .nvga    cmp.w    4(a0),d0        ;HHT
  602.     bne    .sixteen_colour
  603.     move.w    #1,pic_res
  604.     move.w    40(a0),d0        ;8210 - line width (words)
  605.     lsl.w    #3,d0            ;*16
  606.     move.w    d0,pic_x        ;x pixels
  607.     rts
  608. .sixteen_colour
  609.     move.w    #2,pic_res
  610.     move.w    40(a0),d0        ;8210 - line width (words)
  611.     lsl.w    #2,d0            ;*4
  612.     move.w    d0,pic_x        ;x pixels
  613.     rts
  614. .eight_colour
  615.     move.w    #3,pic_res
  616.     move.w    40(a0),d0        ;8210 - line width (words)
  617.     add.w    d0,d0            ;*2
  618.     move.w    d0,pic_x        ;x pixels
  619.     rts
  620. .true_colour
  621.     move.w    #4,pic_res
  622.     move.w    40(a0),pic_x
  623. .cont    rts
  624.  
  625.  
  626.  
  627. enter_file_name
  628.     clr.w    text_counter
  629.  
  630. .loop    clr.b    key_pressed
  631. .wk    tst.b    key_pressed
  632.     beq.s    .wk
  633.     move.b    current_key,d1
  634.     cmp.b    #$1c,d1
  635.     beq    .end_entry
  636.     cmp.b    #1,d1
  637.     beq    .quit_entry
  638.     cmp.b    #$e,d1
  639.     bne.s    .nback
  640.  
  641.     subq.w    #1,text_counter
  642.     bpl.s    .pls
  643.     clr.w    text_counter
  644. .pls    lea    single_string,a0
  645.     move.b    #' ',(a0)
  646.     move.w    text_counter,d0
  647.     mulu    #6,d0
  648.     move.l    #170,d1
  649.     bsr    print_string
  650.  
  651.     lea    file_name,a0
  652.     move.w    text_counter,d0
  653.     clr.b    (a0,d0.w)
  654.     bra    .loop
  655.  
  656. .nback    lea    single_string,a0
  657.     move.b    (scan_code_table,d1.w),d1
  658.     move.b    d1,(a0)
  659.     move.w    text_counter,d0
  660.     lea    file_name,a1
  661.     move.b    d1,(a1,d0.w)
  662.     mulu    #6,d0
  663.     move.l    #170,d1
  664.     bsr    print_string
  665.  
  666.     cmp.w    #640/6-1,text_counter
  667.     bge.s    .ge
  668.     addq.w    #1,text_counter
  669. .ge
  670.  
  671.     bra    .loop
  672.  
  673. .quit_entry
  674.     moveq    #-1,d0
  675.     rts
  676.  
  677. .end_entry
  678.     move.w    text_counter,d0
  679.     clr.b    (file_name+1,d0.w)
  680.     moveq    #0,d0
  681.     rts
  682.  
  683.  
  684. wait_vbl:
  685.     move.l    d0,-(a7)
  686.     move.l    $466.w,d0
  687. .wt    cmp.l    $466.w,d0
  688.     beq.s    .wt
  689.     move.l    (a7)+,d0
  690.     rts
  691.  
  692.  
  693.  
  694.  
  695. ************************
  696. * VECTOR SAVE ROUTINES *
  697. *************************
  698.  
  699. save_system:
  700.     lea    old_system_vars(pc),a0    
  701. save_cur_system
  702.     move.w    sr,-(a7)
  703.     move.w    #$2700,sr
  704.     movec    cacr,d0
  705.     move.w    d0,(a0)+
  706.     movec    VBR,d0
  707.     move.l    d0,(a0)+
  708.     move.l    $68.w,(a0)+            ; hbl
  709.     move.l    $70.w,(a0)+            ; vbl
  710.     move.l    $84.w,(a0)+            ; trap #1
  711.     move.l    $b4.w,(a0)+            ; trap #13
  712.     move.l    $b8.w,(a0)+            ; trap #14
  713.     move.l    $110.w,(a0)+            ; Timer D
  714.     move.l    $114.w,(a0)+            ; Timer C
  715.     move.l    $118.w,(a0)+            ; ikbd
  716.     move.l    $120.w,(a0)+            ; Timer B
  717.     move.l    $134.w,(a0)+            ; Timer A
  718.     move.l    $13c.w,(a0)+            ; mono detect
  719.     move.l    $456.w,(a0)+            ; vbl list ptr
  720.     move.l    $466.w,(a0)+            ; current vbl clock
  721.     move.l    $502.w,(a0)+            ; alt-help vector
  722.  
  723.     move.w    $ffff8900.w,(a0)+                ; Interruptions, Son DMA
  724.     move.b    $ffff8903.w,(a0)+                ; Start - High
  725.     move.b    $ffff8905.w,(a0)+                ; Start - Med
  726.     move.b    $ffff8907.w,(a0)+                ; Start - Low
  727.     move.b    $ffff890f.w,(a0)+                ; End - High
  728.     move.b    $ffff8911.w,(a0)+                ; End - Med
  729.     move.b    $ffff8913.w,(a0)+                ; End - Low
  730.     move.w    $ffff8920.w,(a0)+                ; Nb Voies, 8/16, Mono/Stereo
  731.     move.w    $ffff8930.w,(a0)+                ; Matrice : Sources
  732.     move.w    $ffff8932.w,(a0)+                ; Matrice : Destinations
  733.     move.w    $ffff8934.w,(a0)+                ; Prescales d'horloge
  734.     move.w    $ffff8936.w,(a0)+                ; Nb Voies Record,source ADDERIN
  735.     move.w    $ffff8938.w,(a0)+                ; Source ADC + Volumes entrées
  736.     move.w    $ffff893a.w,(a0)+                ; Volumes de Sortie
  737.  
  738.  
  739.     move.b    $fffffa07.w,(a0)+        ; iera
  740.     move.b    $fffffa09.w,(a0)+        ; ierb
  741.     move.b    $fffffa13.w,(a0)+        ; imra
  742.     move.b    $fffffa15.w,(a0)+        ; imrb
  743.     move.b    $fffffa17.w,(a0)+        ; vectore register
  744.     move.b    $fffffa19.w,(a0)+        ; Timer A control
  745.     move.b    $fffffa1b.w,(a0)+        ; Timer B control
  746.     move.b    $fffffa1d.w,(a0)+        ; Timer C & D control
  747.     move.b    $fffffa1f.w,(a0)+        ; Timer A data
  748.     move.b    $fffffa21.w,(a0)+        ; Timer B data
  749. ;    move.b    $fffffa23.w,(a0)+        ; Timer C data
  750.     move.b    $fffffa25.w,(a0)+        ; Timer D data
  751.     move.b    $ffff8007.w,(a0)+        ; 68030 Configuration 
  752.     move.w    (a7)+,sr
  753.     rts
  754.  
  755.  
  756. save_screen_info
  757.     lea    screen_vars(pc),a0
  758.  
  759.     move.b    $ffff8201.w,(a0)+    ; 0 Screen Adr (high)
  760.     move.b    $ffff8203.w,(a0)+    ; 1 Screen Adr (medium)
  761.     move.b    $ffff820d.w,(a0)+    ; 2 Screen Adr (low)
  762.     move.b    $ffff8265.w,(a0)+    ; 3 Horizontal Scroll
  763.  
  764.     move.w    $ffff8282.w,(a0)+    ; 4 Horizontal Hold Timer
  765.     move.w    $ffff8284.w,(a0)+    ; 6 Horizontal Border Begin
  766.     move.w    $ffff8286.w,(a0)+    ; 8 Horizontal Border End
  767.     move.w    $ffff8288.w,(a0)+    ;10 Horizontal Display Begin
  768.     move.w    $ffff828a.w,(a0)+    ;12 Horizontal display End 
  769.     move.w    $ffff828c.w,(a0)+    ;14 HSS-Synchro
  770.     move.w    $ffff828e.w,(a0)+    ;16 HFS
  771.     move.w    $ffff8290.w,(a0)+    ;18 HEE
  772.     move.w    $ffff82a2.w,(a0)+    ;20 Vertical Frequency Timer
  773.     move.w    $ffff82a4.w,(a0)+    ;22 Vertical Border Begin
  774.     move.w    $ffff82a6.w,(a0)+    ;24 Vertical Border End
  775.     move.w    $ffff82a8.w,(a0)+    ;26 Vertical Display Begin
  776.     move.w    $ffff82aa.w,(a0)+    ;28 Vertical Display End
  777.     move.w    $ffff82ac.w,(a0)+    ;30 VSS
  778.     move.w    $ffff820a.w,(a0)+    ;32 Video Sync Mode
  779.     move.w    $ffff82c0.w,(a0)+    ;34 Video Clock
  780.     move.w    $ffff8266.w,(a0)+    ;36 SPSHIFT - Falcon res
  781.     move.w    $ffff82c2.w,(a0)+    ;38 Video Control
  782.     move.w    $ffff8210.w,(a0)+    ;40 Falcon Line Width
  783.     move.w    $ffff820e.w,(a0)+    ;42 STe Line Width
  784.     move.b    $ffff8260.w,(a0)+    ;44 ST Resolution
  785.  
  786.     clr.b    (a0)            ;st flag    
  787.     move.l    a0,-(a7)
  788.     bsr    get_pic_info
  789.     move.l    (a7)+,a0
  790.  
  791.     move.w    pic_res,d0
  792.     jmp    ([st_check_rout,d0.w*4])
  793.  
  794. st_check_rout    dc.l    mono_st_check
  795.         dc.l    four_st_check
  796.         dc.l    sixteen_st_check
  797.         dc.l    non_st_check
  798.         dc.l    non_st_check
  799. mono_st_check
  800. non_st_check    
  801.     move.w    #1,pic_pal
  802.     rts
  803.  
  804. four_st_check
  805. ;    cmp.w    #640,pic_x
  806. ;    bne    non_st_check
  807. ;    cmp.w    #200,pic_y
  808. ;    bne    non_st_check
  809.     cmp.b    #1,-1(a0)
  810.     bne    non_st_check
  811.     st.b    (a0)
  812.     clr.w    pic_pal
  813.     rts
  814.  
  815. sixteen_st_check
  816.     cmp.w    #320,pic_x
  817.     bne    non_st_check
  818.     cmp.w    #200,pic_y
  819.     bne    non_st_check
  820.     st.b    (a0)
  821.     clr.w    pic_pal
  822.     rts
  823.  
  824.  
  825.  
  826. save_pal:
  827.     bsr    wait_vbl
  828.     lea    pal_space,a0
  829.     lea    $ffff8240.w,a1
  830.     moveq    #15,d0
  831. .save_st_pal
  832.     move.w    (a1)+,(a0)+
  833.     dbra    d0,.save_st_pal
  834.  
  835.     lea    $ffff9800.w,a1
  836.     move.w    #255,d0
  837. .save_falc_pal
  838.     move.l    (a1)+,(a0)+
  839.     dbra    d0,.save_falc_pal
  840.  
  841.  
  842.     rts
  843.  
  844. ***************************
  845. * SCREEN SETTING ROUTINES *
  846. ***************************
  847.  
  848. set_resolution
  849.     lea    videl_640_200_2(pc),a0
  850.  
  851.     move.b    #2,$ffff820a.w            ; Internal sync
  852.     clr.b    $ffff8265.w            ; Horizontal scroll reg=0
  853.     addq.l    #4,a0                ; skip screen_length
  854.     move.w    (a0)+,$ffff820e.w        ; line width
  855.     move.w    (a0)+,$ffff8210.w        ; Falcon line width
  856.     move.w    (a0)+,d0            ; Resolution ST
  857.     move.w    (a0)+,d1            ; Resolution FALCON
  858.  
  859.     move.w    d1,$ffff8266.w            ; Resolution FALCON
  860.     tst.w    (a0)+                ; falcon screen mode?
  861.     beq.s    FalconRez            ; yes
  862.     move.b    d0,$ffff8260.w            ; Resolution ST
  863.     move.w    -8(a0),$ffff8210.w        ; Fa;cpm line width
  864. FalconRez
  865. ;    move.b    $ffff8007.w,d0
  866. ;    and.b    #%11,d0
  867. ;    cmp.b    #%10,d0
  868. ;    bne.s    R_OK                ; not VGA    
  869. ;    btst.b    #7,$ffff8006.w            ; VGA monitor ?
  870. ;    Beq.s    R_Ok                ; no, rgb
  871.     tst.b    vga_flag
  872.     beq.s    R_Ok
  873.     adda.w    #16*2,a0            ; get to VGA data
  874. R_Ok
  875.     move.w    (a0)+,$ffff8282.w        ; HHT - Hold counter
  876.     move.w    (a0)+,$ffff8284.w        ; HBB - Border Begin
  877.     move.w    (a0)+,$ffff8286.w        ; HBE - Border end
  878.     move.w    (a0)+,$ffff8288.w        ; HDB - Display Begin
  879.     move.w    (a0)+,$ffff828a.w        ; HDE - Display End
  880.     move.w    (a0)+,$ffff828c.w        ; HSS - Synchro
  881.     move.w    (a0)+,$ffff828e.w        ; HFS
  882.     move.w    (a0)+,$ffff8290.w        ; HEE
  883.     move.w    (a0)+,$ffff82a2.w        ; VFT - Synchro
  884.     move.w    (a0)+,$ffff82a4.w        ; VBB - Border Begin
  885.     move.w    (a0)+,$ffff82a6.w        ; VBE - Border End
  886.     move.w    (a0)+,$ffff82a8.w        ; VDB - Display Begin
  887.     move.w    (a0)+,$ffff82aa.w        ; VDE - Display End
  888.     move.w    (a0)+,$ffff82ac.w        ; VSS-Synchro
  889.     move.w    (a0)+,$ffff82c0.w        ; FALCON resoultion indicator
  890.     move.w    (a0),$ffff82c2.w        ; resolution info
  891.  
  892.     rts
  893.  
  894.  
  895. init_screen:
  896.     lea    screen_space(pc),a0
  897.     move.l    a0,d0
  898.     clr.b    d0
  899.     lea    physic(pc),a1
  900.     move.l    d0,(a1)
  901.     bsr    wait_vbl
  902.     bsr    set_my_screen
  903.     bsr    set_resolution
  904.     bsr    clear_my_screen
  905.     bsr    set_my_pal
  906.     rts
  907.  
  908. set_my_screen:
  909.     lea    physic(pc),a1
  910.     movea.w    #$8201,a0    ;$fffff8201=screen address
  911.     move.b    1(a1),(a0)
  912.     move.b    2(a1),2(a0)    ;$fffff8203
  913.     move.b    3(a1),$C(a0)    ;$fffff820d
  914.     rts
  915.  
  916.     
  917. clear_my_screen
  918.     move.l    physic(pc),a1
  919.     move.l    #(640*200/8)/4-1,d0
  920. .cl    clr.l    (a1)+
  921.     dbra    d0,.cl
  922.     rts
  923.  
  924. set_my_pal:
  925.     lea    $ffff9800.w,a0
  926.     lea    $ffff8240.w,a1
  927.     moveq    #0,d0
  928.     move.l    d0,(a0)+
  929.     move.w    d0,(a1)+
  930.     moveq    #-1,d0
  931.     move.l    d0,(a0)+
  932.     move.w    d0,(a1)+
  933.     rts
  934.  
  935. ***************************
  936. * VECTOR RESTORE ROUTINES *
  937. ***************************
  938.  
  939. restore_system:
  940.     lea    old_system_vars(pc),a0    
  941. restore_cur_system:
  942.     move.w    sr,-(a7)
  943.     move.w    #$2700,sr
  944.     move.w    (a0)+,d0
  945.     movec    d0,cacr
  946.     move.l    (a0)+,d0
  947.     movec    d0,VBR
  948.     move.l    (a0)+,$68.w            ; hbl
  949.     move.l    (a0)+,$70.w            ; vbl
  950.     move.l    (a0)+,$84.w            ; trap #1
  951.     move.l    (a0)+,$b4.w            ; trap #13
  952.     move.l    (a0)+,$b8.w            ; trap #14
  953.     move.l    (a0)+,$110.w            ; Timer D
  954.     move.l    (a0)+,$114.w            ; Timer C
  955.     move.l    (a0)+,$118.w            ; ikbd
  956.     move.l    (a0)+,$120.w            ; Timer B
  957.     move.l    (a0)+,$134.w            ; Timer A
  958.     move.l    (a0)+,$13c.w            ; mono detect
  959.     move.l    (a0)+,$456.w            ; vbl list ptr
  960.     move.l    (a0)+,$466.w            ; current vbl clock
  961.     move.l    (a0)+,$502.w            ; alt-help vector
  962.  
  963.     move.w    (a0)+,$ffff8900.w                ; Interruptions, Son DMA
  964.     move.b    (a0)+,$ffff8903.w                ; Start - High
  965.     move.b    (a0)+,$ffff8905.w                ; Start - Med
  966.     move.b    (a0)+,$ffff8907.w                ; Start - Low
  967.     move.b    (a0)+,$ffff890f.w                ; End - High
  968.     move.b    (a0)+,$ffff8911.w                ; End - Med
  969.     move.b    (a0)+,$ffff8913.w                ; End - Low
  970.     move.w    (a0)+,$ffff8920.w                ; Nb Voies, 8/16, Mono/Stereo
  971.     move.w    (a0)+,$ffff8930.w                ; Matrice : Sources
  972.     move.w    (a0)+,$ffff8932.w                ; Matrice : Destinations
  973.     move.w    (a0)+,$ffff8934.w                ; Prescales d'horloge
  974.     move.w    (a0)+,$ffff8936.w                ; Nb Voies Record,source ADDERIN
  975.     move.w    (a0)+,$ffff8938.w                ; Source ADC + Volumes entrées
  976.     move.w    (a0)+,$ffff893a.w                ; Volumes de Sortie
  977.  
  978.  
  979.     move.b    (a0)+,$fffffa07.w        ; iera
  980.     move.b    (a0)+,$fffffa09.w        ; ierb
  981.     move.b    (a0)+,$fffffa13.w        ; imra
  982.     move.b    (a0)+,$fffffa15.w        ; imrb
  983.     move.b    (a0)+,$fffffa17.w        ; vectore register
  984.     move.b    (a0)+,$fffffa19.w        ; Timer A control
  985.     move.b    (a0)+,$fffffa1b.w        ; Timer B control
  986.     move.b    (a0)+,$fffffa1d.w        ; Timer C & D control
  987.     move.b    (a0)+,$fffffa1f.w        ; Timer A data
  988.     move.b    (a0)+,$fffffa21.w        ; Timer B data
  989. ;    move.b    (a0)+,$fffffa23.w        ; Timer C data
  990.     move.b    (a0)+,$fffffa25.w        ; Timer D data
  991.     move.b    (a0)+,$ffff8007.w        ; 68030 Configuration 
  992.     move.w    (a7)+,sr
  993.     rts
  994.  
  995.  
  996. restore_screen_info:
  997.     lea    screen_vars(pc),a0
  998.     move.b    (a0)+,$ffff8201.w    ; 0 Screen Adr (high)
  999.     move.b    (a0)+,$ffff8203.w    ; 1 Screen Adr (medium)
  1000.     move.b    (a0)+,$ffff820d.w    ; 2 Screen Adr (low)
  1001.     move.b    (a0)+,$ffff8265.w    ; 3 Horizontal Scroll
  1002.  
  1003.     move.w    (a0)+,$ffff8282.w    ; 4 Horizontal Hold Timer
  1004.     move.w    (a0)+,$ffff8284.w    ; 6 Horizontal Border Begin
  1005.     move.w    (a0)+,$ffff8286.w    ; 8 Horizontal Border End
  1006.     move.w    (a0)+,$ffff8288.w    ;10 Horizontal Display Begin
  1007.     move.w    (a0)+,$ffff828a.w    ;12 Horizontal display End 
  1008.     move.w    (a0)+,$ffff828c.w    ;14 HSS-Synchro
  1009.     move.w    (a0)+,$ffff828e.w    ;16 HFS
  1010.     move.w    (a0)+,$ffff8290.w    ;18 HEE
  1011.     move.w    (a0)+,$ffff82a2.w    ;20 Vertical Frequency Timer
  1012.     move.w    (a0)+,$ffff82a4.w    ;22 Vertical Border Begin
  1013.     move.w    (a0)+,$ffff82a6.w    ;24 Vertical Border End
  1014.     move.w    (a0)+,$ffff82a8.w    ;26 Vertical Display Begin
  1015.     move.w    (a0)+,$ffff82aa.w    ;28 Vertical Display End
  1016.     move.w    (a0)+,$ffff82ac.w    ;30 VSS
  1017.     move.w    (a0)+,$ffff820a.w    ;32 Video Sync Mode
  1018.     move.w    (a0)+,$ffff82c0.w    ;34 Video Clock
  1019.     move.w    (a0)+,$ffff8266.w    ;36 SPSHIFT - Falcon res
  1020.     tst.b    7(a0)
  1021.     beq.s    .no_st
  1022.     move.b    6(a0),$ffff8260.w
  1023. .no_st
  1024.     move.w    (a0)+,$ffff82c2.w    ;38 Video Control
  1025.     move.w    (a0)+,$ffff8210.w    ;40 Falcon Line Width
  1026.     move.w    (a0)+,$ffff820e.w    ;42 STe Line Width
  1027.     rts
  1028.  
  1029.  
  1030. restore_pic_pal
  1031.     bsr    wait_vbl
  1032.     tst.w    pic_pal
  1033.     beq    restore_st_pal
  1034.     bra    restore_falc_pal
  1035.  
  1036. restore_pal
  1037.     bsr    wait_vbl
  1038.     bsr    restore_st_pal
  1039.     bsr    restore_falc_pal
  1040.     rts
  1041.  
  1042. restore_st_pal
  1043.     lea    pal_space,a0
  1044.     lea    $ffff8240.w,a1
  1045.     moveq    #15,d0
  1046. .save_st_pal
  1047.     move.w    (a0)+,(a1)+
  1048.     dbra    d0,.save_st_pal
  1049.     rts
  1050.  
  1051. unset_st_pal
  1052.     lea    $ffff8240.w,a0
  1053.     moveq    #0,d0
  1054.     moveq    #7,d1
  1055. .uns    move.l    d0,(a0)+
  1056.     dbra    d1,.uns
  1057.     rts
  1058.  
  1059. restore_falc_pal
  1060.     lea    pal_space+32,a0
  1061.     lea    $ffff9800.w,a1
  1062.     move.w    #255,d0
  1063. .save_falc_pal
  1064.     move.l    (a0)+,(a1)+
  1065.     dbra    d0,.save_falc_pal
  1066.     rts
  1067.  
  1068. unset_falc_pal
  1069.     lea    $ffff9800.w,a0
  1070.     moveq    #0,d0
  1071.     move.w    #255,d1
  1072. .uns    move.l    d0,(a0)+
  1073.     dbra    d1,.uns
  1074.     rts
  1075.  
  1076. ****************************
  1077. * VECTOR INSTALLATION MENU *
  1078. ****************************
  1079.  
  1080. do_vector_install_menu
  1081.     lea    vector_menu_txt,a0
  1082.     moveq    #0,d0
  1083.     moveq    #0,d1
  1084.     bsr    print_string
  1085.     bsr    display_all_vecs
  1086.     clr.b    key_pressed
  1087. .loop    tst.b    key_table+$39
  1088.     bne    .end
  1089.     tst.b    key_table+1
  1090.     bne    .quit
  1091.     bsr    get_my_key
  1092.     cmp.w    #$2b,d0
  1093.     bne.s    .non_hash
  1094.     bsr    vector_toggle
  1095.     bsr    display_all_vecs
  1096.     bra.s    .loop
  1097. .non_hash
  1098.     bsr    convert_my_key
  1099.     tst.w    d1
  1100.     bmi.s    .loop
  1101.  
  1102.     moveq    #2,d0
  1103.     tst.b    key_table+$38
  1104.     bne.s    .setbit
  1105.     moveq    #1,d0
  1106.     tst.b    key_table+$2a
  1107.     bne.s    .setbit
  1108.     tst.b    key_table+$36
  1109.     bne.s    .setbit    
  1110.     moveq    #0,d0
  1111. .setbit
  1112.     lea    space_txt,a0
  1113.     bchg    d0,(install_bits,d1.w)
  1114.     bne.s    .space
  1115.     lea    star_txt,a0
  1116. .space    move.l    (vecs_x,d0.w*4),d0
  1117.     mulu    #6,d1
  1118.     add.l    #vecs_y,d1
  1119.     bsr    print_string
  1120.     bra    .loop
  1121. .quit    moveq    #-1,d0
  1122.     rts
  1123. .end    moveq    #0,d0
  1124.     rts    
  1125.  
  1126. display_all_vecs:
  1127.     moveq    #23,d7            ;vecs to check
  1128.     moveq    #vecs_y,d1    
  1129.  
  1130.     lea    install_bits,a6
  1131. .ly    moveq    #2,d6
  1132. .lx    move.l    (vecs_x,d6.w*4),d0
  1133.     lea    space_txt,a0
  1134.     btst.b    d6,(a6)
  1135.     beq.s    .space
  1136.     lea    star_txt,a0
  1137. .space    movem.l    d0-a6,-(a7)
  1138.     bsr    print_string
  1139.     movem.l    (a7)+,d0-a6
  1140.     dbra    d6,.lx
  1141.     addq.w    #1,a6
  1142.     addq.l    #6,d1
  1143.     dbra    d7,.ly
  1144.  
  1145.     rts
  1146.  
  1147. vector_toggle
  1148.     moveq    #2,d0
  1149.     tst.b    key_table+$38
  1150.     bne.s    .setbit
  1151.     moveq    #1,d0
  1152.     tst.b    key_table+$2a
  1153.     bne.s    .setbit
  1154.     tst.b    key_table+$36
  1155.     bne.s    .setbit    
  1156.     moveq    #0,d0
  1157. .setbit    lea    install_bits,a0
  1158.     moveq    #23,d1
  1159.     bchg    d0,v_toggle_mode
  1160.     bne.s    .all_off
  1161. .on    bset.b    d0,(a0)+
  1162.     dbra    d1,.on
  1163.     rts    
  1164. .all_off
  1165.     bclr.b    d0,(a0)+
  1166.     dbra    d1,.all_off
  1167.     rts
  1168.  
  1169. get_my_key:
  1170.     tst.b    key_pressed
  1171.     beq.s    get_my_key
  1172.     moveq    #0,d0
  1173.     move.b    current_key,d0
  1174.     clr.b    key_pressed
  1175.     rts
  1176.  
  1177. convert_my_key
  1178.     move.w    d0,d1
  1179.     sub.w    #$3b,d1
  1180.     bmi.s    .chk2
  1181.     cmp.b    #10,d1
  1182.     bge.s    .chk2
  1183.     rts    
  1184. .chk2    move.w    d0,d1
  1185.     subq.w    #$2,d1
  1186.     bmi.s    .chk3
  1187.     cmp.w    #14,d1
  1188.     bge.s    .chk3
  1189.     add.w    #10,d1    
  1190.     rts
  1191. .chk3    move.w    d0,d1
  1192.     sub.w    #16,d1
  1193.     bmi.s    .chk4
  1194.     cmp.w    #4,d1
  1195.     bge.s    .chk4
  1196.     add.w    #20,d1
  1197.     rts
  1198. .chk4    moveq    #-1,d1
  1199.     rts
  1200.  
  1201. ********************************
  1202. * VECTOR INSTALLATION ROUTINES *
  1203. ********************************
  1204.  
  1205. do_installation:
  1206.     move.w    sr,-(a7)
  1207.     ori.w    #$0700,sr
  1208.     move.b    check_bit,d0
  1209.     btst    d0,(install_bits+vbr_ex)
  1210.     beq.s    .no_vbr
  1211.     lea    my_vector_table,a2
  1212.     movec    a2,VBR
  1213. .no_vbr
  1214.     movec    VBR,a2
  1215.     bsr    install_normals
  1216.     bsr    install_customs
  1217.     move.w    (a7)+,sr
  1218.     rts
  1219.  
  1220. install_normals:
  1221.     lea    reinstall_adrs,a0
  1222.     lea    install_bits,a1
  1223. .loop    move.w    (a0)+,d0        ;get vec family num
  1224.     bmi    .end            ;if minus last
  1225.     move.b    check_bit,d1
  1226.     btst    d1,(a1,d0.w)        ;install/reinstall bit?
  1227.     beq    .next            ;not set
  1228.  
  1229.     move.l    (a0),d1
  1230.     move.l    (a2,d1),d0
  1231.  
  1232. ;    move.l    ([a0]),d0        ;get vector ptr
  1233.     beq.s    .install        ;if 0, reinstall
  1234.     btst    #0,d0            ;odd address?
  1235.     bne.s    .install        ;yes
  1236.     cmp.l    4(a0),d0        ;my int installed?
  1237.     beq.s    .next            ;yes
  1238.     move.l    d0,([a0,8])        ;old ptr is jump
  1239. ;    move.l    4(a0),([a0])        ;install my vecor
  1240.     move.l    4(a0),(a2,d1)
  1241.     add.l    #12,a0            ;next ad
  1242.     bra.s    .loop            ;loop
  1243. .install
  1244.     move.l    #end_int,([a0,8])    ;point to rte
  1245.     move.l    4(a0),([a0])        ;install my vector
  1246. .next    add.l    #12,a0
  1247.     bra.s    .loop
  1248. .end    rts
  1249.  
  1250. install_customs:
  1251.     lea    custom_adrs,a0
  1252.     lea    install_bits,a1    
  1253. .loop    move.w    (a0)+,d0
  1254.     bmi    .last
  1255.     move.b    check_bit,d1
  1256.     btst    d1,(a1,d0.w)
  1257.     beq    .next
  1258.     pea    (a0)
  1259.     jsr    ([a0])
  1260.     move.l    (a7)+,a0
  1261. .next    addq.l    #4,a0
  1262.     bra.s    .loop
  1263. .last    rts    
  1264.  
  1265. reinstall_all:
  1266.  
  1267.  
  1268. install_rs232:
  1269.     lea    rs232_adrs,a0
  1270.     bsr    multi_install
  1271.     or.b    #%01011110,$fffffa07.w
  1272.     or.b    #%01011110,$fffffa13.w
  1273.     or.b    #%111,$fffffa09.w
  1274.     or.b    #%111,$fffffa15.w
  1275.     rts
  1276.  
  1277. install_errors:
  1278.     lea    error_adrs,a0
  1279.     bra.s    multi_install
  1280.  
  1281. install_mmu:
  1282.     lea    mmu_adrs,a0
  1283. multi_install:
  1284.  
  1285. .loop    move.l    (a0),d1            ;get vector address
  1286.     bmi    .last
  1287.     lea    (a2,d1),a1
  1288.     move.l    (a1),d0            ;get vector ptr
  1289.     beq.s    .install        ;if 0, reinstall
  1290.     btst    #0,d0            ;odd address?
  1291.     bne.s    .install        ;yes
  1292.     cmp.l    4(a0),d0
  1293.     beq.s    .next
  1294.     move.l    d0,([a0,8])        ;old ptr is jump
  1295.     move.l    4(a0),(a1)        ;install my vecor
  1296.     bra.s    .next
  1297. .install
  1298.     move.l    #end_int,([a0,8])    ;point to rte
  1299.     move.l    4(a0),(a1)        ;install my vector
  1300. .next    add.l    #12,a0
  1301.     bra.s    .loop
  1302.  
  1303. .last    rts
  1304.  
  1305.  
  1306.  
  1307. install_timer_a:
  1308.     btst    #5,$fffffa07.w
  1309.     beq.s    .new_a
  1310.     move.l    $134(a2),d0        ;current timer a
  1311.     beq.s    .new_a            ;must be non zero!
  1312.     cmp.l    #new_timer_a,d0        ;my timer installed?
  1313.     beq.s    .go_a            ;yes
  1314.     btst    #0,d0            ;odd address?
  1315.     bne.s    .new_a            ;no, even
  1316.     move.l    d0,old_timer_a+2    ;old timer a
  1317.     move.l    #new_timer_a,$134(a2)    ;my timer a
  1318.     bra    .go_a            ;set timer a on
  1319. .new_a    move.l    #end_timer_a,d0        ;sei routine
  1320.     btst    #3,$fffffa17.w        ;aei/sei
  1321.     bne.s    .sei            ;sei
  1322.     move.l    #end_int,d0        ;dummy RTE
  1323. .sei    move.l    d0,old_timer_a+2    ;end interrupt routine
  1324.     move.l    #new_timer_a,$134(a2)    ;install timer a
  1325. .go_a    tst.b    $fffffa19.w
  1326.     bne.s    .ok_a
  1327.     move.b    #7,$fffffa19.w        ;Timer A control (delay mode)
  1328.     move.b    #246,$fffffa1f.w    ;Timer A data
  1329. .ok_a    bset    #5,$fffffa07.w        ;Interrupt Enable Register A
  1330.     bset    #5,$fffffa13.w        ;Interrupt Mask Register A
  1331.     rts
  1332.  
  1333.  
  1334. install_timer_b:
  1335.     btst    #0,$fffffa07.w
  1336.     beq.s    .new_b
  1337.     move.l    $120(a2),d0        ;current timer b
  1338.     beq.s    .new_b            ;must be non zero!
  1339.     cmp.l    #new_timer_b,d0        ;my timer installed?
  1340.     beq.s    .go_b            ;yes
  1341.     btst    #0,d0            ;odd address?
  1342.     bne.s    .new_b            ;no, even
  1343.     move.l    d0,old_timer_b+2    ;old timer a
  1344.     move.l    #new_timer_b,$120(a2)    ;my timer a
  1345.     bra    .go_b            ;set timer a on
  1346. .new_b    move.l    #end_timer_b,d0        ;sei routine
  1347.     btst    #3,$fffffa17.w        ;aei/sei
  1348.     bne.s    .sei            ;sei
  1349.     move.l    #end_int,d0        ;dummy RTE
  1350. .sei    move.l    d0,old_timer_b+2    ;end interrupt routine
  1351.     move.l    #new_timer_b,$120(a2)    ;install timer a
  1352. .go_b    tst.b    $fffffa1b.w
  1353.     bne.s    .ok_b
  1354.     move.b    #7,$fffffa1b.w        ;Timer A control (delay mode)
  1355.     move.b    #246,$fffffa21.w    ;Timer A data
  1356. .ok_b    bset    #0,$fffffa07.w        ;Interrupt Enable Register B
  1357.     bset    #0,$fffffa13.w        ;Interrupt Mask Register B
  1358.     rts
  1359.  
  1360. install_timer_c:
  1361.     btst    #5,$fffffa09.w
  1362.     beq.s    .new_c
  1363.     move.l    $114(a2),d0        ;current timer c
  1364.     beq.s    .new_c            ;must be non zero!
  1365.     cmp.l    #new_timer_c,d0        ;my timer installed?
  1366.     beq.s    .go_c            ;yes
  1367.     btst    #0,d0            ;odd address?
  1368.     bne.s    .new_c            ;no, even
  1369.     move.l    d0,old_timer_c+2    ;old timer a
  1370.     move.l    #new_timer_c,$114(a2)    ;my timer a
  1371.     bra    .go_c            ;set timer a on
  1372. .new_c    move.l    #end_timer_c,d0        ;sei routine
  1373.     btst    #3,$fffffa17.w        ;aei/sei
  1374.     bne.s    .sei            ;sei
  1375.     move.l    #end_int,d0        ;dummy RTE
  1376. .sei    move.l    d0,old_timer_c+2    ;end interrupt routine
  1377.     move.l    #new_timer_c,$114(a2)    ;install timer a
  1378. .go_c    bftst    $fffffa1c.w{8+5:3}    ;timer c on?
  1379.     bne.s    .ok_c            ;yes
  1380.     or.b    #%111,$fffffa1d.w    ;Timer C/D control (delay mode)
  1381.     move.b    #246,$fffffa23.w    ;Timer C data
  1382. .ok_c    bset    #5,$fffffa09.w        ;Interrupt Enable Register B
  1383.     bset    #5,$fffffa15.w        ;Interrupt Mask Register B
  1384.     rts
  1385.  
  1386.  
  1387. install_timer_d:
  1388.     btst    #4,$fffffa09.w
  1389.     beq.s    .new_d
  1390.     move.l    $110(a2),d0        ;current timer d
  1391.     beq.s    .new_d            ;must be non zero!
  1392.     cmp.l    #new_timer_d,d0        ;my timer installed?
  1393.     beq.s    .go_d            ;yes
  1394.     btst    #0,d0            ;odd address?
  1395.     bne.s    .new_d            ;no, even
  1396.     move.l    d0,old_timer_d+2    ;old timer a
  1397.     move.l    #new_timer_d,$110(a2)    ;my timer b
  1398.     bra    .go_d            ;set timer b on
  1399. .new_d    move.l    #end_timer_d,d0        ;sei routine
  1400.     btst    #3,$fffffa17.w        ;aei/sei
  1401.     bne.s    .sei            ;sei
  1402.     move.l    #end_int,d0        ;dummy RTE
  1403. .sei    move.l    d0,old_timer_d+2    ;end interrupt routine
  1404.     move.l    #new_timer_d,$110(a2)    ;install timer a
  1405.     or.b    #%0111000,$fffffa1d.w
  1406.     move.b    #246,$fffffa25.w    ;Timer D data
  1407.     bra.s    .ok_d
  1408. .go_d    bftst    $fffffa1c.w{8+1:3}    ;timer d on?
  1409.     bne.s    .ok_d            ;yes
  1410.     or.b    #%0111000,$fffffa1d.w
  1411.     move.b    #246,$fffffa25.w    ;Timer D data
  1412. .ok_d    bset    #4,$fffffa09.w        ;Interrupt Enable Register B
  1413.     bset    #4,$fffffa15.w        ;Interrupt Mask Register B
  1414.     rts
  1415.  
  1416. install_ikbd:
  1417.     move.l    $118(a2),d0
  1418.     beq.s    .new_i    
  1419.     cmp.l    #new_ikbd,d0
  1420.     beq    .go_i
  1421.     btst    #0,d0
  1422.     bne.s    .new_i
  1423.     move.l    d0,old_ikbd+2
  1424.     move.l    #new_ikbd,$118(a2)
  1425.     bra.s    .go_i
  1426. .new_i    move.l    #end_ikbd,old_ikbd+2
  1427.     move.l    #new_ikbd,$118(a2)
  1428. .go_i    bset    #6,$fffffa09.w
  1429.     bset    #6,$fffffa15.w    
  1430.     rts
  1431.  
  1432. install_fdi:
  1433.     btst    #7,$fffffa09.w
  1434.     beq.s    .new_f
  1435.     move.l    $11c(a2),d0
  1436.     beq.s    .new_f
  1437.     cmp.l    #new_fdi,d0
  1438.     beq    .go_f
  1439.     btst    #0,d0
  1440.     bne.s    .new_f
  1441.     move.l    d0,old_fdi+2
  1442.     move.l    #new_fdi,$11c(a2)
  1443.     bra.s    .go_f
  1444. .new_f    move.l    #end_fdi,old_fdi+2
  1445.     move.l    #new_fdi,$11c(a2)
  1446. .go_f    bset    #7,$fffffa09.w
  1447.     bset    #7,$fffffa15.w    
  1448.     rts
  1449.  
  1450. install_blitter:
  1451.     btst    #3,$fffffa09.w
  1452.     beq.s    .new_bl
  1453.     move.l    $10c(a2),d0
  1454.     beq.s    .new_bl
  1455.     cmp.l    #new_blitter,d0
  1456.     beq    .go_bl
  1457.     btst    #0,d0
  1458.     bne.s    .new_bl
  1459.     move.l    d0,old_blitter+2
  1460.     move.l    #new_blitter,$10c(a2)
  1461.     bra.s    .go_bl
  1462. .new_bl    move.l    #end_blitter,old_blitter+2
  1463.     move.l    #new_blitter,$10c.w
  1464. .go_bl    bset    #3,$fffffa09.w
  1465.     bset    #3,$fffffa15.w    
  1466.     rts
  1467.  
  1468.  
  1469. install_mono:
  1470.     move.l    #new_mono,$13c(a2)
  1471.     bset    #7,$fffffa07.w
  1472.     bset    #7,$fffffa13.w
  1473.     rts
  1474.  
  1475. install_trace:
  1476.     move.l    #check_option,$24(a2)
  1477.     move.w    #$8000,new_sr
  1478.     rts
  1479.  
  1480. install_reset:
  1481.     move.l    #$31415926,$426.w    ;magic
  1482.     move.l    #new_reset,$42a.w    
  1483.     rts
  1484.  
  1485.     move.l    #screen_space+512,d0
  1486.     and.w    #%1111111000000000,d0        ;512 byte boundary
  1487.     move.l    d0,reset_adr
  1488.     move.l    d0,a0
  1489.     move.l    #$12123456,(a0)+
  1490.     move.l    d0,(a0)+
  1491.     move.w    #$4ef9,(a0)+
  1492.     move.l    #new_reset,(a0)+
  1493.     move.l    d0,a0
  1494.     move.w    #$fe,d0
  1495.     moveq    #0,d1
  1496. .add    add.w    (a0)+,d1
  1497.     dbra    d0,.add    
  1498.     move.w    #$5678,d0
  1499.     sub.w    d1,d0
  1500.     move.w    d0,(a0)
  1501.     rts
  1502.  
  1503. install_alt_help
  1504.     move.l    #new_alt_help,$502.w
  1505.     rts
  1506.  
  1507. install_vbl_queue:
  1508.     move.l    $456.w,a0
  1509.     move.l    #new_vbl_lister,d0
  1510. .gvbl    move.l    (a0)+,d1
  1511.     beq.s    .install
  1512.     cmp.l    d0,d1
  1513.     bne.s    .gvbl    
  1514.     rts
  1515. .install
  1516.     move.l    #new_vbl_lister,-4(a0)
  1517.     clr.l    (a0)
  1518.     rts
  1519.  
  1520.  
  1521. ***********************
  1522. * NEW VECTOR ROUTINES *
  1523. ***********************
  1524.  
  1525. end_int:    rte
  1526.  
  1527.  
  1528. *
  1529. ** EXCEPTION ERRORS **
  1530. *
  1531.  
  1532. new_bus_error:    clr.b    current_vec
  1533.         move.b    #error_ex,vec_family
  1534.         bsr    check_option
  1535. old_bus_error    jmp    $12345678
  1536.  
  1537. new_address_error:
  1538.         move.b    #1,current_vec
  1539.         move.b    #error_ex,vec_family
  1540.         bsr    check_option
  1541. old_address_error
  1542.         jmp    $12345678
  1543.  
  1544. new_illegal:
  1545.         move.b    #2,current_vec
  1546.         move.b    #error_ex,vec_family
  1547.         bsr    check_option
  1548. old_illegal    jmp    $12345678
  1549.  
  1550. new_divide0:
  1551.         move.b    #3,current_vec
  1552.         move.b    #error_ex,vec_family
  1553.         bsr    check_option
  1554. old_divide0    jmp    $12345678
  1555.  
  1556. new_chk:    move.b    #4,current_vec
  1557.         move.b    #error_ex,vec_family
  1558.         bsr    check_option
  1559. old_chk        jmp    $12345678
  1560.  
  1561.  
  1562. new_trapv:    move.b    #5,current_vec
  1563.         move.b    #error_ex,vec_family
  1564.         bsr    check_option
  1565. old_trapv    jmp    $12345678
  1566.  
  1567.  
  1568. new_priv:    move.b    #6,current_vec
  1569.         move.b    #error_ex,vec_family
  1570.         bsr    check_option
  1571. old_priv    jmp    $12345678
  1572.  
  1573. new_coprovi:    move.b    #7,current_vec
  1574.         move.b    #error_ex,vec_family
  1575.         bsr    check_option
  1576. old_coprovi    jmp    $12345678
  1577.  
  1578. new_format:    move.b    #8,current_vec
  1579.         move.b    #error_ex,vec_family
  1580.         bsr    check_option
  1581. old_format:    jmp    $12345678
  1582.  
  1583. new_uninit:    move.b    #9,current_vec
  1584.         move.b    #error_ex,vec_family
  1585.         bsr    check_option
  1586. old_uninit:    jmp    $12345678
  1587.  
  1588. new_spurious:    move.b    #10,current_vec
  1589.         move.b    #error_ex,vec_family
  1590.         bsr    check_option
  1591. old_spurious:    jmp    $12345678
  1592.  
  1593.  
  1594. new_trace    move.b    #trace_ex,vec_family
  1595.         bsr    check_option
  1596. old_trace:    jmp    "RGOD"
  1597.  
  1598. *
  1599. ** MMU ERRORS **
  1600. *
  1601.  
  1602. new_mmu_config:    clr.b    current_vec
  1603.         move.b    #mmu_ex,vec_family
  1604.         bsr    check_option
  1605. old_mmu_config:    jmp    $12345678
  1606.  
  1607. new_mmu_illegal:
  1608.         move.b    #1,current_vec
  1609.         move.b    #mmu_ex,vec_family
  1610.         bsr    check_option
  1611. old_mmu_illegal: jmp    $12345678
  1612.  
  1613. new_mmu_address:
  1614.             move.b    #2,current_vec
  1615.         move.b    #mmu_ex,vec_family
  1616.         bsr    check_option
  1617. old_mmu_address: jmp    $12345678
  1618.  
  1619.  
  1620. *
  1621. ** RS-232 ERRORS
  1622. *
  1623.  
  1624. new_rs232_cd:      clr.b    current_vec
  1625.         move.b    #rs232_ex,vec_family
  1626.         move.l    #$0001fa11,mfp_sei
  1627.         bsr    check_option
  1628. old_rs232_cd:     jmp    $12345678
  1629. end_rs232_cd:    bclr.b    #1,$fffffa11.w
  1630.         rte
  1631.  
  1632. new_rs232_cts:     move.b    #1,current_vec
  1633.         move.b    #rs232_ex,vec_family
  1634.         move.l    #$0002fa11,mfp_sei
  1635.         bsr    check_option
  1636. old_rs232_cts:     jmp    $12345678
  1637. end_rs232_cts:    bclr.b    #2,$fffffa11.w
  1638.         rte
  1639.  
  1640. new_rs232_te:     move.b    #2,current_vec
  1641.         move.b    #rs232_ex,vec_family
  1642.         move.l    #$0001fa0f,mfp_sei
  1643.         bsr    check_option
  1644. old_rs232_te:     jmp    $12345678
  1645. end_rs232_te:    bclr.b    #1,$fffffa0f.w
  1646.         rte
  1647.  
  1648.  
  1649. new_rs232_tbe:     move.b    #3,current_vec
  1650.         move.b    #rs232_ex,vec_family
  1651.         move.l    #$0002fa0f,mfp_sei
  1652.         bsr    check_option
  1653. old_rs232_tbe:     jmp    $12345678
  1654. end_rs232_tbe:    bclr.b    #2,$fffffa0f.w
  1655.         rte
  1656.  
  1657.  
  1658. new_rs232_re:     move.b    #4,current_vec
  1659.         move.b    #rs232_ex,vec_family
  1660.         move.l    #$0003fa0f,mfp_sei
  1661.         bsr    check_option
  1662. old_rs232_re:     jmp    $12345678
  1663. end_rs232_re:    bclr.b    #3,$fffffa0f.w
  1664.         rte
  1665.  
  1666. new_rs232_rbf:     move.b    #5,current_vec
  1667.         move.b    #rs232_ex,vec_family
  1668.         move.l    #$0004fa0f,mfp_sei
  1669.         bsr    check_option
  1670. old_rs232_rbf:     jmp    $12345678
  1671. end_rs232_rbf:    bclr.b    #4,$fffffa0f.w
  1672.         rte
  1673.  
  1674.  
  1675. new_rs232_ring:    move.b    #6,current_vec
  1676.         move.b    #rs232_ex,vec_family
  1677.         move.l    #$0006fa0f,mfp_sei
  1678.         bsr    check_option
  1679. old_rs232_ring    jmp    $12345678
  1680. end_rs232_ring    bclr.b    #6,$ffffffa0f.w
  1681.         rte
  1682.  
  1683. new_rs232_cb:      move.b    #7,current_vec
  1684.         move.b    #rs232_ex,vec_family
  1685.         move.l    #$0000fa11,mfp_sei
  1686.         bsr    check_option
  1687. old_rs232_cb:     jmp    $12345678
  1688. end_rs232_cb:    bclr.b    #0,$fffffa11.w
  1689.         rte
  1690.  
  1691. *
  1692. *** TRAP EXCEPTIONS
  1693. *
  1694.  
  1695. new_trap_1:    move.b    #trap_1_ex,vec_family
  1696.         bsr    check_option
  1697. old_trap_1:    jmp    $12345678
  1698.  
  1699. new_trap_2:    move.b    #trap_2_ex,vec_family
  1700.         bsr    check_option
  1701. old_trap_2:    jmp    $12345678
  1702.  
  1703. new_trap_13:    move.b    #trap_13_ex,vec_family
  1704.         bsr    check_option
  1705. old_trap_13:    jmp    $12345678
  1706.  
  1707. new_trap_14:    move.b    #trap_14_ex,vec_family
  1708.         bsr    check_option
  1709. old_trap_14:    jmp    $12345678
  1710.  
  1711. new_line_a    move.b    #line_a_ex,vec_family
  1712.         bsr    check_option
  1713. old_line_a    jmp    $12345678
  1714.  
  1715. new_line_f    move.b    #line_f_ex,vec_family
  1716.         bsr    check_option
  1717. old_line_f    jmp    $12345678
  1718.  
  1719. *
  1720. ** TIMER EXCEPTIONS
  1721. *
  1722.  
  1723. new_timer_a    move.b    #timer_a_ex,vec_family
  1724.         move.l    #$0005fa0f,mfp_sei
  1725.         bsr    check_option
  1726. old_timer_a    jmp    $12345678
  1727. end_timer_a    bclr.b    #5,$fffffa0f.w
  1728.         rte
  1729.  
  1730. new_timer_b    move.b    #timer_b_ex,vec_family
  1731.         move.l    #$0000fa0f,mfp_sei
  1732.         bsr    check_option
  1733. old_timer_b    jmp    $12345678
  1734. end_timer_b    bclr.b    #0,$fffffa0f.w
  1735.         rte
  1736.  
  1737.  
  1738. new_timer_c:    move.b    #timer_c_ex,vec_family
  1739.         move.l    #$0005fa11,mfp_sei
  1740.         bsr    check_option
  1741. old_timer_c    jmp    $12345678
  1742. end_timer_c    bclr.b    #5,$fffffa11.w
  1743.         rte
  1744.  
  1745. new_timer_d    move.b    #timer_d_ex,vec_family
  1746.         move.l    #$0004fa11,mfp_sei
  1747.         bsr    check_option
  1748. old_timer_d    jmp    $12345678
  1749. end_timer_d    bclr.b    #4,$fffffa11.w
  1750.         rte
  1751.  
  1752. *
  1753. ** MFP EXCEPTIONS
  1754. *
  1755.  
  1756. new_ikbd    move.b    #ikbd_ex,vec_family
  1757.         move.l    #$0006fa11,mfp_sei
  1758.         bsr    check_option
  1759. old_ikbd    jmp    $12345678
  1760. end_ikbd    bclr.b    #6,$fffffa11.w
  1761.         rte
  1762.  
  1763. new_fdi        move.b    #fdi_ex,vec_family
  1764.         move.l    #$0007fa11,mfp_sei
  1765.         bsr    check_option
  1766. old_fdi        jmp    $12345678
  1767. end_fdi        bclr.b    #7,$fffffa11.w
  1768.         rte
  1769. new_blitter:    move.b    #blitter_ex,vec_family
  1770.         move.l    #$0003fa11,mfp_sei
  1771.         bsr    check_option
  1772. old_blitter:    jmp    $12345678
  1773. end_blitter    bclr.b    #3,$fffffa11.w
  1774.         rte
  1775.  
  1776. new_mono    move.b    #mono_ex,vec_family
  1777.         move.l    #$0007fa0f,mfp_sei
  1778.         bsr    check_option
  1779.         rte
  1780.  
  1781. *
  1782. ** VBL INTERRUPTS
  1783. *
  1784.  
  1785. new_vbl:    move.b    #vbl_ex,vec_family
  1786.         bsr    check_option
  1787. old_vbl:    jmp    $12345678
  1788.  
  1789.  
  1790. new_vbl_lister    move.b    #vbl_q_ex,vec_family
  1791.         bsr    check_option
  1792. .no_rip        rts
  1793.  
  1794. new_hbl:    move.b    #hbl_ex,vec_family
  1795.         bsr    check_option
  1796. old_hbl:    jmp    $12345678
  1797.  
  1798.  
  1799. new_reset:    move.b    #reset_ex,vec_family
  1800.         clr.l    $42a.w
  1801.         clr.l    $426.w
  1802.         move.l    new_reset,a0
  1803.         clr.l    (a0)
  1804.         bsr    init_ripper
  1805.         move.w    #$2700,sr
  1806.         jmp    ([$4.w])
  1807.     
  1808. new_alt_help    move.b    #alt_help_ex,vec_family
  1809.         bsr    check_option
  1810.         rts
  1811.     
  1812.  
  1813. end_trap
  1814. ;    move.w    (a7),old_sr+2
  1815. ;    move.l    2(a7),old_prg+2
  1816. ;    move.w    #$2700,(a7)
  1817. ;    move.l    #init_trap_ripper,2(a7)        
  1818. ;    rte
  1819. init_trap_ripper
  1820.     movem.l    d0-a6,-(a7)
  1821.     bsr    init_ripper
  1822.     movem.l    (a7)+,d0-a6
  1823.     rte
  1824. ;old_sr    move.w    #$2300,sr
  1825. ;old_prg    jmp    $12345678
  1826.  
  1827.  
  1828. check_option:
  1829.     movem.l    d0-a6,-(a7)
  1830.     moveq    #0,d0
  1831.     move.b    vec_family,d0
  1832.     btst    #2,(install_bits,d0.w)
  1833.     beq.s    .no_restore
  1834.     bsr    do_installation
  1835. .no_restore
  1836. ;    not.w    $ffff9800.w
  1837. ;    not.w    $ffff8240.w
  1838.     lea    $ffff9200.w,a0    ;extended port address (read only)
  1839.     move.w    #$fff7,2(a0)    ;write mask
  1840.     move.w    (a0),d0        ;read fire data
  1841.     btst    #1,d0        ;check for option
  1842.     bne.s    no_option    ;if set, option is not pressed
  1843.     bsr    init_ripper
  1844. no_option:
  1845.     clr.l    mfp_sei
  1846. ;    tst.b    install_bits+(trace_ex)
  1847. ;    beq.s    .mvm
  1848. ;    cmp.b    #vbl_q_ex,vec_family
  1849. ;    bne.s    .nv
  1850. ;    move.w    sr,d0
  1851. ;    or.w    new_sr,d0    
  1852. ;    move.w    d0,sr
  1853. ;    bra.s    .mvm
  1854. ;.nv    move.w    new_sr,d0
  1855. ;    or.w    d0,16*4(a7)
  1856. .mvm    movem.l    (a7)+,d0-a6
  1857.     rts
  1858.  
  1859.  
  1860.  *------------------------*
  1861. ** GEMDOS Disk Operations **
  1862.  *------------------------*
  1863.  
  1864. * A0->filename, A1->address, D1=length
  1865.  
  1866.  
  1867. save_file:    tst.b    god_mode
  1868.         bne    save_god_file
  1869.         lea    file_name(pc),a0
  1870.         bsr    create_file
  1871.         bmi    display_gemdos_error
  1872.         lea    magic,a0
  1873.         moveq    #16,d7
  1874.         bsr    write_file
  1875.         bmi    display_gemdos_error        
  1876.         move.w    pic_res,d0
  1877.         lea    st_pal_sizes,a1
  1878.         lea    pal_space,a0
  1879.         tst.w    pic_pal
  1880.         beq.s    .st_pal
  1881.         lea    falc_pal_sizes,a1
  1882.         lea    pal_space+32,a0
  1883. .st_pal        move.l    (a1,d0.w*4),d7
  1884.         beq.s    .no_pal
  1885.         bsr    write_file
  1886.         bmi    display_gemdos_error
  1887. .no_pal
  1888. save_true
  1889.         tst.w    screen_vars+42
  1890.         bne    save_pic_lines
  1891.         move.l    pic_adr,a0
  1892.         move.l    pic_length,d7
  1893.         bsr    write_file
  1894.         bmi    display_gemdos_error
  1895.         bsr    close_file
  1896.         rts
  1897. save_pic_lines
  1898.         move.l    pic_adr,a0
  1899.         moveq    #0,d7
  1900.         move.w    screen_vars+40,d7
  1901.         move.l    d7,d6
  1902.         add.w    screen_vars+42,d6
  1903.         add.l    d7,d7
  1904.         add.l    d6,d6
  1905.         
  1906.         move.w    pic_y,d5
  1907.         subq.w    #1,d5
  1908.         bmi.s    .err
  1909. .lines        bsr    write_file
  1910.         add.l    d6,a0
  1911.         dbra    d5,.lines
  1912.  
  1913. .err        bsr    close_file
  1914.         rts
  1915.  
  1916. save_god_file:    lea    file_name(pc),a0
  1917.         bsr    create_file
  1918.         bmi    display_gemdos_error
  1919.         lea    god_head,a0
  1920.         move.w    #'G4',(a0)
  1921.         move.w    pic_x,2(a0)
  1922.         move.w    pic_y,4(a0)
  1923.         moveq    #6,d7
  1924.         bsr    write_file
  1925.         bmi    display_gemdos_error        
  1926.         
  1927.         cmp.w    #4,pic_res        ;true colour
  1928.         beq    save_true        ;yes
  1929.  
  1930.         bsr    get_god_pal
  1931.         
  1932.         move.w    pic_y,d0
  1933.         subq.w    #1,d0
  1934.         bmi    .err
  1935. .write_line_loop                
  1936.         move.w    d0,-(a7)
  1937.         bsr    convert_god_line
  1938.         move.l    physic(pc),a0        ;line buffer
  1939.         moveq    #0,d7
  1940.         move.w    pic_x,d7        ;x pixels
  1941.         add.l    d7,d7            ;*2=tc line size
  1942.         bsr    write_file
  1943.         bmi    display_gemdos_error
  1944.         move.w    (a7)+,d0
  1945.         dbra    d0,.write_line_loop
  1946.  
  1947. .err        bsr    close_file
  1948.         rts
  1949.  
  1950.  
  1951.  
  1952.  
  1953. * a0=source, a1=dest, a2=colour table
  1954.  
  1955. convert_god_line:
  1956.         move.l    cur_pic_adr,a0
  1957.         move.l    physic(pc),a1    ;buffer space        
  1958.         lea    colour_table,a2
  1959.         move.w    pic_x,d4    ;pixels
  1960.         lsr.w    #4,d4        ;divide by 16
  1961.         subq.w    #1,d4        ;-1 for dbra
  1962.         bmi    .error
  1963.  
  1964. .line        move.w    pic_res,d3    ;0,1,2
  1965.         move.w    (plane_dbra,d3.w*2),d5 ;get dbra amount
  1966.         moveq    #0,d0
  1967. .loop1        moveq    #0,d2        ;d2=current pixel
  1968.         move    #31,d7
  1969.         move.l    a0,a3        ;screen address
  1970.         move.w    d5,d3        ;dbra    amount
  1971. .get_pix    bfextu    (a3){d0:1},d1    ;get bit
  1972.         bfins    d1,d2{d7:1}
  1973. ;        roxr.b    #1,d1        ;shift to X flag
  1974. ;        roxl.b    #1,d2        ;shift from X flag
  1975. ;        lsl.w    d2
  1976. ;        or.w    d1,d2
  1977.         addq.w    #2,a3        ;next plane
  1978.         subq.w    #1,d7
  1979.         dbra    d3,.get_pix                        
  1980.         move.w    (a2,d2.w*2),(a1)+    ;copy pixel    
  1981.         addq.l    #1,d0        ;next pixel
  1982.         cmp.w    #16,d0        ;last in plane
  1983.         blt.s    .loop1
  1984.         move.l    a3,a0
  1985.         dbra    d4,.line
  1986.  
  1987.         move.l    a0,cur_pic_adr
  1988.  
  1989. ;        move.l    line_length,d7        ;line size in words    
  1990. ;        add.l    d7,cur_pic_adr        ;update ptr
  1991.  
  1992. .error        rts    
  1993.  
  1994.  
  1995. get_god_pal:
  1996.         lea    pal_space,a0
  1997.         lea    colour_table,a1
  1998.         move.w    pic_res,d0
  1999.         move.w    (cols_dbra,d0.w*2),d0
  2000.         cmp.w    #255,d0
  2001.         beq    get_256_pal
  2002. .loop        bfextu    (a0){4:1},d1    ;lowest red bit
  2003.         bfextu    (a0){5:3},d2    ;other red bits
  2004.         lsl.w    d2        ;shift up a bit
  2005.         or.w    d2,d1        ;form red byte
  2006.         lsl.w    #1,d1        ;->5 bit value
  2007.         bfins    d1,(a1){0:5}    ;store in table
  2008.         bfextu    (a0){8:1},d1    ;lowest green bit
  2009.         bfextu    (a0){9:3},d2    ;other green bits
  2010.         lsl.w    d2        ;shift up a bit
  2011.         or.w    d2,d1        ;form green byte
  2012.         lsl.w    #2,d1        ;->6 bit value
  2013.         bfins    d1,(a1){5:6}    ;store in table
  2014.         bfextu    (a0){12:1},d1    ;lowest blue bit
  2015.         bfextu    (a0){13:3},d2    ;other blue bits
  2016.         lsl.w    d2        ;shift up a bit
  2017.         or.w    d2,d1        ;form blue byte
  2018.         lsl.w    #1,d1        ;->5 bit value
  2019.         bfins    d1,(a1){11:5}    ;store in table
  2020.         addq.w    #2,a0
  2021.         addq.w    #2,a1
  2022.         dbra    d0,.loop    ;loop for all colours
  2023.         rts        
  2024.  
  2025. get_256_pal:    lea    32(a0),a0
  2026.         lea    colour_table,a1
  2027. .loop        bfextu    (a0){0:5},d1
  2028.         bfins    d1,(a1){0:5}
  2029.         bfextu    (a0){8:6},d1
  2030.         bfins    d1,(a1){5:6}                
  2031.         bfextu    (a0){24:5},d1
  2032.         bfins    d1,(a1){11:5}                
  2033.         addq.w    #4,a0
  2034.         addq.w    #2,a1
  2035.         dbra    d0,.loop
  2036.         rts
  2037.  
  2038. cols_dbra    dc.w    0,3,15,255
  2039. plane_dbra    dc.w    0,1,3,7
  2040.  
  2041. st_pal_sizes    dc.l    4,8,32,0,0
  2042. falc_pal_sizes    dc.l    8,16,64,1024,0
  2043.  
  2044.  
  2045. display_gemdos_error:
  2046.         lea    gemdos_errors,a0
  2047.         move.l    #(end_gemdos_errors-gemdos_errors)/8-1,d1
  2048. .find_err    cmp.l    (a0)+,d0
  2049.         beq    found_gemdos_error
  2050.         addq.l    #4,a0
  2051.         dbra    d1,.find_err
  2052.         lea    unerr,a0
  2053. found_gemdos_error
  2054.         move.l    (a0),a0
  2055.         moveq    #0,d0
  2056.         move.l    #180,d1
  2057.         bsr    print_string
  2058.         rts
  2059.  
  2060. create_file:    movem.l    d1-2/a0-2,-(a7)
  2061.         clr.w    -(a7)
  2062.         pea    (a0)
  2063.         move.w    #$3c,-(a7)
  2064.         trap    #1
  2065.         addq.l    #8,a7
  2066.         movem.l    (a7)+,d1-2/a0-a2
  2067.         move.w    d0,file_handle
  2068.         rts
  2069.  
  2070. open_file:    movem.l    d1-2/a0-2,-(a7)
  2071.         clr.w    -(a7)
  2072.         pea    (a0)
  2073.         move.w    #$3d,-(a7)
  2074.         trap    #1
  2075.         addq.l    #8,a7
  2076.         movem.l    (a7)+,d1-2/a0-a2
  2077.         move.w    d0,file_handle    
  2078.         rts
  2079.  
  2080. read_file:    movem.l    d1-2/a0-2,-(a7)
  2081.         pea    (a0)
  2082.         move.l    d7,-(a7)
  2083.         move.w    file_handle,-(a7)
  2084.         move.w    #$3f,-(a7)
  2085.         trap    #1
  2086.         lea    12(a7),a7
  2087.         movem.l    (a7)+,d1-2/a0-a2
  2088.         cmp.l    d7,d0
  2089.         beq.s    .rf
  2090.         move.l    #-1000,d0
  2091. .rf        rts
  2092.  
  2093. write_file:    movem.l    d1-2/a0-2,-(a7)
  2094.         pea    (a0)
  2095.         move.l    d7,-(a7)
  2096.         move.w    file_handle,-(a7)
  2097.         move.w    #$40,-(a7)    
  2098.         trap    #1
  2099.         lea    12(a7),a7
  2100.         movem.l    (a7)+,d1-2/a0-a2
  2101.         cmp.l    d7,d0
  2102.         beq.s    .l9
  2103.         move.l    #-1001,d0
  2104. .l9        rts
  2105.  
  2106. file_seek:    movem.l    d1-2/a0-2,-(a7)
  2107.         move.w    d0,-(a7)
  2108.         move.w    file_handle,-(a7)
  2109.         move.l    d1,-(a7)
  2110.         move.w    #$42,-(a7)
  2111.         trap    #1
  2112.         lea    10(a7),a7
  2113.         movem.l    (a7)+,d1-2/a0-a2
  2114.         rts
  2115.  
  2116. close_file:    movem.l    d1-2/a0-2,-(a7)
  2117.         move.w    file_handle,-(a7)
  2118.         move.w    #$3e,-(a7)
  2119.         trap    #1
  2120.         addq.l    #4,a7
  2121.         movem.l    (a7)+,d1-2/a0-a2
  2122.         rts
  2123.  
  2124. ***************************************
  2125. * STRING PRINTING/CONVERSION ROUTINES *
  2126. ***************************************
  2127.  
  2128. print_string
  2129.     move.l    physic(pc),a1        ;screen
  2130.     mulu    #80,d1            ;y line * line size
  2131.     add.l    d1,a1            ;get to y line
  2132.     lea    tiny_font(pc),a2    ;font data
  2133. .line    move.l    d0,d2            ;start x
  2134. .nxt    moveq    #0,d1            ;clear d1
  2135.     move.b    (a0)+,d1        ;get byte from string
  2136.     beq    .last
  2137.     cmp.b    #13,d1            ;return?
  2138.     bne.s    .not_return        ;no
  2139.     add.l    #80*8*6,d0        ;next line
  2140.     bra.s    .line            ;restore x pos
  2141. .not_return
  2142.     sub.b    #32,d1        ;- first char
  2143.     mulu    #36,d1        ;* char size
  2144.     moveq    #5,d4        ;6 y lines
  2145. .yl    bfextu    (a2){d1:6},d3    
  2146.     bfins    d3,(a1){d2:6}
  2147.     addq.l    #6,d1        ;next char pos in char
  2148.     add.l    #80*8,d2    ;next screen line
  2149.     dbra    d4,.yl        ;loop y times
  2150.     sub.l    #80*8*6-6,d2    ;next x pos
  2151.     bra.s    .nxt
  2152. .last    rts
  2153.  
  2154. * enter with d0=long value
  2155.  
  2156. conv_long_ascii:
  2157.     movem.l    d0-3/a0,-(a7)
  2158.     lea    long_string,a0
  2159.     moveq    #$20,d2
  2160.     moveq    #9,d1
  2161. .clr    move.b    d2,(a0)+
  2162.     dbra    d1,.clr    
  2163.     clr.b    (a0)
  2164.     tst.l    d0
  2165.     beq.s    .endc
  2166.     moveq    #10,d2
  2167.     moveq    #$30,d3    
  2168. .conv    divul.l    d2,d1:d0
  2169.     add.b    d3,d1
  2170.     move.b    d1,-(a0)
  2171.     cmp.w    d2,d0
  2172.     bcc.s    .conv
  2173.     tst.b    d0
  2174.     beq.s    .endc
  2175.     add.b    d3,d0
  2176.     move.b    d0,-(a0)
  2177. .endc    movem.l    (a7)+,d0-3/a0
  2178.     rts
  2179.  
  2180.  *-------------------*
  2181. ** KEYBOARD ROUTINES **
  2182.  *-------------------*
  2183.  
  2184.  
  2185. init_ikbd:    bsr    clear_ikbd
  2186.         moveq    #$11,d0
  2187.         bsr    send_ikbd
  2188.         move.l    $118.w,old118
  2189.         move.l    #my_ikbd,$118.w
  2190.         lea    key_table,a0
  2191.         moveq    #127,d0
  2192. .cl        clr.b    (a0)+
  2193.         dbra    d0,.cl
  2194.         rts
  2195.  
  2196. restore_ikbd:    bsr    clear_ikbd
  2197.         move.l    old118,$118.w
  2198.         rts
  2199.  
  2200. clear_ikbd:     btst    #0,$fffffc00.w        ;is ikbd data reg full?
  2201.                 beq.s   ikbd_ok            ;its empty so end
  2202.                 move.b  $fffffc02.w,D0        ;get ikbd data
  2203.                 bra.s   clear_ikbd        ;loop
  2204. ikbd_ok:        rts                             ;return
  2205.  
  2206. send_ikbd:      lea     $fffffc00.w,a0        ;ikbd control register
  2207. waitkeyready:   btst    #1,(a0)            ;is data reg empty?
  2208.                 beq.s   waitkeyready        ;no, wait for empty
  2209.                 move.b  d0,2(a0)        ;write to ikbd data reg
  2210.                 rts                             ;return
  2211.  
  2212. my_ikbd:    move.w    #$2500,sr        ;set ipl level
  2213.  
  2214.         movem.l    d0/a0-a1,-(a7)        ;save registers
  2215.         movea.w    #$fffffc00,a0        ;ikbd control registers
  2216.  
  2217.         move.b    (a0),d0            ;read control reg
  2218.         btst    #7,d0            ;int request?
  2219.         beq    endmykey        ;no
  2220.  
  2221. keyloop        moveq    #0,d0            ;clear d0
  2222.         move.b    2(a0),d0        ;read ikbd data
  2223.         tst.b    key_cntr        ;is this first byte
  2224.         beq    chk_head        ;yes, so check for header
  2225.         
  2226.         move.l    key_ptr(pc),a1        ;ptr into key storage area
  2227.         move.b    d0,(a1)+        ;store keyboard data
  2228.         move.l    a1,key_ptr        ;update ptr
  2229.         subq.b    #1,key_cntr        ;decrement data to get
  2230.         bne    last_key_check        ;more data to get
  2231.  
  2232. process_packet:
  2233.         lea    key_buffer,a1        ;start of key storage data
  2234.         moveq    #0,d0            ;clear d0
  2235.         move.b    (a1),d0            ;get first byte
  2236.         sub.l    #$f6,d0        ;minus default packet header value
  2237.         and.w    #$f,d0            ;mask off unwanted bits
  2238.         cmp.w    #10,d0            ;is it a valid packet
  2239.         bge.s    .noj            ;no
  2240.         jsr    ([key_handlers,d0.w*4])    ;jump to packet handler routine
  2241. .noj        bra    last_key_check        ;check for more key data
  2242.  
  2243. chk_head    cmp.w    #$f6,d0            ;is it packer header
  2244.         blt.s    store_key        ;no, store as a key
  2245.  
  2246.         move.b    d0,key_buffer        ;store packet header
  2247.         move.l    #key_buffer+1,key_ptr    ;init key pointer
  2248.         lea    packet_table,a1        ;packet table
  2249.         sub.b    #$f6,d0            ;d0 is offset
  2250.         move.b    (a1,d0.w),key_cntr    ;bytes of data to be read
  2251.         bra    last_key_check        ;get data
  2252.  
  2253. store_key
  2254.         IFNE    DEBUG
  2255.         movem.l    d0-a6,-(a7)
  2256.         lea    $f96.w,a0
  2257.         jsr    ([$1132.w])
  2258.         movem.l    (a7)+,d0-a6
  2259.         ENDC
  2260.         lea    key_table,a1        ;keypress table
  2261.         bclr    #7,d0            ;check 'release' bit
  2262.         beq.s    setkey            ;0, so set key press
  2263.         clr.b    (a1,d0.w)        ;key released
  2264.     IFNE    new_bss_ikbd
  2265.     cmp.b    #$3a,d0
  2266.     bne.s    .not_caps
  2267.     eor.b    #1,caps_lock
  2268. .not_caps
  2269.     ENDC
  2270.         bra.s    last_key_check        ;get key data
  2271. setkey        st.b    (a1,d0.w)        ;set key pressed
  2272.         st.b    key_pressed
  2273.         move.b    d0,current_key
  2274.     IFNE    new_bss_ikbd
  2275.     move.b    d0,bss_key
  2276.     ENDC
  2277.  
  2278. last_key_check:    move.b    (a0),d0        ;read ikbd control
  2279.         btst    #0,d0        ;more data to read?
  2280.         bne    keyloop        ;yes, so process it
  2281. endmykey    movem.l    (a7)+,d0/a0-1    ;restore registers
  2282.         bclr    #6,$fffffa11.w    ;signal end of ikbd interrupt
  2283.         rte
  2284.  
  2285. packet_table:
  2286.         dc.b    1    ;$f6 - keyboard packet
  2287.         dc.b    5    ;$f7 - absolute mouse packet
  2288.         dc.b    2    ;$f8 - relative mouse position / no buttons
  2289.         dc.b    2    ;$f9 - relative mouse / left button
  2290.         dc.b    2    ;$fa - relative mouse / right button
  2291.         dc.b    2    ;$fb - relative mouse / both buttons
  2292.         dc.b    6    ;$fc - time of day
  2293.         dc.b    2    ;$fd - joystick report
  2294.         dc.b    1    ;$fe - joystick 0 event
  2295.         dc.b    1    ;$ff - joystick 1 event
  2296.         even
  2297.  
  2298. key_handlers:
  2299.         dc.l    keyboard_packet_handler    ;$f6
  2300.         dc.l    absolute_mouse_handler    ;$f7
  2301.         dc.l    relative_mouse_handler    ;$f8
  2302.         dc.l    relative_mouse_handler    ;$f9
  2303.         dc.l    relative_mouse_handler    ;$fa
  2304.         dc.l    relative_mouse_handler    ;$fb
  2305.         dc.l    time_of_day_handler    ;$fc
  2306.         dc.l    joystick_report_handler    ;$fd
  2307.         dc.l    joystick0_handler    ;$fe
  2308.         dc.l    joystick1_handler    ;$ff
  2309.  
  2310. keyboard_packet_handler:
  2311.         moveq    #0,d0            ;clear d0
  2312.         move.b    1(a0),d0        ;get key
  2313.         bclr    #7,d0            ;key pressed?
  2314.         beq.s    .setkey            ;yes, set it
  2315.         clr.b    (key_table,d0.w)    ;indicate key release
  2316.     IFNE    new_bss_ikbd
  2317.     cmp.b    #$3a,d0
  2318.     bne.s    .not_caps
  2319.     eor.b    #1,caps_lock
  2320. .not_caps
  2321.     ENDC
  2322.         rts                             ;return
  2323. .setkey        st.b    (key_table,d0.w)    ;clear key
  2324.         st.b    key_pressed
  2325.         move.b    d0,current_key
  2326.     IFNE    new_bss_ikbd
  2327.     move.b    d0,bss_key
  2328.     ENDC
  2329.         rts                             ;return
  2330.  
  2331. absolute_mouse_handler:            ;no absolute mouse handler!
  2332. time_of_day_handler:            ;no time of day handler!
  2333. joystick_report_handler:
  2334.         move.b    1(a1),j1_packet        ;get joystick 1 packet
  2335.         move.b    2(a1),j2_packet        ;get joystick 2 packet
  2336.         rts                             ;return
  2337.  
  2338. joystick0_handler:
  2339.         move.b    1(a1),j1_packet        ;save joystick 1 packet
  2340.         rts                             ;return
  2341.  
  2342. joystick1_handler:
  2343.         move.b    1(a1),j2_packet        ;save joystick 2 packet
  2344.         rts                             ;return
  2345.  
  2346. relative_mouse_handler:
  2347.         st.b    mouse_moved        ;indicate mouse moved
  2348.  
  2349.         move.b    (a1),d0            ;get mouse key info
  2350.         and.w    #%11,d0            ;isolate l+r buttons
  2351.         move.b    d0,mousek        ;save mouse key info
  2352.  
  2353. .nolimits    move.b    1(a1),d0        ;mouse x movement
  2354.         ext.w    d0            ;extend to signed word
  2355.         add.w    d0,mousex        ;update mouse x position
  2356.         move.b    2(a1),d0        ;mouse y movement
  2357.         ext.w    d0            ;extedn to signed word
  2358.         add.w    d0,mousey        ;update mouse y position
  2359. ;        rts                             ;return
  2360.  
  2361.         move.w    mousex,d0
  2362.         cmp.w    mousex_min,d0
  2363.         bgt.s    .xok1
  2364.         move.w    mousex_min,mousex
  2365.         bra.s    .xok2
  2366. .xok1        cmp.w    mousex_max,d0
  2367.         blt.s    .xok2
  2368.         move.w    mousex_max,mousex
  2369. .xok2        move.w    mousey,d0
  2370.         cmp.w    mousey_min,d0
  2371.         bgt.s    .yok1
  2372.         move.w    mousey_min,mousey
  2373.         bra.s    .yok2
  2374. .yok1        cmp.w    mousey_max,d0
  2375.         blt.s    .yok2
  2376.         move.w    mousey_max,mousey
  2377. .yok2        rts
  2378.  
  2379.         IFNE    new_bss_ikbd
  2380.  
  2381.     dc.l    'XBRA'
  2382.     dc.l    'BS13'
  2383. bss_trap_13:
  2384.     move.l    a7,a0            ;sp
  2385.     move.w    (a0),d0            ;get sr
  2386.     btst    #13,d0            ;super mode?
  2387.     beq.s    .user_mode        ;no user
  2388.     addq.l    #8,a0            ;get to parameters
  2389.     bra.s    .cont            ;continue
  2390. .user_mode    
  2391.     move.l    USP,a0            ;user stack ptr
  2392. .cont    cmp.w    #$b,(a0)        ;my kbshift
  2393.     beq    my_kbshift        ;yes
  2394. old_bss_trap_13
  2395.     jmp    "RGOD"
  2396.         
  2397. my_kbshift:    move.w    2(a0),d0
  2398.         bpl    set_kbshift
  2399.         bsr    get_kbshift
  2400.         rte
  2401.         
  2402. get_kbshift        
  2403. .read        tst.b    key_table+$36    ;right_shift
  2404.         beq.s    .nors
  2405.         bset    #0,d0
  2406. .nors        tst.b    key_table+$2a    ;right_shift
  2407.         beq.s    .nols
  2408.         bset    #1,d0
  2409. .nols        tst.b    key_table+$1d
  2410.         beq.s    .no_ctl
  2411.         bset    #2,d0
  2412. .no_ctl        tst.b    key_table+$38    ;right_shift
  2413.         beq.s    .noalt
  2414.         bset    #3,d0
  2415.         tst.b    key_table+$47
  2416.         beq.s    .no_clr
  2417.         bset    #5,d0
  2418. .no_clr        tst.b    key_table+$52    
  2419.         beq.s    .no_ins
  2420.         bset    #6,d0
  2421. .no_ins        
  2422. .noalt        tst.b    caps_lock    ;right_shift
  2423.         beq.s    .nocaps
  2424.         bset    #4,d0
  2425. .nocaps        rts
  2426.  
  2427. set_kbshift    lsr.b    d0
  2428.         bcc.s    .no_rs
  2429.         st.b    key_table+$36
  2430. .no_rs        lsr.b    d0
  2431.         bcc.s    .no_ls
  2432.         st.b    key_table+$2a
  2433. .no_ls        lsr.b    d0
  2434.         bcc.s    .no_ctl
  2435.         st.b    key_table+$1d
  2436. .no_ctl        lsr.b    d0
  2437.         bcc.s    .no_alt
  2438.         st.b    key_table+$38
  2439. .no_alt        lsr.b    d0
  2440.         bcc.s    .no_caps
  2441.         st.b    caps_lock
  2442. .no_caps    lsr.b    d0
  2443.         bcc.s    .no_clr
  2444.         st.b    key_table+$47
  2445.         st.b    key_table+$38
  2446. .no_clr        lsr.b    d0
  2447.         bcc.s    .no_ins
  2448.         st.b    key_table+$52
  2449.         st.b    key_table+$38
  2450. .no_ins        rte
  2451.  
  2452. bss_shift_scan_code_table:
  2453. *                0123456789ABCDEF
  2454.     dc.b    '⓪⓪!"£$%^&*()_+⓪⓪'
  2455.     dc.b    'QWERTYUIOP{}⓪⓪AS'
  2456.     dc.b    'DFGHJKL:@¯⓪~ZXCV'
  2457.     dc.b    'BNM<>?⓪⓪⓪ ⓪⓪⓪⓪⓪⓪'
  2458.     dc.b    '⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪-⓪⓪⓪+⓪'    
  2459.     dc.b    '⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪'
  2460.     dc.b    '|⓪⓪()/*789456123'
  2461.     dc.b    '0.⓪'
  2462.     even
  2463.  
  2464. bss_scan_code_table:
  2465. *                0123456789ABCDEF
  2466.     dc.b    '⓪⓪1234567890-=⓪⓪'
  2467.     dc.b    'qwertyuiop[]⓪⓪as'
  2468.     dc.b    "dfghjkl;'`⓪#zxcv"
  2469.     dc.b    'bnm,./⓪⓪⓪ ⓪⓪⓪⓪⓪⓪'
  2470.     dc.b    '⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪-⓪⓪⓪+⓪'    
  2471.     dc.b    '⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪⓪'
  2472.     dc.b    '\⓪⓪()/*789456123'
  2473.     dc.b    '0.⓪'
  2474.     even
  2475.  
  2476.     
  2477. caps_lock    ds.b    1
  2478. bss_key        ds.b    1
  2479.         even
  2480.  
  2481.     dc.l    'XBRA'
  2482.     dc.l    'BSS1'
  2483. bss_trap_1:
  2484.     move.l    a7,a0            ;sp
  2485.     move.w    (a0),d0            ;get sr
  2486.     btst    #13,d0            ;super mode?
  2487.     beq.s    .user_mode        ;no user
  2488.     addq.l    #8,a0            ;get to parameters
  2489.     bra.s    .cont            ;continue
  2490. .user_mode    
  2491.     move.l    USP,a0            ;user stack ptr
  2492. .cont    cmp.w    #$6,(a0)        ;my kbshift
  2493.     bne    bss_trap_1        ;yes
  2494.     cmp.w    #$ff,2(a0)
  2495.     beq    my_crawio
  2496. old_bss_trap_1
  2497.     jmp    "RGOD"
  2498.  
  2499. my_crawio
  2500.     moveq    #0,d0
  2501.     tst.b    bss_key
  2502.     beq    end_crawio
  2503.     bsr    get_kbshift
  2504.     lea    bss_scan_code_table,a0
  2505.     bftst    d0{30:2}
  2506.     beq.s    .non_shift
  2507.     lea    bss_shift_scan_code_table,a0
  2508. .non_shift
  2509.     lsl.w    #8,d0
  2510.     moveq    #0,d1
  2511.     move.b    bss_key,d1
  2512.     move.b    d1,d0
  2513.     swap    d0
  2514.     move.b    (a0,d1.w),d1
  2515.     cmp.b    #'⓪',d1
  2516.     bne.s    .non_ascii
  2517.     move.b    d1,d0
  2518. .non_ascii
  2519.     clr.b    bss_key
  2520. end_crawio
  2521.     rte
  2522.  
  2523.     ENDC
  2524.  
  2525. temp_vbl:    addq.l    #1,$466.w
  2526.         rte
  2527.         
  2528. ***************************************************************************
  2529.     DATA
  2530. ***************************************************************************
  2531.     even
  2532.  
  2533. my_vector_table_name
  2534.     dc.l    "PINK"
  2535. my_vector_table:
  2536.     
  2537. o    set    0
  2538.     rept    $100
  2539.     dc.l    my_vector_jump+o
  2540. o    set    o+6
  2541.     endr
  2542.  
  2543. my_vector_jump:
  2544. o    set    0
  2545.     rept    $100
  2546.     jmp    ([o.w])
  2547. o    set    o+4
  2548.     endr
  2549.  
  2550. tiny_font    incbin    g:\ripper\tinyfnt.bin
  2551.         even
  2552.  
  2553. Videl_640_200_2
  2554.     dc.l    640*200/8+256            * General
  2555.     dc.w    0,40,0,$400
  2556.     dc.w    0                                        * Flag Ordre
  2557.  
  2558.     dc.w    510,409,80,1007,160,434,0,0    * RGB
  2559.     dc.w    625,613,47,127,527,619
  2560.     dc.w    $181,%0100
  2561.  
  2562.     dc.w    198,141,21,627,80,150,0,0    * VGA 47 Hz
  2563.      dc.w    1337,1300,100,315,1115,1333
  2564.     dc.w    $186,%1001
  2565.  
  2566. reinstall_adrs:
  2567.     dc.w    line_a_ex
  2568.     dc.l    $28,new_line_a,old_line_a+2
  2569.     dc.w    line_f_ex
  2570.     dc.l    $2c,new_line_f,old_line_f+2
  2571.     dc.w    trap_1_ex
  2572.     dc.l    $84,new_trap_1,old_trap_1+2
  2573.     dc.w    trap_2_ex
  2574.     dc.l    $88,new_trap_2,old_trap_2+2
  2575.     dc.w    trap_13_ex
  2576.     dc.l    $b4,new_trap_13,old_trap_13+2
  2577.     dc.w    trap_14_ex
  2578.     dc.l    $b8,new_trap_14,old_trap_14+2
  2579.     dc.w    hbl_ex
  2580.     dc.l    $68,new_hbl,old_hbl+2
  2581.     dc.w    vbl_ex
  2582.     dc.l    $70,new_vbl,old_vbl+2
  2583.     dc.w    trace_ex
  2584.     dc.l    $24,new_trace,old_trace+2
  2585.     dc.w    -1
  2586.  
  2587.  
  2588. custom_adrs
  2589.     dc.w    timer_a_ex
  2590.     dc.l    install_timer_a
  2591.     dc.w    timer_b_ex
  2592.     dc.l    install_timer_b
  2593.     dc.w    timer_c_ex
  2594.     dc.l    install_timer_c
  2595.     dc.w    timer_d_ex
  2596.     dc.l    install_timer_d
  2597.     dc.w    ikbd_ex
  2598.     dc.l    install_ikbd
  2599.     dc.w    blitter_ex
  2600.     dc.l    install_blitter
  2601.     dc.w    fdi_ex
  2602.     dc.l    install_fdi
  2603.     dc.w    reset_ex
  2604.     dc.l    install_reset
  2605.     dc.w    vbl_q_ex
  2606.     dc.l    install_vbl_queue
  2607.     dc.w    alt_help_ex
  2608.     dc.l    install_alt_help
  2609.     dc.w    mono_ex
  2610.     dc.l    install_mono
  2611.     dc.w    error_ex
  2612.     dc.l    install_errors
  2613.     dc.w    rs232_ex
  2614.     dc.l    install_rs232
  2615.     dc.w    mmu_ex
  2616.     dc.l    install_mmu
  2617. ;    dc.w    trace_ex
  2618. ;    dc.l    install_trace
  2619.     dc.w    -1
  2620.  
  2621. error_adrs:
  2622.     dc.l    $8,new_bus_error,old_bus_error+2
  2623.     dc.l    $c,new_address_error,old_address_error+2
  2624.     dc.l    $10,new_illegal,old_illegal+2
  2625.     dc.l    $14,new_divide0,old_divide0+2
  2626.     dc.l    $18,new_chk,old_chk+2
  2627.     dc.l    $1c,new_trapv,old_trapv+2
  2628.     dc.l    $20,new_priv,old_priv+2
  2629.     dc.l    $34,new_coprovi,old_coprovi+2
  2630.     dc.l    $38,new_format,old_format+2
  2631.     dc.l    $3c,new_uninit,old_uninit+2
  2632.     dc.l    $60,new_spurious,old_spurious+2
  2633.     dc.l    -1
  2634.  
  2635. rs232_adrs:
  2636.     dc.l    $100,new_rs232_cb,old_rs232_cb+2
  2637.     dc.l    $104,new_rs232_cd,old_rs232_cd+2
  2638.     dc.l    $108,new_rs232_cts,old_rs232_cts+2
  2639.     dc.l    $124,new_rs232_te,old_rs232_te+2
  2640.     dc.l    $128,new_rs232_tbe,old_rs232_tbe+2
  2641.     dc.l    $12c,new_rs232_re,old_rs232_re+2
  2642.     dc.l    $130,new_rs232_rbf,old_rs232_rbf+2
  2643.     dc.l    $138,new_rs232_ring,old_rs232_ring+2
  2644.     dc.l    -1
  2645.  
  2646. mmu_adrs:
  2647.     dc.l    $e0,new_mmu_config,old_mmu_config+2
  2648.     dc.l    $e4,new_mmu_illegal,old_mmu_illegal+2
  2649.     dc.l    $e8,new_mmu_address,old_mmu_address+2
  2650.     dc.l    -1
  2651.  
  2652.  
  2653.  
  2654. ripper_txt
  2655. *                123456789 123456
  2656.     dc.b    "RESERVOIR RIPPER",13
  2657.     dc.b    "----------------",0
  2658. coder_txt
  2659.     dc.b    "CODED BY MR PINK",0
  2660. rg_txt
  2661. *                123456789 123456789 123
  2662.     dc.b    "(C) 1995 RESERVOIR GODS",0
  2663. menu_txt
  2664.     dc.b    "[F1]  VIEW SCREEN",13
  2665.     dc.b    "[F2]  VECTOR MENU",13
  2666.     dc.b    "[F3]  SAVE SCREEN (RIP)",13
  2667.     dc.b    "[F4]  SAVE SCREEN (GOD)",13,13
  2668.     dc.b    "[F10] EXIT RIPPER",13
  2669.     dc.b    0
  2670.  
  2671. st_txt        dc.b    "ST",0
  2672. falcon_txt    dc.b    "FALCON",0
  2673.  
  2674. variables_txt:
  2675.  
  2676. *                0         1         2         3         4         5         6         7         8
  2677. *                 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
  2678.     dc.b    "COLS:               X:        Y:        PAL: ",13
  2679.     dc.b    "STWIDTH:      FALWIDTH:      ST-SHIFT:      SP-SHIFT:      HSCROLL:      SYNC:",13
  2680.     dc.b    "HHT:      HBB:      HBE:      HDB:      HDE:      HSS:      HFS:      HEE:",13
  2681.     dc.b    "VFT:      VBB:      VBE:      VDB:      VDE:      VSS:      VCL:      VCO:",0
  2682.     even
  2683.  
  2684. word_txts
  2685.     dc.l    pic_x
  2686.     dc.w    6*23,0
  2687.     dc.l    pic_y
  2688.     dc.w    6*33,0
  2689.  
  2690.     dc.l    screen_vars+42        ;st width
  2691.     dc.w    6*9,1
  2692.     dc.l    screen_vars+40        ;030 width
  2693.     dc.w    6*24,1
  2694.     dc.l    screen_vars+36        ;sp shift
  2695.     dc.w    6*54,1
  2696.     dc.l    0
  2697.  
  2698. byte_txts
  2699.     dc.l    screen_vars+44        ;st shift
  2700.     dc.w    6*39,1
  2701.     dc.l    screen_vars+3        ;hscroll
  2702.     dc.w    6*68,1
  2703.     dc.l    screen_vars+32        ;sync hz
  2704.     dc.w    6*79,1
  2705.     dc.l    0
  2706.  
  2707.  
  2708.  
  2709. intro_txt
  2710.     dc.b    27,"E"
  2711. *                123456789 123456789 12346789 123456789
  2712.     dc.b    "           RESERVOIR RIPPER",13,10
  2713.     dc.b    "           ----------------",13,10,13,10
  2714.     dc.b    "           CODED BY MR PINK",13,10,13,10
  2715.     dc.b    "       (C) 1995 RESERVOIR GODS"
  2716.     dc.b    0
  2717.     even
  2718.  
  2719. vecs_x    dc.l    34*6,52*6,69*6
  2720.  
  2721.  
  2722. vector_menu_txt:
  2723. *                         1         2         3         4         5        6
  2724. *                123456789 123456789 123456789 123456789 123456789 123*5789 123456789
  2725.     dc.b    "                                         VECTOR INSTALLATION MENU",13
  2726.     dc.b    "                                         ------------------------",13,13,13
  2727.     dc.b    "KEY  VECTOR                   INSTALL          REINSTALL          RESTORE",13
  2728.     dc.b    "---  ------                   -------          -[SHIFT]-          -[ALT]-",13,13
  2729.     DC.B    "F1   TIMER A",13
  2730.     DC.B    "F2   TIMER B",13
  2731.     DC.B    "F3   TIMER C",13
  2732.     DC.B    "F4   TIMER D",13
  2733.     DC.B    "F5   VBL",13
  2734.     DC.B    "F6   VBL QUEUE",13
  2735.     DC.B    "F7   TRAP #1",13
  2736.     DC.B    "F8   TRAP #2",13
  2737.     DC.B    "F9   TRAP #13",13
  2738.     DC.B    "F10  TRAP #14",13
  2739.     DC.B    "1    IKBD",13
  2740.     DC.B    "2    BLiTTER DONE",13
  2741.     DC.B    "3    LINE A",13
  2742.     DC.B    "4    LINE F",13
  2743.     DC.B    "5    HBL",13
  2744.     DC.B    "6    ERROR EXEPTIONS",13
  2745.     DC.B    "7    RS-232 INTERRUPTS",13
  2746.     DC.B    "8    MONO MONITOR DETECT",13
  2747.     DC.B    "9    MMU VECTORS",13
  2748.     DC.B    "0    TRACE EXCEPTION",13
  2749.     DC.B    "Q    ALT HELP",13
  2750.     DC.B    "W    FLOPPY/HD INTERRUPT",13
  2751.     DC.B    "E    RESET",13
  2752.     dc.b    "R    MOVE VBR",13,13
  2753. *                         1         2         3         4         5        6
  2754. *                123456789 123456789 123456789 123456789 123456789 123*5789 123456789 123456789
  2755.     dc.b    "         [#] TOGGLE ALL                [SPACE] EXIT MENU            [ESC] CANCEL"
  2756.     dc.b    0
  2757.  
  2758. space_txt    dc.b    ' ',0
  2759. star_txt    dc.b    '*',0
  2760.  
  2761. on_txt    dc.b    27,"Y"
  2762. on_y    dc.b    32
  2763. on_x    dc.b    32
  2764.     dc.b    "[ON] ",0
  2765. off_txt    dc.b    27,"Y"
  2766. off_y    dc.b    32
  2767. off_x    dc.b    32
  2768.     dc.b    "[OFF]",0
  2769.  
  2770. enter_file_txt    dc.b    "ENTER FILENAME:",0
  2771. single_string    dc.b    'A',0
  2772.  
  2773.  
  2774. v0_txt    dc.b    "TIMER A",0
  2775. v1_txt    dc.b    "TIMER B",0
  2776. v2_txt    dc.b    "TIMER C",0
  2777. v3_txt    dc.b    "TIMER D",0
  2778. v4_txt    dc.b    "VBL",0
  2779. v5_txt    dc.b    "VBL QUEUE",0
  2780. v6_txt    dc.b    "TRAP #1",0
  2781. v7_txt    dc.b    "TRAP #2",0
  2782. v8_txt    dc.b    "TRAP #13",0
  2783. v9_txt    dc.b    "TRAP #14",0
  2784. v10_txt    dc.b    "IKBD",0
  2785. v11_txt    dc.b    "BLITTER",0
  2786. v12_txt    dc.b    "LINE A",0
  2787. v13_txt    dc.b    "LINE F",0
  2788. v14_txt    dc.b    "HBL",0
  2789. v15_txt    dc.b    "ERROR",0
  2790. v16_txt    dc.b    "RS232",0
  2791. v17_txt    dc.b    "MONO",0
  2792. v18_txt    dc.b    "MMU",0
  2793. v19_txt    dc.b    "TRACE",0
  2794. v20_txt    dc.b    "ALT_HELP",0
  2795. v21_txt    dc.b    "FDI",0
  2796. v22_txt    dc.b    "RESET",0
  2797.  
  2798. entry_txt    dc.b    "ENTERED VIA:",0
  2799.     even
  2800.  
  2801. v_txt_adrs:
  2802.     dc.l    v0_txt
  2803.     dc.l    v1_txt
  2804.     dc.l    v2_txt
  2805.     dc.l    v3_txt
  2806.     dc.l    v4_txt
  2807.     dc.l    v5_txt
  2808.     dc.l    v6_txt
  2809.     dc.l    v7_txt
  2810.     dc.l    v8_txt
  2811.     dc.l    v9_txt
  2812.     dc.l    v10_txt
  2813.     dc.l    v11_txt
  2814.     dc.l    v12_txt
  2815.     dc.l    v13_txt
  2816.     dc.l    v14_txt
  2817.     dc.l    v15_txt
  2818.     dc.l    v16_txt
  2819.     dc.l    v17_txt
  2820.     dc.l    v18_txt
  2821.     dc.l    v19_txt
  2822.     dc.l    v20_txt
  2823.     dc.l    v21_txt
  2824.     dc.l    v22_txt
  2825.  
  2826. gemdos_errors:
  2827.     dc.l    -1000,frerr
  2828.     dc.l    -1001,fwerr
  2829.  
  2830.     dc.l    -32,einvfn
  2831.     dc.l    -33,efilnf
  2832.     dc.l    -34,epthnf
  2833.     dc.l    -36,eaccdn
  2834.     dc.l    -37,eihndl
  2835.     dc.l    -39,ensmem
  2836.     dc.l    -40,eimba
  2837.     dc.l    -46,edrive
  2838.     dc.l    -48,ensame
  2839.     dc.l    -49,enmfil
  2840.     dc.l    -58,elocked
  2841.     dc.l    -59,enslock
  2842.     dc.l    -64,erange
  2843.     dc.l    -65,eintrn
  2844.     dc.l    -66,eplfmt
  2845.     dc.l    -67,egsbf
  2846.     dc.l    -80,eloop
  2847.     dc.l    -200,emount
  2848. end_gemdos_errors
  2849.  
  2850. einvfn:    dc.b    "INVALID FUNCTION",0
  2851. efilnf:    dc.b    "FILE NOT FOUND",0
  2852. epthnf:    dc.b    "PATH NOT FOUND",0
  2853. eaccdn: dc.b    "ACCESS DENIED",0
  2854. eihndl: dc.b    "INVALID HANDLE",0
  2855. enhndl:    dc.b    "NO MORE HANDLES",0
  2856. ensmem:    dc.b    "OUT OF MEMORY",0
  2857. eimba:    dc.b    "INVALID MEMORY BLOCK ADDRESS",0
  2858. edrive:    dc.b    "INVALID DRIVE",0
  2859. ensame:    dc.b    "CROSS DEVICE RENAME",0
  2860. enmfil:    dc.b    "NO MORE FILES",0
  2861. elocked: dc.b    "RECORD IS ALREADY LOCKED",0
  2862. enslock: dc.b    "INVALID LOCK REMOVAL REQUEST",0
  2863. erange:    dc.b    "RANGE ERROR",0
  2864. eintrn: dc.b    "INTERNAL ERROR",0
  2865. eplfmt: dc.b    "INVALID PROGRAM LOAD FORMAT",0
  2866. egsbf: dc.b    "MEMORY BLOCK GROWTH FAILURE",0
  2867. eloop: dc.b    "TOO MANY SYMBOLIC LINKS",0
  2868. emount: dc.b    "MOUNT POINT CROSSED",0
  2869. frerr:    dc.b    "FILE READ ERROR",0
  2870. fwerr:    dc.b    "FILE WRITE ERROR",0
  2871. unerr:    dc.b    "UNKNOWN ERROR",0
  2872.  
  2873. scan_code_table:
  2874. *                0123456789ABCDEF
  2875.     dc.b    '**1234567890_=**'
  2876.     dc.b    'QWERTYUIOP[]**AS'
  2877.     dc.b    'DFGHJKL:,`*#ZXCV'
  2878.     dc.b    'BNM,./*** ******'
  2879.     dc.b    '**********-***+*'    
  2880.     dc.b    '****************'
  2881.     dc.b    '\**()/*789456123'
  2882.     dc.b    '0.*'
  2883.     even
  2884.  
  2885. res_txts:
  2886.     dc.l    two_colour_txt
  2887.     dc.l    four_colour_txt
  2888.     dc.l    sixteen_colour_txt
  2889.     dc.l    ep_colour_txt
  2890.     dc.l    t_colour_txt
  2891.  
  2892. two_colour_txt:
  2893.     dc.b    "2 COLOUR",0
  2894. four_colour_txt:
  2895.     dc.b    "4 COLOUR",0
  2896. sixteen_colour_txt:
  2897.     dc.b    "16 COLOUR",0
  2898. ep_colour_txt
  2899.     dc.b    "256 COLOUR",0
  2900. t_colour_txt
  2901.     dc.b    "TRUE COLOUR",0
  2902.  
  2903. long_string
  2904.     dc.b    '0123456789',0
  2905.  
  2906. reg_string    dc.b    "A0 =",0
  2907.  
  2908.     even
  2909.  
  2910. new_adrs:
  2911.     dc.w    error_ex,$8
  2912.     dc.l    new_bus_error
  2913.  
  2914.     dc.w    line_a_ex,$28
  2915.     dc.l    new_line_a
  2916.  
  2917.     dc.w    line_f_ex,$2c
  2918.     dc.l    new_line_f
  2919.  
  2920.     dc.w    hbl_ex,$68
  2921.     dc.l    new_hbl
  2922.  
  2923.     dc.w    vbl_ex,$70
  2924.     dc.l    new_vbl
  2925.  
  2926.     dc.w    trap_1_ex,$84
  2927.     dc.l    new_trap_1
  2928.  
  2929.     dc.w    trap_2_ex,$88
  2930.     dc.l    new_trap_2
  2931.  
  2932.     dc.w    trap_13_ex,$b4
  2933.     dc.l    new_trap_13
  2934.  
  2935.     dc.w    trap_14_ex,$b8
  2936.     dc.l    new_trap_14
  2937.  
  2938.     dc.w    mmu_ex,$e0
  2939.     dc.l    new_mmu_config
  2940.     
  2941.     dc.w    rs232_ex,$100
  2942.     dc.l    new_rs232_cb
  2943.  
  2944.     dc.w    blitter_ex,$10c
  2945.     dc.l    new_blitter
  2946.     
  2947.     dc.w    timer_d_ex,$110
  2948.     dc.l    new_timer_d
  2949.  
  2950.     dc.w    timer_c_ex,$114
  2951.     dc.l    new_timer_c
  2952.  
  2953.     dc.w    ikbd_ex,$118
  2954.     dc.l    new_ikbd
  2955.  
  2956.     dc.w    fdi_ex,$11c
  2957.     dc.l    new_fdi
  2958.  
  2959.     dc.w    timer_b_ex,$120
  2960.     dc.l    new_timer_b
  2961.  
  2962.     dc.w    timer_a_ex,$134
  2963.     dc.l    new_timer_a
  2964.  
  2965.     dc.w    mono_ex,$13c
  2966.     dc.l    new_mono
  2967.  
  2968.     dc.w    alt_help_ex,$502
  2969.     dc.l    new_alt_help
  2970.     
  2971.     dc.w    reset_ex,$42a
  2972.     dc.l    new_reset
  2973.  
  2974.     dc.w    trace_ex,$24
  2975.     dc.l    new_trace
  2976.  
  2977.     dc.w    -1
  2978.  
  2979. key_ptr:    dc.l     key_buffer
  2980.  
  2981. ddir:  dc.b    "A:\*.*"
  2982.        ds.b    256
  2983.  
  2984. ***************************************************************************
  2985.     BSS
  2986. ***************************************************************************
  2987. god_mode        ds.b    1
  2988. new_config        ds.b    1
  2989. check_bit        ds.b    1
  2990. vec_family        ds.b    1
  2991. v_toggle_mode        ds.b    1
  2992. vga_flag        ds.b    1
  2993. current_vec        ds.b    1
  2994. begin_ripping_flag    ds.b    1
  2995. reinstall_flag        ds.b    1
  2996. mouse_moved    ds.b    1
  2997. key_pressed    ds.b    1
  2998. current_key    ds.b    1
  2999. j1_packet:    ds.b    1
  3000. j2_packet:    ds.b    1
  3001.         even
  3002.  
  3003. new_sr        ds.w    1
  3004. cur_pic_adr    ds.l    1
  3005.  
  3006. cmd_adr        ds.l    1
  3007.  
  3008. god_head    ds.b    6
  3009.  
  3010. pic_adr        ds.l    1
  3011. magic        ds.l    1
  3012. rip_ver        ds.w    1
  3013. pic_res        ds.w    1
  3014. pic_x        ds.w    1
  3015. pic_y        ds.w    1
  3016. line_length    ds.w    1
  3017. pic_pal        ds.w    1
  3018.  
  3019. physic        ds.l    1
  3020. old118        ds.l    1
  3021. mfp_sei        ds.l    1
  3022.  
  3023. pic_length    ds.l    1
  3024. file_handle    ds.w    1
  3025. text_counter    ds.w    1
  3026. old_vmode:    ds.w    1
  3027.  
  3028. reset_adr    ds.l    1
  3029.  
  3030. mousek:            ds.w    1
  3031. mouse_key:        ds.w    1
  3032. mousex:            ds.w    1
  3033. mousey:            ds.w    1
  3034. mousex_min:        ds.w    1
  3035. mousex_max:        ds.w    1
  3036. mousey_min:        ds.w    1
  3037. mousey_max:        ds.w    1
  3038. key_cntr:        ds.w    1
  3039. key_table:        ds.b    128
  3040. key_buffer:          ds.b     256
  3041.  
  3042. file_name:        ds.b    256
  3043.  
  3044. old_system_vars    ds.b    256
  3045. cur_system_vars    ds.b    256
  3046.  
  3047. screen_vars    ds.b    50
  3048. pal_space    ds.b    (256*4)+(16*2)
  3049.  
  3050. colour_table    ds.w    256
  3051. install_bits    ds.b    24
  3052.         ds.b    1024
  3053. rip_stack    ds.l    4
  3054.         ds.b    256
  3055. screen_space    ds.b    16000
  3056. end_ripper