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

  1. **************************
  2. **** RESERVOIR RIPPER ****
  3. **** Coded by Mr Pink ****
  4. * (C)1995 RESERVOIR GODS *
  5. **************************
  6.  
  7. DEBUG    equ    0
  8. vars_y    equ    80
  9. regs_y    equ    40
  10.  
  11. start_ripper
  12.     move.l  a7,a5
  13.         move.l  4(a5),a5
  14.         move.l  12(a5),d0
  15.         add.l   20(a5),d0
  16.         add.l   28(a5),d0
  17.         add.l   #$100,d0
  18.         move.l  d0,-(sp)
  19.         move.l  a5,-(sp)
  20.         move    d0,-(sp)
  21.         move    #$4a,-(sp)
  22.         trap    #1
  23.         add.l   #12,sp
  24.  
  25.     clr.w    -(a7)
  26.     pea    $200000
  27.     trap    #1
  28.  
  29.  
  30.     move.w    #$59,-(a7)    ;get monitor
  31.     trap    #14
  32.     addq.l    #2,a7
  33.     cmp.w    #2,d0
  34.     bne.s    not_vga
  35.     st.b    vga_flag
  36. not_vga
  37.  
  38.     bsr    save_system
  39.  
  40.     IFNE    DEBUG
  41.     bsr    do_test
  42.     clr.w    -(a7)
  43.     trap    #1
  44.     ENDC
  45.  
  46.  
  47.     move.l    #start_ripper,$30.w
  48.     move.l    #end_ripper,$432.w
  49.  
  50.     dc.w    $a00a
  51.  
  52.     lea    intro_txt(pc),a0
  53.     bsr    gemdos_print
  54.     bsr    show_all_on_off_flags
  55.     bsr    do_menu
  56.     tst.w    d0
  57.     beq.s    do_tsr
  58.  
  59.     clr.w    -(a7)
  60.     trap    #1
  61.  
  62. do_tsr
  63.     bsr    save_system
  64.  
  65.     lea    install_bits,a0
  66.     lea    install_routines,a1
  67.     moveq    #12,d0    
  68. .george    tst.b    (a0,d0.w)
  69.     beq.s    .eq
  70.     movem.l    d0/a0-1,-(a7)
  71.     jsr    ([a1,d0.w*4])
  72.     movem.l    (a7)+,d0/a0-1
  73. .eq    dbra    d0,.george
  74.  
  75.     move.w    #0,-(a7)
  76.     move.l    #end_ripper-start_ripper+$100,-(a7)
  77.     move.w    #$31,-(a7)
  78.     trap    #1
  79.  
  80.     IFNE    DEBUG
  81. do_test:
  82.     move.w    #$2700,sr
  83.     lea    rip_stack,a7
  84.     bsr    save_screen_info
  85.     bsr    restore_system
  86.     move.w    #$2300,sr
  87.     bsr    save_pal
  88.     bsr    wait_vbl
  89.     bsr    init_screen
  90.     bsr    get_pic_info
  91.     bsr    print_ripper_menu_txt    
  92.     bsr    restore_screen_info
  93.     bsr    restore_system
  94.     rts
  95.     ENDC
  96.  
  97.  
  98. do_menu
  99.  
  100. .loop    bsr    wait_key    
  101.     swap    d0
  102.     cmp.b    #1,d0
  103.     beq    .exit
  104.     cmp.b    #$39,d0
  105.     beq    .install
  106.     cmp.b    #5,d0
  107.     bgt    .fkey
  108.     addq.w    #8,d0
  109.     bra    .toggle
  110. .fkey    sub.b    #$3b,d0
  111.     bmi.s    .loop
  112.     cmp.b    #$a,d0
  113.     bge.s    .loop
  114. .toggle
  115.     bsr    toggle_vector
  116.     bra.s    .loop
  117. .install        
  118.     moveq    #0,d0
  119.     rts
  120. .exit    moveq    #-1,d0
  121.     rts
  122.  
  123. toggle_vector
  124.     lea    on_txt,a0
  125.     cmp.w    #13,d0
  126.     bne.s    .vec
  127.     eor.b    #1,reinstall_flag
  128.     bra.s    .chk
  129. .vec    lea    install_bits,a1
  130.     eor.b    #1,(a1,d0.w)
  131. .chk    bne.s    .on
  132.     lea    off_txt,a0
  133. .on    add.w    #8+32,d0
  134.     move.b    d0,on_y
  135.     move.b    d0,off_y
  136.     bra    gemdos_print
  137.  
  138.  
  139. show_all_on_off_flags
  140.         lea    install_bits,a6
  141.         moveq    #12,d7
  142.         move.b    #15+32,on_x
  143.         move.b    #15+32,off_x
  144.         move.b    #8+32,off_y
  145.         move.b    #8+32,on_y
  146.  
  147. .loop        lea    off_txt(pc),a0
  148.         tst.b    (a6)+
  149.         beq.s    .on        
  150.         lea    on_txt(pc),a0
  151. .on        bsr    gemdos_print
  152.         addq.b    #1,on_y
  153.         addq.b    #1,off_y
  154.         dbra    d7,.loop
  155.         rts
  156.  
  157. gemdos_print:    pea    (a0)
  158.         move.w    #9,-(a7)
  159.         trap    #1
  160.         addq.w    #6,a7
  161.         rts
  162.  
  163. wait_key:    move.w    #$b,-(a7)    ;interogate keyboard
  164.         trap    #1
  165.         addq.l    #2,a7
  166.         tst    d0        ;is there junk in key buffer?
  167.         beq.s    cnecin        ;no, just wait for key
  168.         bsr.s    cnecin        ;clear key buffer
  169.         bra.s    wait_key    ;check buffer status
  170. cnecin:        move.w    #8,-(a7)    ;get key
  171.         trap    #1
  172.         addq.l    #2,a7        ;returned in D0
  173.         rts
  174.  
  175.  
  176. init_ripper:
  177.     move.l    a7,old_stack+2
  178.     lea    rip_stack,a7
  179.     move.w    sr,-(a7)
  180.     move.w    #$2700,sr
  181.     clr.b    begin_ripping_flag
  182.     bsr    save_screen_info
  183.     lea    cur_system_vars,a0
  184.     bsr    save_cur_system
  185.     bsr    restore_system
  186.     move.w    #$2300,sr
  187.     bsr    save_pal
  188.     bsr    wait_vbl
  189.     bsr    init_screen
  190.     bsr    init_ikbd
  191.     bsr    get_pic_info
  192.     bsr    print_ripper_menu_txt    
  193. do_ripper_menu:
  194.     tst.b    key_table+$3b
  195.     bne    show_screen
  196.     tst.b    key_table+$3c
  197.     bne    do_save_file
  198.     tst.b    key_table+$44
  199.     beq.s    do_ripper_menu
  200.     bsr    restore_ikbd
  201.     bsr    wait_vbl
  202.     bsr    restore_screen_info    
  203.     bsr    restore_pal
  204.     move.w    #$2700,sr
  205.     lea    cur_system_vars,a0
  206.     bsr    restore_cur_system
  207.     move.w    (a7)+,sr
  208. old_stack
  209.     lea    $12345678,a7
  210.     rts
  211.  
  212. print_ripper_menu_txt:
  213.  
  214.     lea    ripper_txt,a0
  215.     move.l    #320-16*3,d0
  216.     moveq    #0,d1
  217.     bsr    print_string
  218.  
  219.     lea    coder_txt,a0
  220.     move.l    #320-16*3,d0
  221.     moveq    #20,d1
  222.     bsr    print_string
  223.  
  224.     lea    rg_txt,a0
  225.     move.l    #320-23*3,d0
  226.     moveq    #30,d1
  227.     bsr    print_string
  228.  
  229.     lea    menu_txt,a0
  230.     moveq    #0,d0
  231.     moveq    #40,d1
  232.     bsr    print_string
  233.  
  234.     lea    entry_txt,a0
  235.     move.l    #320,d0
  236.     moveq    #40,d1
  237.     bsr    print_string
  238.  
  239.     moveq    #0,d0
  240.     move.b    current_vec,d0
  241.     move.l    (v_txt_adrs,d0.w*4),a0
  242.     move.l    #320+6*15,d0
  243.     moveq    #40,d1
  244.     bsr    print_string
  245.  
  246.     lea    variables_txt,a0
  247.     moveq    #0,d0
  248.     move.l    #vars_y,d1
  249.     bsr    print_string
  250.  
  251.     move.w    pic_res,d0
  252.     move.l    (res_txts,d0.w*4),a0
  253.     moveq    #6*6,d0
  254.     move.l    #vars_y,d1
  255.     bsr    print_string
  256.  
  257.  
  258.     lea    word_txts,a6
  259. .loop1    move.l    (a6)+,a0
  260.     cmpa.l    #0,a0
  261.     beq.    .el1
  262.     moveq    #0,d0
  263.     move.w    (a0),d0
  264.     bsr    conv_long_ascii
  265.     lea    long_string+6,a0
  266.     moveq    #0,d0
  267.     move.w    (a6)+,d0
  268.     move.w    (a6)+,d1
  269.     mulu    #6,d1
  270.     add.l    #vars_y,d1
  271.     pea    (a6)
  272.     bsr    print_string
  273.     move.l    (a7)+,a6
  274.     bra.s    .loop1    
  275.  
  276. .el1    lea    byte_txts,a6
  277. .loop2    move.l    (a6)+,a0
  278.     cmpa.l    #0,a0
  279.     beq.    .el2
  280.     moveq    #0,d0
  281.     move.b    (a0),d0
  282.     bsr    conv_long_ascii
  283.     lea    long_string+6,a0
  284.     moveq    #0,d0
  285.     move.w    (a6)+,d0
  286.     move.w    (a6)+,d1
  287.     mulu    #6,d1
  288.     add.l    #vars_y,d1
  289.     pea    (a6)
  290.     bsr    print_string
  291.     move.l    (a7)+,a6
  292.     bra.s    .loop2
  293.  
  294. .el2    lea    screen_vars+12,a6
  295.     moveq    #7,d7
  296.     moveq    #6*5,d6
  297. .loop3    moveq    #0,d0
  298.     move.w    (a6)+,d0
  299.     bsr    conv_long_ascii
  300.     lea    long_string+6,a0
  301.     move.l    d6,d0
  302.     move.l    #vars_y+6*2,d1
  303.     movem.l    d6-7/a6,-(a7)
  304.     bsr    print_string
  305.     movem.l    (a7)+,d6-7/a6
  306.     add.l    #6*10,d6
  307.     dbra    d7,.loop3
  308.  
  309.     moveq    #7,d7
  310.     moveq    #6*5,d6
  311. .loop4    moveq    #0,d0
  312.     move.w    (a6)+,d0
  313.     bsr    conv_long_ascii
  314.     lea    long_string+6,a0
  315.     move.l    d6,d0
  316.     move.l    #vars_y+6*3,d1
  317.     movem.l    d6-7/a6,-(a7)
  318.     bsr    print_string
  319.     movem.l    (a7)+,d6-7/a6
  320.     add.l    #6*10,d6
  321.     dbra    d7,.loop4
  322.  
  323.     rts
  324.  
  325.  
  326. show_screen
  327.     bsr    wait_vbl
  328.     bsr    restore_screen_info    
  329.     bsr    restore_pal
  330. .wt    tst.b    key_table+$3b
  331.     bne.s    .wt
  332. .wt2    tst.b    key_table+$3b
  333.     beq.s    .wt2
  334.  
  335.     bsr    wait_vbl
  336.     bsr    set_my_screen
  337.     bsr    set_resolution
  338.     bsr    set_my_pal
  339. .wt3    tst.b    key_table+$3b
  340.     bne.s    .wt3
  341.     bra    do_ripper_menu
  342.  
  343.  
  344. do_save_file
  345.     lea    enter_file_txt,a0
  346.     moveq    #0,d0
  347.     move.l    #160,d1
  348.     bsr    print_string
  349.     
  350. .wt1    tst.b    key_table+$3c
  351.     bne.s    .wt1
  352.  
  353.     bsr    enter_file_name
  354.     bmi    .err
  355.     bsr    save_file
  356. .err    bsr    clear_my_screen
  357.     bsr    print_ripper_menu_txt
  358.     bra    do_ripper_menu
  359.  
  360.  
  361. get_pic_info:
  362.     move.l    #'GRIP',magic
  363.     lea    screen_vars(pc),a0
  364.     bfextu    (a0){0:24},d0
  365.     move.l    d0,pic_adr
  366.     bsr    get_pic_res
  367.  
  368.     move.w    36(a0),d0        ;82AA - VDE
  369.     sub.w    34(a0),d0        ;82A8 - VDB
  370.     move.w    42(a0),d1        ;82C0 - VCO
  371.  
  372.     tst.b    vga_flag
  373.     bne.s    .int
  374.     btst    #1,d1            ;interlace mode
  375.     bne.s    .int            ;yes
  376.     lsr.w    d0
  377. .int
  378.     btst    #3,d1            ;quarter pixel mode
  379.     beq.s    .noq
  380.     lsr.w    d0
  381. .noq    btst    #2,d1            ;halve pixel mode?
  382.     beq.s    .noh
  383.     lsr.w    d0
  384. .noh    btst    #0,d1            ;line doubling?
  385.     beq.s    .nol
  386.     lsr.w    d0    
  387. .nol    
  388.     
  389. ;    tst.w    d1            ;interlace/double line off?
  390. ;    beq.s    .halve            ;yes, half size
  391. ;    btst    #0,d1            ;line doubling?
  392. ;    beq.s    .norm            ;no
  393. ;    lsr.w    d0            ;y size/2
  394. ;.halve    lsr.w    d0            ;y size/2
  395. .norm    move.w    d0,pic_y        ;store y size
  396.     mulu    6(a0),d0        ;line_width*y lines
  397.     add.l    d0,d0            ;*2 file length in bytes
  398.     move.l    d0,pic_length
  399.  
  400.  
  401. get_pic_res:
  402.     move.b    8(a0),d0            ;8260
  403.     move.w    10(a0),d1            ;8266
  404.     btst    #10,d1
  405.     bne    .two_colour
  406.     btst    #8,d1
  407.     bne    .true_colour
  408.     btst    #4,d1
  409.     bne    .eight_colour
  410.     tst.b    d0
  411.     beq    .sixteen_colour
  412.     cmp.b    #1,d0
  413.     beq    .four_colour
  414. .two_colour    
  415.     clr.w    pic_res
  416.     move.w    6(a0),d0        ;8210 - line width (words)
  417.     lsl.w    #4,d0            ;*16
  418.     move.w    d0,pic_x        ;x pixels
  419.     rts
  420. .four_colour
  421.     moveq    #62,d0
  422.     tst.b    vga_flag
  423.     beq.s    .nvga
  424.     moveq    #23,d0
  425. .nvga    cmp.w    12(a0),d0
  426.     bne    .sixteen_colour
  427.     move.w    #1,pic_res
  428.     move.w    6(a0),d0        ;8210 - line width (words)
  429.     lsl.w    #3,d0            ;*16
  430.     move.w    d0,pic_x        ;x pixels
  431.     rts
  432. .sixteen_colour
  433.     move.w    #2,pic_res
  434.     move.w    6(a0),d0        ;8210 - line width (words)
  435.     lsl.w    #2,d0            ;*4
  436.     move.w    d0,pic_x        ;x pixels
  437.     rts
  438. .eight_colour
  439.     move.w    #3,pic_res
  440.     move.w    6(a0),d0        ;8210 - line width (words)
  441.     add.w    d0,d0            ;*2
  442.     move.w    d0,pic_x        ;x pixels
  443.     rts
  444. .true_colour
  445.     move.w    #4,pic_res
  446.     move.w    6(a0),pic_x
  447. .cont    rts
  448.  
  449.  
  450. enter_file_name
  451.     clr.w    text_counter
  452.  
  453. .loop    clr.b    key_pressed
  454. .wk    tst.b    key_pressed
  455.     beq.s    .wk
  456.     move.b    current_key,d1
  457.     cmp.b    #$1c,d1
  458.     beq    .end_entry
  459.     cmp.b    #1,d1
  460.     beq    .quit_entry
  461.     cmp.b    #$e,d1
  462.     bne.s    .nback
  463.  
  464.     subq.w    #1,text_counter
  465.     bpl.s    .pls
  466.     clr.w    text_counter
  467. .pls    lea    single_string,a0
  468.     move.b    #' ',(a0)
  469.     move.w    text_counter,d0
  470.     mulu    #6,d0
  471.     move.l    #170,d1
  472.     bsr    print_string
  473.  
  474.     lea    file_name,a0
  475.     move.w    text_counter,d0
  476.     clr.b    (a0,d0.w)
  477.     bra    .loop
  478.  
  479. .nback    lea    single_string,a0
  480.     move.b    (scan_code_table,d1.w),d1
  481.     move.b    d1,(a0)
  482.     move.w    text_counter,d0
  483.     lea    file_name,a1
  484.     move.b    d1,(a1,d0.w)
  485.     mulu    #6,d0
  486.     move.l    #170,d1
  487.     bsr    print_string
  488.  
  489.     cmp.w    #640/6-1,text_counter
  490.     bge.s    .ge
  491.     addq.w    #1,text_counter
  492. .ge
  493.  
  494.     bra    .loop
  495.  
  496. .quit_entry
  497.     moveq    #-1,d0
  498.     rts
  499.  
  500. .end_entry
  501.     move.w    text_counter,d0
  502.     clr.b    (file_name+1,d0.w)
  503.     moveq    #0,d0
  504.     rts
  505.  
  506.  
  507. wait_vbl:
  508.     move.l    d0,-(a7)
  509.     move.l    $466.w,d0
  510. .wt    cmp.l    $466.w,d0
  511.     beq.s    .wt
  512.     move.l    (a7)+,d0
  513.     rts
  514.  
  515.  
  516.  
  517.  
  518. ************************
  519. * VECTOR SAVE ROUTINES *
  520. *************************
  521.  
  522. save_system:
  523.     lea    old_system_vars(pc),a0    
  524. save_cur_system
  525.     movec    cacr,d0
  526.     move.w    d0,(a0)+
  527.     move.l    $68.w,(a0)+            ; hbl
  528.     move.l    $70.w,(a0)+            ; vbl
  529.     move.l    $84.w,(a0)+            ; trap #1
  530.     move.l    $b4.w,(a0)+            ; trap #13
  531.     move.l    $b8.w,(a0)+            ; trap #14
  532.     move.l    $110.w,(a0)+            ; Timer D
  533.     move.l    $114.w,(a0)+            ; Timer C
  534.     move.l    $118.w,(a0)+            ; ikbd
  535.     move.l    $120.w,(a0)+            ; Timer B
  536.     move.l    $134.w,(a0)+            ; Timer A
  537.     move.l    $13c.w,(a0)+            ; mono detect
  538.     move.l    $456.w,(a0)+            ; vbl list ptr
  539.     move.l    $502.w,(a0)+            ; alt-help vector
  540.  
  541.     move.w    $ffff8900.w,(a0)+                ; Interruptions, Son DMA
  542.     move.b    $ffff8903.w,(a0)+                ; Start - High
  543.     move.b    $ffff8905.w,(a0)+                ; Start - Med
  544.     move.b    $ffff8907.w,(a0)+                ; Start - Low
  545.     move.b    $ffff890f.w,(a0)+                ; End - High
  546.     move.b    $ffff8911.w,(a0)+                ; End - Med
  547.     move.b    $ffff8913.w,(a0)+                ; End - Low
  548.     move.w    $ffff8920.w,(a0)+                ; Nb Voies, 8/16, Mono/Stereo
  549.     move.w    $ffff8930.w,(a0)+                ; Matrice : Sources
  550.     move.w    $ffff8932.w,(a0)+                ; Matrice : Destinations
  551.     move.w    $ffff8934.w,(a0)+                ; Prescales d'horloge
  552.     move.w    $ffff8936.w,(a0)+                ; Nb Voies Record,source ADDERIN
  553.     move.w    $ffff8938.w,(a0)+                ; Source ADC + Volumes entrées
  554.     move.w    $ffff893a.w,(a0)+                ; Volumes de Sortie
  555.  
  556.  
  557.     move.b    $fffffa07.w,(a0)+        ; iera
  558.     move.b    $fffffa09.w,(a0)+        ; ierb
  559.     move.b    $fffffa13.w,(a0)+        ; imra
  560.     move.b    $fffffa15.w,(a0)+        ; imrb
  561.     move.b    $fffffa17.w,(a0)+        ; vectore register
  562.     move.b    $fffffa19.w,(a0)+        ; Timer A control
  563.     move.b    $fffffa1b.w,(a0)+        ; Timer B control
  564.     move.b    $fffffa1d.w,(a0)+        ; Timer C & D control
  565.     move.b    $fffffa1f.w,(a0)+        ; Timer A data
  566.     move.b    $fffffa21.w,(a0)+        ; Timer B data
  567.     move.b    $fffffa23.w,(a0)+        ; Timer C data
  568.     move.b    $fffffa25.w,(a0)+        ; Timer D data
  569.     move.b    $ffff8007.w,(a0)+        ; 68030 Configuration 
  570.     rts
  571.  
  572. save_screen_info:
  573.     lea    screen_vars(pc),a0    ; Espace de sauvegarde
  574.     move.b    $ffff8201.w,(a0)+    ;0 Vidéo (poids fort)
  575.     move.b    $ffff8203.w,(a0)+    ;1 Vidéo (poids moyen)
  576.     move.b    $ffff820d.w,(a0)+    ;2 Vidéo (poids faible)
  577.     move.b    $ffff820a.w,(a0)+    ;3 Synchronisation vidéo
  578.     move.w    $ffff820e.w,(a0)+    ;4 Offset pour prochaine ligne
  579.     move.w    $ffff8210.w,(a0)+    ;6 Largeur d'une ligne en mots
  580.     move.b    $ffff8260.w,(a0)+    ;8 Résolution ST
  581.     move.b    $ffff8265.w,(a0)+    ;9 Décalage Pixel
  582.     move.w    $ffff8266.w,(a0)+    ;10 Résolution FALCON
  583.     move.w    $ffff8282.w,(a0)+    ;12 HHT-Synchro
  584.     move.w    $ffff8284.w,(a0)+    ;14 Fin du décodage de la ligne
  585.     move.w    $ffff8286.w,(a0)+    ;16 Début du décodage de la ligne
  586.     move.w    $ffff8288.w,(a0)+    ;18 Overscan gauche
  587.     move.w    $ffff828a.w,(a0)+    ;20 Overscan droit
  588.     move.w    $ffff828c.w,(a0)+    ;22 HSS-Synchro
  589.     move.w    $ffff828e.w,(a0)+    ;24 HFS
  590.     move.w    $ffff8290.w,(a0)+    ;26 HEE
  591.     move.w    $ffff82a2.w,(a0)+    ;28 VFT-Synchro
  592.     move.w    $ffff82a4.w,(a0)+    ;30 Fin du décodage de l'image
  593.     move.w    $ffff82a6.w,(a0)+    ;32 Début du décodage de l'image
  594.     move.w    $ffff82a8.w,(a0)+    ;34 VDB
  595.     move.w    $ffff82aa.w,(a0)+    ;36 VDE
  596.     move.w    $ffff82ac.w,(a0)+    ;38 VSS-Synchro
  597.     move.w    $ffff82c0.w,(a0)+    ;40 Reconnaissance ST/FALCON
  598.     move.w    $ffff82c2.w,(a0)+    ;42 VCO
  599.     rts
  600.  
  601. save_pal:
  602.     bsr    wait_vbl
  603.     lea    pal_space,a0
  604.     lea    $ffff8240.w,a1
  605.     moveq    #15,d0
  606. .save_st_pal
  607.     move.w    (a1)+,(a0)+
  608.     dbra    d0,.save_st_pal
  609.  
  610.     lea    $ffff9800.w,a1
  611.     move.w    #255,d0
  612. .save_falc_pal
  613.     move.l    (a1)+,(a0)+
  614.     dbra    d0,.save_falc_pal
  615.  
  616.  
  617.     rts
  618.  
  619. ***************************
  620. * SCREEN SETTING ROUTINES *
  621. ***************************
  622.  
  623. set_resolution
  624.     lea    videl_640_200_2(pc),a0
  625.  
  626.     move.b    #2,$ffff820a.w            ; Internal sync
  627.     clr.b    $ffff8265.w            ; Horizontal scroll reg=0
  628.     addq.l    #4,a0                ; skip screen_length
  629.     move.w    (a0)+,$ffff820e.w        ; line width
  630.     move.w    (a0)+,$ffff8210.w        ; Falcon line width
  631.     move.w    (a0)+,d0            ; Resolution ST
  632.     move.w    (a0)+,d1            ; Resolution FALCON
  633.  
  634.     move.w    d1,$ffff8266.w            ; Resolution FALCON
  635.     tst.w    (a0)+                ; falcon screen mode?
  636.     beq.s    FalconRez            ; yes
  637.     move.b    d0,$ffff8260.w            ; Resolution ST
  638.     move.w    -8(a0),$ffff8210.w        ; Fa;cpm line width
  639. FalconRez
  640.     btst.b    #7,$ffff8006.w            ; VGA monitor ?
  641.     Beq.s    R_Ok                ; no, rgb
  642.     adda.w    #16*2,a0            ; get to VGA data
  643. R_Ok
  644.     move.w    (a0)+,$ffff8282.w        ; HHT - Hold counter
  645.     move.w    (a0)+,$ffff8284.w        ; HBB - Border Begin
  646.     move.w    (a0)+,$ffff8286.w        ; HBE - Border end
  647.     move.w    (a0)+,$ffff8288.w        ; HDB - Display Begin
  648.     move.w    (a0)+,$ffff828a.w        ; HDE - Display End
  649.     move.w    (a0)+,$ffff828c.w        ; HSS - Synchro
  650.     move.w    (a0)+,$ffff828e.w        ; HFS
  651.     move.w    (a0)+,$ffff8290.w        ; HEE
  652.     move.w    (a0)+,$ffff82a2.w        ; VFT - Synchro
  653.     move.w    (a0)+,$ffff82a4.w        ; VBB - Border Begin
  654.     move.w    (a0)+,$ffff82a6.w        ; VBE - Border End
  655.     move.w    (a0)+,$ffff82a8.w        ; VDB - Display Begin
  656.     move.w    (a0)+,$ffff82aa.w        ; VDE - Display End
  657.     move.w    (a0)+,$ffff82ac.w        ; VSS-Synchro
  658.     move.w    (a0)+,$ffff82c0.w        ; FALCON resoultion indicator
  659.     move.w    (a0),$ffff82c2.w        ; resolution info
  660.  
  661.     rts
  662.  
  663.  
  664. init_screen:
  665.     lea    screen_space(pc),a0
  666.     move.l    a0,d0
  667.     clr.b    d0
  668.     lea    physic(pc),a1
  669.     move.l    d0,(a1)
  670.     bsr    wait_vbl
  671.     bsr    set_my_screen
  672.     bsr    set_resolution
  673.     bsr    clear_my_screen
  674.     bsr    set_my_pal
  675.     rts
  676.  
  677. set_my_screen:
  678.     lea    physic(pc),a1
  679.     movea.w    #$8201,a0    ;$fffff8201=screen address
  680.     move.b    1(a1),(a0)
  681.     move.b    2(a1),2(a0)    ;$fffff8203
  682.     move.b    3(a1),$C(a0)    ;$fffff820d
  683.     rts
  684.  
  685.     
  686. clear_my_screen
  687.     move.l    physic(pc),a1
  688.     move.l    #(640*200/8)/4-1,d0
  689. .cl    clr.l    (a1)+
  690.     dbra    d0,.cl
  691.     rts
  692.  
  693. set_my_pal:
  694.     lea    $ffff9800.w,a0
  695.     lea    $ffff8240.w,a1
  696.     moveq    #0,d0
  697.     move.l    d0,(a0)+
  698.     move.w    d0,(a1)+
  699.     moveq    #-1,d0
  700.     move.l    d0,(a0)+
  701.     move.w    d0,(a1)+
  702.     rts
  703.  
  704. ***************************
  705. * VECTOR RESTORE ROUTINES *
  706. ***************************
  707.  
  708. restore_system:
  709.     lea    old_system_vars(pc),a0    
  710. restore_cur_system:
  711.     move.w    (a0)+,d0
  712.     movec    d0,cacr
  713.     move.l    (a0)+,$68.w            ; hbl
  714.     move.l    (a0)+,$70.w            ; vbl
  715.     move.l    (a0)+,$84.w            ; trap #1
  716.     move.l    (a0)+,$b4.w            ; trap #13
  717.     move.l    (a0)+,$b8.w            ; trap #14
  718.     move.l    (a0)+,$110.w            ; Timer D
  719.     move.l    (a0)+,$114.w            ; Timer C
  720.     move.l    (a0)+,$118.w            ; ikbd
  721.     move.l    (a0)+,$120.w            ; Timer B
  722.     move.l    (a0)+,$134.w            ; Timer A
  723.     move.l    (a0)+,$13c.w            ; mono detect
  724.     move.l    (a0)+,$456.w            ; vbl list ptr
  725.     move.l    (a0)+,$502.w            ; alt-help vector
  726.  
  727.     move.w    (a0)+,$ffff8900.w                ; Interruptions, Son DMA
  728.     move.b    (a0)+,$ffff8903.w                ; Start - High
  729.     move.b    (a0)+,$ffff8905.w                ; Start - Med
  730.     move.b    (a0)+,$ffff8907.w                ; Start - Low
  731.     move.b    (a0)+,$ffff890f.w                ; End - High
  732.     move.b    (a0)+,$ffff8911.w                ; End - Med
  733.     move.b    (a0)+,$ffff8913.w                ; End - Low
  734.     move.w    (a0)+,$ffff8920.w                ; Nb Voies, 8/16, Mono/Stereo
  735.     move.w    (a0)+,$ffff8930.w                ; Matrice : Sources
  736.     move.w    (a0)+,$ffff8932.w                ; Matrice : Destinations
  737.     move.w    (a0)+,$ffff8934.w                ; Prescales d'horloge
  738.     move.w    (a0)+,$ffff8936.w                ; Nb Voies Record,source ADDERIN
  739.     move.w    (a0)+,$ffff8938.w                ; Source ADC + Volumes entrées
  740.     move.w    (a0)+,$ffff893a.w                ; Volumes de Sortie
  741.  
  742.  
  743.     move.b    (a0)+,$fffffa07.w        ; iera
  744.     move.b    (a0)+,$fffffa09.w        ; ierb
  745.     move.b    (a0)+,$fffffa13.w        ; imra
  746.     move.b    (a0)+,$fffffa15.w        ; imrb
  747.     move.b    (a0)+,$fffffa17.w        ; vectore register
  748.     move.b    (a0)+,$fffffa19.w        ; Timer A control
  749.     move.b    (a0)+,$fffffa1b.w        ; Timer B control
  750.     move.b    (a0)+,$fffffa1d.w        ; Timer C & D control
  751.     move.b    (a0)+,$fffffa1f.w        ; Timer A data
  752.     move.b    (a0)+,$fffffa21.w        ; Timer B data
  753.     move.b    (a0)+,$fffffa23.w        ; Timer C data
  754.     move.b    (a0)+,$fffffa25.w        ; Timer D data
  755.     move.b    (a0)+,$ffff8007.w        ; 68030 Configuration 
  756.     rts
  757.  
  758.  
  759.  
  760. restore_screen_info:
  761.     lea    screen_vars(pc),a0
  762.     move.b    (a0)+,$ffff8201.w        ; Vidéo (poids fort)
  763.     move.b    (a0)+,$ffff8203.w        ; Vidéo (poids moyen)
  764.     move.b    (a0)+,$ffff820d.w        ; Vidéo (poids faible)
  765.     move.b    (a0)+,$ffff820a.w        ; Synchronisation vidéo
  766.     move.w    (a0)+,$ffff820e.w        ; Offset pour prochaine ligne
  767.     move.w    (a0)+,$ffff8210.w        ; Largeur d'une ligne en mots
  768.     move.b    (a0)+,d0            ; Résolution ST
  769.     move.b    (a0)+,$ffff8265.w        ; Décalage Pixel
  770.     move.w    (a0)+,d1            ; Résolution FALCON
  771.     move.w    (a0)+,$ffff8282.w        ; HHT-Synchro
  772.     move.w    (a0)+,$ffff8284.w        ; Fin du décodage de la ligne
  773.     move.w    (a0)+,$ffff8286.w        ; Début du décodage de la ligne
  774.     move.w    (a0)+,$ffff8288.w        ; Overscan gauche
  775.     move.w    (a0)+,$ffff828a.w        ; Overscan droit
  776.     move.w    (a0)+,$ffff828c.w        ; HSS-Synchro
  777.     move.w    (a0)+,$ffff828e.w        ; HFS
  778.     move.w    (a0)+,$ffff8290.w        ; HEE
  779.     move.w    (a0)+,$ffff82a2.w        ; VFT-Synchro
  780.     move.w    (a0)+,$ffff82a4.w        ; Fin du décodage de l'image
  781.     move.w    (a0)+,$ffff82a6.w        ; Début du décodage de l'image
  782.     move.w    (a0)+,$ffff82a8.w        ; Overscan haut
  783.     move.w    (a0)+,$ffff82aa.w        ; Overscan bas
  784.     move.w    (a0)+,$ffff82ac.w        ; VSS-Synchro
  785.     move.w    (a0)+,$ffff82c0.w        ; Reconnaissance ST/FALCON
  786.     move.w    (a0)+,$ffff82c2.w        ; Informations résolution
  787.     move.w    d1,$ffff8266.w            ; Fixe résolution FALCON...
  788.     btst.b    #0,$ffff82c0.w            ; Résolution FALCON ?
  789.     bne.s    .Falcon_Rez            ; Si oui,saut !
  790.     move.b    d0,$ffff8260.w            ; Fixe résolution ST...
  791. .Falcon_Rez
  792.     rts
  793.  
  794. restore_pal
  795.     bsr    wait_vbl
  796.     lea    pal_space,a0
  797.     lea    $ffff8240.w,a1
  798.     moveq    #15,d0
  799. .save_st_pal
  800.     move.w    (a0)+,(a1)+
  801.     dbra    d0,.save_st_pal
  802.  
  803.     lea    $ffff9800.w,a1
  804.     move.w    #255,d0
  805. .save_falc_pal
  806.     move.l    (a0)+,(a1)+
  807.     dbra    d0,.save_falc_pal
  808.  
  809.     rts
  810.  
  811.  
  812. ********************************
  813. * VECTOR INSTALLATION ROUTINES *
  814. ********************************
  815.  
  816.  
  817. install_trap_1:
  818.     move.l    $84.w,old_trap_1+2
  819.     move.l    #new_trap_1,$84.w
  820.     rts
  821. install_trap_13:
  822.     move.l    $b4.w,old_trap_13+2
  823.     move.l    #new_trap_13,$b4.w
  824.     rts
  825. install_trap_14:
  826.     move.l    $b8.w,old_trap_14+2
  827.     move.l    #new_trap_14,$b8.w
  828.     rts
  829. install_vbl
  830.     move.l    $70.w,old_vbl+2
  831.     move.l    #new_vbl,$70.w
  832.     rts
  833. install_hbl
  834.     move.l    $68.w,old_hbl+2
  835.     move.l    #new_hbl,$68.w
  836.     rts
  837. install_ikbd
  838.     move.l    $118.w,old_ikbd+2
  839.     move.l    #new_ikbd,$118.w
  840.     rts
  841. install_timer_a:
  842.     move.l    #new_timer_a,$134.w
  843.     move.b    #7,$fffffa19.w        ;Timer A control (delay mode)
  844.     move.b    #246,$fffffa1f.w    ;Timer A data
  845.     bset    #5,$fffffa07.w        ;Interrupt Enable Register A
  846.     bset    #5,$fffffa13.w        ;Interrupt Mask Register A
  847.     rts
  848. install_timer_b:
  849.     move.l    #new_timer_b,$120.w
  850.     move.b    #7,$fffffa1b.w        ;Timer B control (delay mode)
  851.     move.b    #246,$fffffa21.w    ;Timer B data
  852.     bset    #0,$fffffa07.w        ;Interrupt Enable Register A
  853.     bset    #0,$fffffa13.w        ;Interrupt Mask Register A
  854.     rts
  855. install_timer_c
  856.     move.l    $114.w,old_timer_c+2
  857.     move.l    #new_timer_c,$114.w
  858.     rts
  859.  
  860. install_timer_d:
  861.     move.l    #new_timer_d,$110.w
  862. ;    move.b    #7,$fffffa1d.w        ;Timer D control (delay mode)
  863.     move.b    #246,$fffffa25.w    ;Timer D data
  864.     bset    #4,$fffffa09.w        ;Interrupt Enable Register A
  865.     bset    #4,$fffffa15.w        ;Interrupt Mask Register A
  866.     rts
  867.  
  868.  
  869. install_reset:
  870.     move.l    #$31415926,$426.w    ;magic
  871.     move.l    #init_ripper,$42a.w    
  872.     rts
  873.  
  874. install_alt_help
  875.     move.l    #init_ripper,$502.w
  876.     rts
  877.  
  878. install_vbl_queue:
  879.     move.l    $456.w,a0
  880. .gvbl    tst.l    (a0)+
  881.     bne.s    .gvbl    
  882.     move.l    #new_vbl_lister,-4(a0)
  883.     clr.l    (a0)
  884.     rts
  885.  
  886.  
  887. ***********************
  888. * NEW VECTOR ROUTINES *
  889. ***********************
  890.  
  891. new_trap_1:    clr.b    current_vec
  892.         bsr    check_option
  893.         beq    old_trap_1
  894.         movem.l    d0-a6,-(a7)
  895.         bsr    init_ripper
  896.         movem.l    (a7)+,d0-a6
  897. old_trap_1:    jmp    $12345678
  898.  
  899. new_trap_13:    move.b    #1,current_vec
  900.         bsr    check_option
  901.         beq    old_trap_13
  902.         movem.l    d0-a6,-(a7)
  903.         bsr    init_ripper
  904.         movem.l    (a7)+,d0-a6
  905. old_trap_13:    jmp    $12345678
  906.  
  907. new_trap_14:    move.b    #2,current_vec
  908.         bsr    check_option
  909.         beq    old_trap_14
  910.         movem.l    d0-a6,-(a7)
  911.         bsr    init_ripper
  912.         movem.l    (a7)+,d0-a6
  913. old_trap_14:    jmp    $12345678
  914.  
  915. new_vbl        move.b    #4,current_vec
  916.         bsr    check_option
  917.         beq    old_vbl
  918.         movem.l    d0-a6,-(a7)
  919.         bsr    init_ripper
  920.         movem.l    (a7)+,d0-a6
  921. old_vbl:    jmp    $12345678
  922.  
  923. new_hbl:    move.b    #3,current_vec
  924.         bsr    check_option
  925.         beq    old_hbl
  926.         movem.l    d0-a6,-(a7)
  927.         bsr    init_ripper
  928.         movem.l    (a7)+,d0-a6
  929. old_hbl:    jmp    $12345678
  930.  
  931. new_ikbd    move.b    #10,current_vec
  932.         bsr    check_option
  933.         beq    old_ikbd
  934.         bclr    #6,$fffffa11.w
  935.         movem.l    d0-a6,-(a7)
  936.         bsr    init_ripper
  937.         movem.l    (a7)+,d0-a6
  938.         rte
  939. old_ikbd    jmp    $12345678
  940.  
  941. new_timer_a    move.b    #6,current_vec
  942.         bclr    #5,$fffffa0f.w
  943.         bsr    check_option
  944.         bne    end_trap
  945.         rte
  946.  
  947. new_timer_a2    move.b    #6,current_vec
  948.         bsr    check_option
  949.         beq    old_timer_a
  950.         bclr    #5,$fffffa0f.w
  951.         movem.l    d0-a6,-(a7)
  952.         bsr    init_ripper
  953.         movem.l    (a7)+,d0-a6
  954.         rte
  955. old_timer_a    jmp    $12345678
  956.  
  957. new_timer_b    move.b    #7,current_vec
  958.         bclr    #0,$fffffa0f.w
  959.         bsr    check_option
  960.         bne    end_trap
  961.         rte
  962.  
  963. new_timer_b2    move.b    #7,current_vec
  964.         bsr    check_option
  965.         beq    old_timer_b
  966.         bclr    #0,$fffffa0f.w
  967.         movem.l    d0-a6,-(a7)
  968.         bsr    init_ripper
  969.         movem.l    (a7)+,d0-a6
  970.         rte
  971. old_timer_b    jmp    $12345678
  972.  
  973. new_timer_c    move.b    #8,current_vec
  974.         bsr    check_option
  975.         beq    old_timer_c
  976.         movem.l    d0-a6,-(a7)
  977.         bsr    init_ripper
  978.         movem.l    (a7)+,d0-a6
  979.         rte
  980. old_timer_c    jmp    $12345678
  981.  
  982. new_timer_d    move.b    #9,current_vec
  983.         bclr    #4,$fffffa11.w
  984.         bsr    check_option
  985.         bne    end_trap
  986.         rte
  987.  
  988. new_timer_d2    move.b    #9,current_vec
  989.         bsr    check_option
  990.         beq    old_timer_d
  991.         bclr    #4,$fffffa11.w
  992.         movem.l    d0-a6,-(a7)
  993.         bsr    init_ripper
  994.         movem.l    (a7)+,d0-a6
  995.         rte
  996. old_timer_d    jmp    $12345678
  997.  
  998.  
  999. new_vbl_lister    move.b    #5,current_vec
  1000.         bsr    check_option
  1001.         beq.s    .no_rip
  1002.         movem.l    d0-a6,-(a7)
  1003.         bsr    init_ripper
  1004.         movem.l    (a7)+,d0-a6
  1005. .no_rip        rts
  1006.     
  1007.  
  1008. end_trap
  1009. ;    move.w    (a7),old_sr+2
  1010. ;    move.l    2(a7),old_prg+2
  1011. ;    move.w    #$2700,(a7)
  1012. ;    move.l    #init_trap_ripper,2(a7)        
  1013. ;    rte
  1014. init_trap_ripper
  1015.     movem.l    d0-a6,-(a7)
  1016.     bsr    init_ripper
  1017.     movem.l    (a7)+,d0-a6
  1018.     rte
  1019. ;old_sr    move.w    #$2300,sr
  1020. ;old_prg    jmp    $12345678
  1021.  
  1022. check_option:
  1023.     movem.l    a0-2/d0,-(a7)
  1024.     bsr.s    do_reinstall
  1025.     lea    $ffff9200.w,a0    ;extended port address (read only)
  1026.     move.w    #$fff7,2(a0)    ;write mask
  1027.     move.w    (a0),d0        ;read fire data
  1028.     btst    #1,d0        ;check for option
  1029.     bne.s    no_option    ;if set, option is not pressed
  1030.     st.b    begin_ripping_flag
  1031. no_option:
  1032.     movem.l    (a7)+,a0-2/d0
  1033.     tst.b    begin_ripping_flag
  1034.     rts
  1035.  
  1036. do_reinstall
  1037.     tst.b    reinstall_flag
  1038.     beq    .none
  1039.  
  1040.     lea    reinstall_adrs,a0
  1041.     lea    install_bits,a2
  1042. .loop    move.l    (a0),a1
  1043.     cmpa.w    #-1,a1
  1044.     beq    .last
  1045.     tst.b    (a2)+
  1046.     beq.s    .next
  1047.     cmpa.w    #0,a1
  1048.     beq.s    .next
  1049.     move.l    (a1),d0
  1050.     cmp.l    4(a0),d0
  1051.     beq.s    .next
  1052.     move.l    d0,([a0,8])
  1053.     move.l    4(a0),(a1)
  1054. .next    add.l    #12,a0
  1055.     bra.s    .loop
  1056.  
  1057. .last
  1058.     lea    install_bits+6,a0
  1059.     tst.b    (a0)+
  1060.     beq.s    .no_timer_a
  1061.     bset    #5,$fffffa07.w        ;TA Interrupt Enable Register A
  1062.     bset    #5,$fffffa13.w        ;TA Interrupt Mask Register A
  1063.  
  1064. .no_timer_a
  1065.     tst.b    (a0)+
  1066.     beq.s    .no_timer_b
  1067.  
  1068.     bset    #0,$fffffa07.w        ;TB Interrupt Enable Register A
  1069.     bset    #0,$fffffa13.w        ;TB Interrupt Mask Register A
  1070.  
  1071. .no_timer_b
  1072.     tst.b    (a0)+
  1073.     beq.s    .no_timer_c
  1074.  
  1075.     bset    #5,$fffffa09.w        ;TC Interrupt Enable Register A
  1076.     bset    #5,$fffffa15.w        ;TC Interrupt Mask Register A
  1077.  
  1078. .no_timer_c
  1079.     tst.b    (a0)+
  1080.     beq.s    .no_timer_d
  1081.  
  1082.     bset    #4,$fffffa09.w        ;TD Interrupt Enable Register A
  1083.     bset    #4,$fffffa15.w        ;TD Interrupt Mask Register A
  1084.  
  1085. .no_timer_d
  1086.  
  1087. .none    rts    
  1088.  
  1089.  
  1090.  *------------------------*
  1091. ** GEMDOS Disk Operations **
  1092.  *------------------------*
  1093.  
  1094. * A0->filename, A1->address, D1=length
  1095.  
  1096.  
  1097. save_file:    lea    file_name(pc),a0
  1098.         bsr    create_file
  1099.         bmi    display_gemdos_error
  1100.         lea    magic,a0
  1101.         moveq    #10,d7
  1102.         bsr    write_file
  1103.         bmi    display_gemdos_error        
  1104.         move.w    pic_res,d0
  1105.         cmp.w    #4,d0
  1106.         beq    .no_pal
  1107.         lea    (pal_sizes,d0.w*4),a6
  1108.         move.l    (a6)+,d7
  1109.         beq.s    .no_st
  1110.         lea    pal_space,a0        
  1111.         bsr    write_file
  1112. .no_st        move.l    (a6)+,d7
  1113.         beq.s    .no_pal
  1114.         lea    pal_space+32,a0        
  1115.         bsr    write_file        
  1116.         bmi    display_gemdos_error
  1117. .no_pal        move.l    pic_adr,a0
  1118.         move.l    pic_length,d7
  1119.         bsr    write_file
  1120.         bmi    display_gemdos_error
  1121.         bsr    close_file
  1122.         rts
  1123.  
  1124. pal_sizes    dc.l    4,8
  1125.         dc.l    8,16
  1126.         dc.l    16,64
  1127.         dc.l    0,256    
  1128.  
  1129.  
  1130. display_gemdos_error:
  1131.         lea    gemdos_errors,a0
  1132.         move.l    #(end_gemdos_errors-gemdos_errors)/8-1,d1
  1133. .find_err    cmp.l    (a0)+,d0
  1134.         beq    found_gemdos_error
  1135.         addq.l    #4,a0
  1136.         dbra    d1,.find_err
  1137.         lea    unerr,a0
  1138. found_gemdos_error
  1139.         move.l    (a0),a0
  1140.         moveq    #0,d0
  1141.         move.l    #180,d1
  1142.         bsr    print_string
  1143.         rts
  1144.  
  1145. create_file:    movem.l    d1-2/a0-2,-(a7)
  1146.         clr.w    -(a7)
  1147.         pea    (a0)
  1148.         move.w    #$3c,-(a7)
  1149.         trap    #1
  1150.         addq.l    #8,a7
  1151.         movem.l    (a7)+,d1-2/a0-a2
  1152.         move.w    d0,file_handle
  1153.         rts
  1154.  
  1155. open_file:    movem.l    d1-2/a0-2,-(a7)
  1156.         clr.w    -(a7)
  1157.         pea    (a0)
  1158.         move.w    #$3d,-(a7)
  1159.         trap    #1
  1160.         addq.l    #8,a7
  1161.         movem.l    (a7)+,d1-2/a0-a2
  1162.         move.w    d0,file_handle    
  1163.         rts
  1164.  
  1165. read_file:    movem.l    d1-2/a0-2,-(a7)
  1166.         pea    (a0)
  1167.         move.l    d7,-(a7)
  1168.         move.w    file_handle,-(a7)
  1169.         move.w    #$3f,-(a7)
  1170.         trap    #1
  1171.         lea    12(a7),a7
  1172.         movem.l    (a7)+,d1-2/a0-a2
  1173.         cmp.l    d7,d0
  1174.         beq.s    .rf
  1175.         move.l    #-1000,d0
  1176. .rf        rts
  1177.  
  1178. write_file:    movem.l    d1-2/a0-2,-(a7)
  1179.         pea    (a0)
  1180.         move.l    d7,-(a7)
  1181.         move.w    file_handle,-(a7)
  1182.         move.w    #$40,-(a7)    
  1183.         trap    #1
  1184.         lea    12(a7),a7
  1185.         movem.l    (a7)+,d1-2/a0-a2
  1186.         cmp.l    d7,d0
  1187.         beq.s    .l9
  1188.         move.l    #-1001,d0
  1189. .l9        rts
  1190.  
  1191. file_seek:    movem.l    d1-2/a0-2,-(a7)
  1192.         move.w    d0,-(a7)
  1193.         move.w    file_handle,-(a7)
  1194.         move.l    d1,-(a7)
  1195.         move.w    #$42,-(a7)
  1196.         trap    #1
  1197.         lea    10(a7),a7
  1198.         movem.l    (a7)+,d1-2/a0-a2
  1199.         rts
  1200.  
  1201. close_file:    movem.l    d1-2/a0-2,-(a7)
  1202.         move.w    file_handle,-(a7)
  1203.         move.w    #$3e,-(a7)
  1204.         trap    #1
  1205.         addq.l    #4,a7
  1206.         movem.l    (a7)+,d1-2/a0-a2
  1207.         rts
  1208.  
  1209. ***************************************
  1210. * STRING PRINTING/CONVERSION ROUTINES *
  1211. ***************************************
  1212.  
  1213. print_string
  1214.     move.l    physic(pc),a1        ;screen
  1215.     mulu    #80,d1            ;y line * line size
  1216.     add.l    d1,a1            ;get to y line
  1217.     lea    tiny_font(pc),a2    ;font data
  1218. .line    move.l    d0,d2            ;start x
  1219. .nxt    moveq    #0,d1            ;clear d1
  1220.     move.b    (a0)+,d1        ;get byte from string
  1221.     beq    .last
  1222.     cmp.b    #13,d1            ;return?
  1223.     bne.s    .not_return        ;no
  1224.     add.l    #80*8*6,d0        ;next line
  1225.     bra.s    .line            ;restore x pos
  1226. .not_return
  1227.     sub.b    #32,d1        ;- first char
  1228.     mulu    #36,d1        ;* char size
  1229.     moveq    #5,d4        ;6 y lines
  1230. .yl    bfextu    (a2){d1:6},d3    
  1231.     bfins    d3,(a1){d2:6}
  1232.     addq.l    #6,d1        ;next char pos in char
  1233.     add.l    #80*8,d2    ;next screen line
  1234.     dbra    d4,.yl        ;loop y times
  1235.     sub.l    #80*8*6-6,d2    ;next x pos
  1236.     bra.s    .nxt
  1237. .last    rts
  1238.  
  1239. * enter with d0=long value
  1240.  
  1241. conv_long_ascii:
  1242.     movem.l    d0-3/a0,-(a7)
  1243.     lea    long_string,a0
  1244.     moveq    #$20,d2
  1245.     moveq    #9,d1
  1246. .clr    move.b    d2,(a0)+
  1247.     dbra    d1,.clr    
  1248.     clr.b    (a0)
  1249.     tst.l    d0
  1250.     beq.s    .endc
  1251.     moveq    #10,d2
  1252.     moveq    #$30,d3    
  1253. .conv    divul.l    d2,d1:d0
  1254.     add.b    d3,d1
  1255.     move.b    d1,-(a0)
  1256.     cmp.w    d2,d0
  1257.     bcc.s    .conv
  1258.     tst.b    d0
  1259.     beq.s    .endc
  1260.     add.b    d3,d0
  1261.     move.b    d0,-(a0)
  1262. .endc    movem.l    (a7)+,d0-3/a0
  1263.     rts
  1264.  
  1265.  *-------------------*
  1266. ** KEYBOARD ROUTINES **
  1267.  *-------------------*
  1268.  
  1269.  
  1270. init_ikbd:    bsr    clear_ikbd
  1271.         move.l    $118.w,old118
  1272.         move.l    #my_ikbd,$118.w
  1273.         lea    key_table,a0
  1274.         moveq    #127,d0
  1275. .cl        clr.b    (a0)+
  1276.         dbra    d0,.cl
  1277.         rts
  1278.  
  1279. restore_ikbd:    bsr    clear_ikbd
  1280.         move.l    old118,$118.w
  1281.         rts
  1282.  
  1283. clear_ikbd:     btst    #0,$fffffc00.w        ;is ikbd data reg full?
  1284.                 beq.s   ikbd_ok            ;its empty so end
  1285.                 move.b  $fffffc02.w,D0        ;get ikbd data
  1286.                 bra.s   clear_ikbd        ;loop
  1287. ikbd_ok:        rts                             ;return
  1288.  
  1289. send_ikbd:      lea     $fffffc00.w,a0        ;ikbd control register
  1290. waitkeyready:   btst    #1,(a0)            ;is data reg empty?
  1291.                 beq.s   waitkeyready        ;no, wait for empty
  1292.                 move.b  d0,2(a0)        ;write to ikbd data reg
  1293.                 rts                             ;return
  1294.  
  1295. my_ikbd:    move.w    #$2500,sr        ;set ipl level
  1296.  
  1297.         movem.l    d0/a0-a1,-(a7)        ;save registers
  1298.         movea.w    #$fffffc00,a0        ;ikbd control registers
  1299.  
  1300.         move.b    (a0),d0            ;read control reg
  1301.         btst    #7,d0            ;int request?
  1302.         beq    endmykey        ;no
  1303.  
  1304. keyloop        moveq    #0,d0            ;clear d0
  1305.         move.b    2(a0),d0        ;read ikbd data
  1306.         tst.b    key_cntr        ;is this first byte
  1307.         beq    chk_head        ;yes, so check for header
  1308.         
  1309.         move.l    key_ptr(pc),a1        ;ptr into key storage area
  1310.         move.b    d0,(a1)+        ;store keyboard data
  1311.         move.l    a1,key_ptr        ;update ptr
  1312.         subq.b    #1,key_cntr        ;decrement data to get
  1313.         bne    last_key_check        ;more data to get
  1314.  
  1315. process_packet:
  1316.         lea    key_buffer,a1        ;start of key storage data
  1317.         moveq    #0,d0            ;clear d0
  1318.         move.b    (a1),d0            ;get first byte
  1319.         sub.l    #$f6,d0        ;minus default packet header value
  1320.         and.w    #$f,d0            ;mask off unwanted bits
  1321.         cmp.w    #10,d0            ;is it a valid packet
  1322.         bge.s    .noj            ;no
  1323.         jsr    ([key_handlers,d0.w*4])    ;jump to packet handler routine
  1324. .noj        bra    last_key_check        ;check for more key data
  1325.  
  1326. chk_head    cmp.w    #$f6,d0            ;is it packer header
  1327.         blt.s    store_key        ;no, store as a key
  1328.  
  1329.         move.b    d0,key_buffer        ;store packet header
  1330.         move.l    #key_buffer+1,key_ptr    ;init key pointer
  1331.         lea    packet_table,a1        ;packet table
  1332.         sub.b    #$f6,d0            ;d0 is offset
  1333.         move.b    (a1,d0.w),key_cntr    ;bytes of data to be read
  1334.         bra    last_key_check        ;get data
  1335.  
  1336. store_key
  1337.         IFNE    DEBUG
  1338.         movem.l    d0-a6,-(a7)
  1339.         lea    $f96.w,a0
  1340.         jsr    ([$1132.w])
  1341.         movem.l    (a7)+,d0-a6
  1342.         ENDC
  1343.         lea    key_table,a1        ;keypress table
  1344.         bclr    #7,d0            ;check 'release' bit
  1345.         beq.s    setkey            ;0, so set key press
  1346.         clr.b    (a1,d0.w)        ;key released
  1347.         bra.s    last_key_check        ;get key data
  1348. setkey        st.b    (a1,d0.w)        ;set key pressed
  1349.         st.b    key_pressed
  1350.         move.b    d0,current_key
  1351. last_key_check:    move.b    (a0),d0        ;read ikbd control
  1352.         btst    #0,d0        ;more data to read?
  1353.         bne    keyloop        ;yes, so process it
  1354. endmykey    movem.l    (a7)+,d0/a0-1    ;restore registers
  1355.         bclr    #6,$fffffa11.w    ;signal end of ikbd interrupt
  1356.         rte
  1357.  
  1358. packet_table:
  1359.         dc.b    1    ;$f6 - keyboard packet
  1360.         dc.b    5    ;$f7 - absolute mouse packet
  1361.         dc.b    2    ;$f8 - relative mouse position / no buttons
  1362.         dc.b    2    ;$f9 - relative mouse / left button
  1363.         dc.b    2    ;$fa - relative mouse / right button
  1364.         dc.b    2    ;$fb - relative mouse / both buttons
  1365.         dc.b    6    ;$fc - time of day
  1366.         dc.b    2    ;$fd - joystick report
  1367.         dc.b    1    ;$fe - joystick 0 event
  1368.         dc.b    1    ;$ff - joystick 1 event
  1369.         even
  1370.  
  1371. key_handlers:
  1372.         dc.l    keyboard_packet_handler    ;$f6
  1373.         dc.l    absolute_mouse_handler    ;$f7
  1374.         dc.l    relative_mouse_handler    ;$f8
  1375.         dc.l    relative_mouse_handler    ;$f9
  1376.         dc.l    relative_mouse_handler    ;$fa
  1377.         dc.l    relative_mouse_handler    ;$fb
  1378.         dc.l    time_of_day_handler    ;$fc
  1379.         dc.l    joystick_report_handler    ;$fd
  1380.         dc.l    joystick0_handler    ;$fe
  1381.         dc.l    joystick1_handler    ;$ff
  1382.  
  1383. keyboard_packet_handler:
  1384.         moveq    #0,d0            ;clear d0
  1385.         move.b    1(a0),d0        ;get key
  1386.         bclr    #7,d0            ;key pressed?
  1387.         beq.s    .setkey            ;yes, set it
  1388.         clr.b    (key_table,d0.w)    ;indicate key release
  1389.         rts                             ;return
  1390. .setkey        st.b    (key_table,d0.w)    ;clear key
  1391.         st.b    key_pressed
  1392.         move.b    d0,current_key
  1393.         rts                             ;return
  1394.  
  1395. absolute_mouse_handler:            ;no absolute mouse handler!
  1396. time_of_day_handler:            ;no time of day handler!
  1397. joystick_report_handler:
  1398.         move.b    1(a1),j1_packet        ;get joystick 1 packet
  1399.         move.b    2(a1),j2_packet        ;get joystick 2 packet
  1400.         rts                             ;return
  1401.  
  1402. joystick0_handler:
  1403.         move.b    1(a1),j1_packet        ;save joystick 1 packet
  1404.         rts                             ;return
  1405.  
  1406. joystick1_handler:
  1407.         move.b    1(a1),j2_packet        ;save joystick 2 packet
  1408.         rts                             ;return
  1409.  
  1410. relative_mouse_handler:
  1411.         st.b    mouse_moved        ;indicate mouse moved
  1412.  
  1413.         move.b    (a1),d0            ;get mouse key info
  1414.         and.w    #%11,d0            ;isolate l+r buttons
  1415.         move.b    d0,mousek        ;save mouse key info
  1416.  
  1417. .nolimits    move.b    1(a1),d0        ;mouse x movement
  1418.         ext.w    d0            ;extend to signed word
  1419.         add.w    d0,mousex        ;update mouse x position
  1420.         move.b    2(a1),d0        ;mouse y movement
  1421.         ext.w    d0            ;extedn to signed word
  1422.         add.w    d0,mousey        ;update mouse y position
  1423. ;        rts                             ;return
  1424.  
  1425.         move.w    mousex,d0
  1426.         cmp.w    mousex_min,d0
  1427.         bgt.s    .xok1
  1428.         move.w    mousex_min,mousex
  1429.         bra.s    .xok2
  1430. .xok1        cmp.w    mousex_max,d0
  1431.         blt.s    .xok2
  1432.         move.w    mousex_max,mousex
  1433. .xok2        move.w    mousey,d0
  1434.         cmp.w    mousey_min,d0
  1435.         bgt.s    .yok1
  1436.         move.w    mousey_min,mousey
  1437.         bra.s    .yok2
  1438. .yok1        cmp.w    mousey_max,d0
  1439.         blt.s    .yok2
  1440.         move.w    mousey_max,mousey
  1441. .yok2        rts
  1442.  
  1443.  
  1444. ***************************
  1445. * ERROR HANDLING ROUTINES *
  1446. ***************************
  1447.  
  1448.     movem.l    d0-a7,registers
  1449.     move.w    #$2700,sr
  1450.     lea    rip_stack,a7
  1451.     move.l    #temp_vbl,$70.w
  1452.     bsr    init_screen
  1453.     bsr    set_angry_pal
  1454.     
  1455.     lea    registers,a5
  1456. ;    lea    reg_txts,a6
  1457.     move.l    #regs_y,d1
  1458.     moveq    #1,d6
  1459.     moveq    #7,d7
  1460. .loop1    move.l    d5,d0
  1461.     move.l    (a5)+,d0    
  1462. ;    bsr    conv_word_ascii
  1463.     move.w    (a6)+,d2
  1464.     bsr    reg_print
  1465.     moveq    #6*5,d0    
  1466.     lea    long_string,a0
  1467.     bsr    dum_print
  1468.     addq.l    #6,d1
  1469.     dbra    d7,.loop1
  1470.     move.l    #6*10,d1
  1471.     rts
  1472.  
  1473. reg_print
  1474.     lea    reg_string,a0
  1475.     move.w    d2,(a0)
  1476. dum_print
  1477.     movem.l    d0-a6,-(a7)
  1478.     bsr    print_string
  1479.     movem.l    (a7)+,d0-a6
  1480.     rts
  1481.  
  1482. set_angry_pal:
  1483.     bsr    wait_vbl
  1484.     lea    $ffff9800.w,a0
  1485.     lea    $ffff8240.w,a1
  1486.     moveq    #63,d0
  1487.     ror.l    #6,d0
  1488.     move.l    d0,(a0)+
  1489.     move.w    #$700,(a1)+
  1490.     moveq    #0,d0
  1491.     move.l    d0,(a0)+
  1492.     move.w    d0,(a1)+
  1493.     rts
  1494.     
  1495.  
  1496.  
  1497. temp_vbl:    addq.l    #1,$466.w
  1498.         rte
  1499.         
  1500. ***************************************************************************
  1501.     DATA
  1502. ***************************************************************************
  1503.  
  1504. tiny_font    incbin    a:\tinyfnt.bin
  1505.         even
  1506.  
  1507. Videl_640_200_2
  1508.     dc.l    640*200/8+256            * General
  1509.     dc.w    0,40,0,$400
  1510.     dc.w    0                                        * Flag Ordre
  1511.  
  1512.     dc.w    510,409,80,1007,160,434,0,0    * RGB
  1513.     dc.w    625,613,47,127,527,619
  1514.     dc.w    $181,%0100
  1515.  
  1516.     dc.w    198,141,21,627,80,150,0,0    * VGA 47 Hz
  1517.      dc.w    1337,1300,100,315,1115,1333
  1518.     dc.w    $186,%1001
  1519.  
  1520. reinstall_adrs:
  1521. ;    dc.l    $84,new_trap_1,old_trap_1+2
  1522. ;    dc.l    $b4,new_trap_13,old_trap_13+2
  1523. ;    dc.l    $b8,new_trap_14,old_trap_14+2
  1524.     dc.l    0,0,0
  1525.     dc.l    0,0,0
  1526.     dc.l    0,0,0
  1527.     dc.l    $68,new_hbl,old_hbl+2
  1528.     dc.l    $70,new_vbl,old_vbl+2
  1529.     dc.l    0,0,0
  1530.     dc.l    $134,new_timer_a2,old_timer_a+2
  1531.     dc.l    $120,new_timer_b2,old_timer_b+2
  1532.     dc.l    $114,new_timer_c,old_timer_c+2
  1533.     dc.l    $110,new_timer_d2,old_timer_d+2
  1534.     dc.l    $118,new_ikbd,old_ikbd+2
  1535.     dc.l    -1
  1536.  
  1537. install_routines:
  1538.     dc.l    install_trap_1
  1539.     dc.l    install_trap_13
  1540.     dc.l    install_trap_14
  1541.     dc.l    install_hbl
  1542.     dc.l    install_vbl
  1543.     dc.l    install_vbl_queue
  1544.     dc.l    install_timer_a
  1545.     dc.l    install_timer_b
  1546.     dc.l    install_timer_c
  1547.     dc.l    install_timer_d
  1548.     dc.l    install_ikbd
  1549.     dc.l    install_alt_help
  1550.     dc.l    install_reset
  1551.  
  1552.  
  1553. ripper_txt
  1554. *                123456789 123456
  1555.     dc.b    "RESERVOIR RIPPER",13
  1556.     dc.b    "----------------",0
  1557. coder_txt
  1558.     dc.b    "CODED BY MR PINK",0
  1559. rg_txt
  1560. *                123456789 123456789 123
  1561.     dc.b    "(C) 1995 RESERVOIR GODS",0
  1562. menu_txt
  1563.     dc.b    "[F1]  VIEW SCREEN",13
  1564.     dc.b    "[F2]  SAVE SCREEN",13,13
  1565.     dc.b    "[F10] EXIT RIPPER"
  1566.     dc.b    0
  1567.  
  1568. variables_txt:
  1569.  
  1570. *                0         1         2         3         4         5         6         7         8
  1571. *                 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
  1572.     dc.b    "COLS:               X:        Y:",13
  1573.     dc.b    "STWIDTH:      FALWIDTH:      ST-SHIFT:      SP-SHIFT:      HSCROLL:      SYNC:",13
  1574.     dc.b    "HHT:      HBB:      HBE:      HDB:      HDE:      HSS:      HFS:      HEE:",13
  1575.     dc.b    "VFT:      VBB:      VBE:      VDB:      VDE:      VSS:      VCL:      VCO:",0
  1576.  
  1577. word_txts
  1578.     dc.l    pic_x
  1579.     dc.w    6*23,0
  1580.     dc.l    pic_y
  1581.     dc.w    6*33,0
  1582.  
  1583.     dc.l    screen_vars+4        ;st width
  1584.     dc.w    6*9,1
  1585.     dc.l    screen_vars+6        ;030 width
  1586.     dc.w    6*24,1
  1587.     dc.l    screen_vars+10        ;sp shift
  1588.     dc.w    6*54,1
  1589.     dc.l    0
  1590.  
  1591. byte_txts
  1592.     dc.l    screen_vars+8        ;st shift
  1593.     dc.w    6*39,1
  1594.     dc.l    screen_vars+9
  1595.     dc.w    6*68,1
  1596.     dc.l    screen_vars+3        ;sync hz
  1597.     dc.w    6*79,1
  1598.     dc.l    0
  1599.  
  1600. intro_txt
  1601.     dc.b    27,"E"
  1602. *                123456789 123456789 12346789 123456789
  1603.     dc.b    "           RESERVOIR RIPPER",13,10
  1604.     dc.b    "           ----------------",13,10,13,10
  1605.     dc.b    "           CODED BY MR PINK",13,10,13,10
  1606.     dc.b    "       (C) 1995 RESERVOIR GODS",13,10,13,10
  1607.  
  1608.     dc.b    "VECTORS TO HOOK ONTO:",13,10
  1609.  
  1610.     dc.b    "F1 - TRAP #1",13,10
  1611.     dc.b    "F2 - TRAP #13",13,10
  1612.     dc.b    "F3 - TRAP #14",13,10
  1613.     dc.b    "F4 - HBL",13,10
  1614.     dc.b    "F5 - VBL",13,10
  1615.     dc.b    "F6 - VBL QUEUE",13,10
  1616.     dc.b    "F7 - TIMER A",13,10
  1617.     dc.b    "F8 - TIMER B",13,10
  1618.     dc.b    "F9 - TIMER C",13,10
  1619.     dc.b    "F10- TIMER D",13,10
  1620.     dc.b    "1) - IKBD",13,10
  1621.     dc.b    "2) - ALT-HELP",13,10
  1622.     dc.b    "3) - RESET",13,10
  1623.     dc.b    "[4] - RESTORE",13,10,13,10
  1624.  
  1625. *                123456789 123456789 12346789 123456789
  1626.     dc.b    "[SPACE] Install Ripper / [ESC] Quit",0
  1627.  
  1628.  
  1629.     DC.B    "TIMER A",13
  1630.     DC.B    "TIMER B",13
  1631.     DC.B    "TIMER D",13
  1632.     DC.B    "TIMER C",13
  1633.     DC.B    "VBL",13
  1634.     DC.B    "VBL QUEUE",13
  1635.     DC.B    "TRAP #1",13
  1636.     DC.B    "TRAP #2",13
  1637.     DC.B    "TRAP #13",13
  1638.     DC.B    "TRAP #14",13
  1639.     DC.B    "IKBD",13
  1640.     DC.B    "BLiTTER DONE",13
  1641.     DC.B    "LINE A",13
  1642.     DC.B    "LINE F",13
  1643.     DC.B    "HBL",13
  1644.     DC.B    "ERROR EXEPTIONS",13
  1645.     DC.B    "RS-232 INTERRUPTS",13
  1646.     DC.B    "MONO MONITOR DETECT",13
  1647.     DC.B    "RESET VECTOR",13
  1648.     DC.B    "TRACE EXCEPTION",13
  1649.     DC.B    "ALT HELP",13
  1650.     DC.B    "FLOPPY/HD INTERRUPT",13
  1651.     DC.B    "RESET",13
  1652.  
  1653. on_txt    dc.b    27,"Y"
  1654. on_y    dc.b    32
  1655. on_x    dc.b    32
  1656.     dc.b    "[ON] ",0
  1657. off_txt    dc.b    27,"Y"
  1658. off_y    dc.b    32
  1659. off_x    dc.b    32
  1660.     dc.b    "[OFF]",0
  1661.  
  1662. enter_file_txt    dc.b    "ENTER FILENAME:",0
  1663. single_string    dc.b    'A',0
  1664.  
  1665.  
  1666. v1_txt    dc.b    "TRAP #1",0
  1667. v2_txt    dc.b    "TRAP #13",0
  1668. v3_txt    dc.b    "TRAP #14",0
  1669. v4_txt    dc.b    "HBL",0
  1670. v5_txt    dc.b    "VBL",0
  1671. v6_txt    dc.b    "VBL QUEUE",0
  1672. v7_txt    dc.b    "TIMER A",0
  1673. v8_txt    dc.b    "TIMER B",0
  1674. v9_txt    dc.b    "TIMER C",0
  1675. v10_txt    dc.b    "TIMER D",0
  1676. v11_txt    dc.b    "IKBD",0
  1677. v12_txt    dc.b    "ALT-HELP",0
  1678. v13_txt    dc.b    "RESET",0
  1679.  
  1680. entry_txt    dc.b    "ENTERED VIA:",0
  1681.     even
  1682.  
  1683. v_txt_adrs:
  1684.     dc.l    v1_txt
  1685.     dc.l    v2_txt
  1686.     dc.l    v3_txt
  1687.     dc.l    v4_txt
  1688.     dc.l    v5_txt
  1689.     dc.l    v6_txt
  1690.     dc.l    v7_txt
  1691.     dc.l    v8_txt
  1692.     dc.l    v9_txt
  1693.     dc.l    v10_txt
  1694.     dc.l    v11_txt
  1695.     dc.l    v12_txt
  1696.     dc.l    v13_txt
  1697.  
  1698. gemdos_errors:
  1699.     dc.l    -1000,frerr
  1700.     dc.l    -1001,fwerr
  1701.  
  1702.     dc.l    -32,einvfn
  1703.     dc.l    -33,efilnf
  1704.     dc.l    -34,epthnf
  1705.     dc.l    -36,eaccdn
  1706.     dc.l    -37,eihndl
  1707.     dc.l    -39,ensmem
  1708.     dc.l    -40,eimba
  1709.     dc.l    -46,edrive
  1710.     dc.l    -48,ensame
  1711.     dc.l    -49,enmfil
  1712.     dc.l    -58,elocked
  1713.     dc.l    -59,enslock
  1714.     dc.l    -64,erange
  1715.     dc.l    -65,eintrn
  1716.     dc.l    -66,eplfmt
  1717.     dc.l    -67,egsbf
  1718.     dc.l    -80,eloop
  1719.     dc.l    -200,emount
  1720. end_gemdos_errors
  1721.  
  1722. einvfn:    dc.b    "INVALID FUNCTION",0
  1723. efilnf:    dc.b    "FILE NOT FOUND",0
  1724. epthnf:    dc.b    "PATH NOT FOUND",0
  1725. eaccdn: dc.b    "ACCESS DENIED",0
  1726. eihndl: dc.b    "INVALID HANDLE",0
  1727. enhndl:    dc.b    "NO MORE HANDLES",0
  1728. ensmem:    dc.b    "OUT OF MEMORY",0
  1729. eimba:    dc.b    "INVALID MEMORY BLOCK ADDRESS",0
  1730. edrive:    dc.b    "INVALID DRIVE",0
  1731. ensame:    dc.b    "CROSS DEVICE RENAME",0
  1732. enmfil:    dc.b    "NO MORE FILES",0
  1733. elocked: dc.b    "RECORD IS ALREADY LOCKED",0
  1734. enslock: dc.b    "INVALID LOCK REMOVAL REQUEST",0
  1735. erange:    dc.b    "RANGE ERROR",0
  1736. eintrn: dc.b    "INTERNAL ERROR",0
  1737. eplfmt: dc.b    "INVALID PROGRAM LOAD FORMAT",0
  1738. egsbf: dc.b    "MEMORY BLOCK GROWTH FAILURE",0
  1739. eloop: dc.b    "TOO MANY SYMBOLIC LINKS",0
  1740. emount: dc.b    "MOUNT POINT CROSSED",0
  1741. frerr:    dc.b    "FILE READ ERROR",0
  1742. fwerr:    dc.b    "FILE WRITE ERROR",0
  1743. unerr:    dc.b    "UNKNOWN ERROR",0
  1744.  
  1745. scan_code_table:
  1746. *                0123456789ABCDEF
  1747.     dc.b    '**1234567890_=**'
  1748.     dc.b    'QWERTYUIOP[]**AS'
  1749.     dc.b    'DFGHJKL:,`*#ZXCV'
  1750.     dc.b    'BNM,./*** ******'
  1751.     dc.b    '**********-***+*'    
  1752.     dc.b    '****************'
  1753.     dc.b    '\**()/*789456123'
  1754.     dc.b    '0.*'
  1755.     even
  1756.  
  1757. res_txts:
  1758.     dc.l    two_colour_txt
  1759.     dc.l    four_colour_txt
  1760.     dc.l    sixteen_colour_txt
  1761.     dc.l    ep_colour_txt
  1762.     dc.l    t_colour_txt
  1763.  
  1764. two_colour_txt:
  1765.     dc.b    "2 COLOUR",0
  1766. four_colour_txt:
  1767.     dc.b    "4 COLOUR",0
  1768. sixteen_colour_txt:
  1769.     dc.b    "16 COLOUR",0
  1770. ep_colour_txt
  1771.     dc.b    "256 COLOUR",0
  1772. t_colour_txt
  1773.     dc.b    "TRUE COLOUR",0
  1774.  
  1775. long_string
  1776.     dc.b    '0123456789',0
  1777.  
  1778. reg_string    dc.b    "A0 =",0
  1779.  
  1780.     even
  1781.  
  1782. key_ptr:    dc.l     key_buffer
  1783.  
  1784. ***************************************************************************
  1785.     BSS
  1786. ***************************************************************************
  1787. vga_flag        ds.b    1
  1788. current_vec        ds.b    1
  1789. begin_ripping_flag    ds.b    1
  1790. reinstall_flag        ds.b    1
  1791. mouse_moved    ds.b    1
  1792. key_pressed    ds.b    1
  1793. current_key    ds.b    1
  1794. j1_packet:    ds.b    1
  1795. j2_packet:    ds.b    1
  1796.         even
  1797.  
  1798. registers    ds.l    16*4
  1799.  
  1800. pic_adr        ds.l    1
  1801. magic        ds.l    1
  1802. pic_res        ds.w    1
  1803. pic_x        ds.w    1
  1804. pic_y        ds.w    1
  1805.  
  1806.  
  1807. physic        ds.l    1
  1808. old118        ds.l    1
  1809.  
  1810. pic_length    ds.l    1
  1811. file_handle    ds.w    1
  1812. text_counter    ds.w    1
  1813.  
  1814. mousek:            ds.w    1
  1815. mouse_key:        ds.w    1
  1816. mousex:            ds.w    1
  1817. mousey:            ds.w    1
  1818. mousex_min:        ds.w    1
  1819. mousex_max:        ds.w    1
  1820. mousey_min:        ds.w    1
  1821. mousey_max:        ds.w    1
  1822. key_cntr:        ds.w    1
  1823. key_table:        ds.b    128
  1824. key_buffer:          ds.b     256
  1825.  
  1826. file_name:        ds.b    256
  1827.  
  1828. old_system_vars    ds.b    256
  1829. cur_system_vars    ds.b    256
  1830.  
  1831. screen_vars    ds.b    50
  1832. pal_space    ds.b    (256*4)+(16*2)
  1833.  
  1834. install_bits
  1835.         ds.b    1024
  1836. rip_stack    ds.l    4
  1837.         ds.b    256
  1838. screen_space    ds.b    16000
  1839. end_ripper