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