start:   move.w   #0,-(sp)      ; create OMNIRES.INF file
         pea      file
         move.w   #$3c,-(sp)
         trap     #1
         addq.l   #8,sp
         move.w   d0,handle

         pea      buffer        ; write information
         pea      bufend-buffer
         move.w   d0,-(sp)
         move.w   #$40,-(sp)
         trap     #1
         lea      12(sp),sp

         move.w   handle,-(sp)  ; close file
         move.w   #$3e,-(sp)
         trap     #1
         addq.l   #4,sp

error:   clr.w    -(sp)         ; return back to O/S
         trap     #1
         addq.l   #2,sp
         bra      error

.data
file:    dc.b     "OMNIRES.MEG",$00
.even
********************************************
* These next variables can be loaded       *
*  from disk, if the file that this program*
*  creates is named OMNIRES.INF            *
*  is there. In main directory of disk     *
********************************************
* these variables are for MEGA US/CAN  ROMS*
********************************************
buffer:                            ; these next five values are found
*                                  ;  in the routines listed after a
*                                  ;  bsr or a jsr opcode
*                                  ;  flash1,vblfl1,dump1 -> are found in order
*                                  ;  in vbl interupt routine.
flash1:  dc.l    $fc4666           ; flashcur /blink routine found in system
*                                  ;  vertical blank routine vec #$70
vblfl1:  dc.l    $fc1bc4           ; vblfloppy routine found in system
*                                  ;  vertical blank routine vec #$70
dump1:   dc.l    $fc0d50           ; dump screen routine found in system
*                                  ;  vertical blank routine vec #$70
waitvbl1:dc.l    $fc07d0           ; waitvbl routine found in Xbios:_setScreen
scrint1: dc.l    $fca914           ; scrinit routine found in Xbios:_setScreen
******************************************************************
y_abs:   dc.l    $2742             ; Address of y_absolute mouse variable
*                                  ;  variable is in mouse vec routine
*                                  ;  the mouse vec routine is found by
*                                  ;   ie
*                                  ;         move.w  #34,-(sp)
*                                  ;         trap    #14
*                                  ;         addq.l  #2,sp
*                                  ;         move.l  d0,a0
*                                  ;         move.l  12(a0),d0
*                                  ;   d0.l now points to mouse vector routine.
*                                  ; Entry conditions for mouse vector routine
*                                  ;  a0 points to relative mouse buffer from
*                                  ;  keyboard.
*                                  ; ie a0 -> xx yy zz
*                                  ;          |  |  |
*                                  ;          |  |  +- delta y
*                                             |  +---- delta x
********************************               +------- mouse button state
** MEGA ROM MOUSE HANDLER DUMP *   ;             where xx,yy,xx are bytes
**  12/12/1987                 *   ; this is an example of the MEGA ROMS mouse
********************************   ;  vector handler.
*
*    K00000=$2847
*    K00002=-8
*    K00004=3
*    K00005=1
*    K00007=$283E
*    K00009=$2960
*    K0000A=$2746
*    K0000B=2
*    K0000D=5
*    K0000E=$2740
*    K0000F=$2742
*    K00010=$FCFEDC
*    K00011=$2968
*    K00012=$2964
*     TST.B K00000
*     BNE L00001
*     MOVEM.L D0-A6,-(A7)
*     MOVE.B (A0),D0
*     MOVE.B D0,D1
*     ANDI.B #-8,D1
*     CMPI.B #-8,D1
*     BNE L00003
*     ANDI.W #K00004,D0
*     LSR.B #K00005,D0
*     BCC.S L00006
*     BSET #K00005,D0
*    L00006:MOVE.B K00007,D1
*     ANDI.W #K00004,D1
*     CMP.B D1,D0
*     BEQ.S L00008
*     MOVE.W D1,-(A7)
*     MOVEA.L K00009,A1
*     JSR (A1)                      ; exchange button change vector
*     MOVE.W (A7)+,D1
*     MOVE.W D0,K0000A
*     EOR.B D0,D1
*     ROR.B #K0000B,D1
*     OR.B D1,D0
*     MOVE.B D0,K00007
*    L00008:MOVE.B K00005(A0),D0
*     OR.B K0000B(A0),D0
*     BNE.S L0000C
*     BCLR #K0000D,K00007
*     BRA.S L00003
*     L0000C:BSET #K0000D,K00007
*     MOVE.W K0000E,D0              ; get current x absolute mouse position
*     MOVE.B K00005(A0),D1          ; get relative delta x movement
*     EXT.W D1                      ; convert to word
*     ADD.W D1,D0                   ; calculate new x absolute positon
*     MOVE.W K0000F,D1              ; get cuttent y absolute mouse position
*     MOVE.B K0000B(A0),D3          ; get relative delta y movement
*     EXT.W D3                      ; convert to word
*     ADD.W D3,D1                   ; calculate new y absolute position
*     BSR.S K00010                  ; check bounds
*    *                              ;  d0 -> x absolute
*    *                            ;  d1 ->>> y absolute
*     MOVEA.L K00011,A1
*     JSR (A1)                      ; exchange mouse movement vector
*    *                              ;  d0 -> x absolute
*    *                              ;  d1 -> y absolute
*     BSR.S K00010                  ; check bounds
*     MOVE.W D0,K0000E              ; save new x absolute
*     MOVE.W D1,K0000F              ; save new y absolute
*     MOVEA.L K00012,A1             ; plot mouse
*     JSR (A1)
*    L00003:MOVEM.L (A7)+,D0-A6
*    L00001:RTS
******************************************************************** 
kbshiftt:dc.l    $e61                      ; found off function 11 trap 13
*                                          ;  kbshift in
*                                          ;  move.b #$e61(a5),d0
*                                          ;   where a5 is 0
defau:   dc.l    0
colorb_w:dc.w    $0777
         dc.w    $0444
         dc.w    $0444
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
         dc.w    $0000
****************************************
bufend:  dc.w    $0000
.bss
handle:  ds.w    1
