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