home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / tt / getrez / getrez.s < prev   
Encoding:
Text File  |  1992-12-20  |  1.9 KB  |  111 lines

  1. ***    Corrige un bug dans getrez (Xbios 4)
  2.  
  3. ***    .PRG a mettre en AUTO
  4.  
  5.  
  6.     include    gemdos.i
  7.     include    bios.i
  8.     include    xbios.i
  9.     
  10.     text
  11.     
  12. ***    Startup code
  13.  
  14. Start
  15.     move.l    4(a7),a3        Get Basepage
  16.     move.l    12(a3),d0        Get Text size
  17.     add.w    #256,d0            Plus Basepage
  18.     lea.l    Stack,sp
  19.     move.l    d0,d7            Save this value
  20.     move.l    d0,-(sp)
  21.     move.l    a3,-(sp)
  22.     clr.w    -(sp)
  23.     move.w    #m_shrink,-(sp)        Do Mshrink
  24.     trap    #1
  25.     lea.l    12(sp),sp
  26.     
  27. ***    Exchanges trap #14 vector.
  28.  
  29.     pea.l    New_trp
  30.     move.w    #46,-(sp)        Trap #14 vector number
  31.     move.w    #setexc,-(sp)
  32.     trap    #13            Bios setexec
  33.     addq.l    #8,sp
  34.     move.l    d0,Old_trp        Save old value
  35.  
  36. ***    Display message and terminates.
  37.  
  38.     pea.l    message
  39.     move.w    #c_conws,-(sp)
  40.     trap    #1
  41.     addq.l    #6,sp
  42.     
  43.     clr.w    -(sp)            Terminates
  44.     move.l    d7,-(sp)        Keep all memory shrunk
  45.     move.w    #p_termres,-(sp)
  46.     trap    #1
  47.     
  48. ***    Constants and stack
  49.  
  50. Old_trp    ds.l    1
  51. Usr_stk    ds.l    1
  52.     ds.l    31
  53. Stack    ds.l    1
  54.  
  55. ***    Permanent part
  56.  
  57. New_trp
  58.     lea.l    8(sp),a0        a0 points to 1st parameter
  59.     move.w    (sp),d0            Test S bit in frame
  60.     btst.l    #13,d0            Was it set ?
  61.     bne.s    .super            Yes, it's correct
  62.     move.l    usp,a0            Else get user stack
  63. .super
  64.     move.w    (a0),d0            Examine call number
  65.     cmpi.w    #getrez,d0
  66.     beq.s    Vid_new            Getrez : modifies value
  67.     movea.l    Old_trp,a0
  68.     jmp    (a0)            Otherwise branch to old handler
  69.     
  70. Vid_new
  71.     move.w    #$ffff,-(sp)        Get video mode
  72.     move.w    #vsetmode,-(sp)
  73.     trap    #14
  74.     addq.l    #4,sp
  75.     andi.b    #$8f,d0            Mask unused flags
  76.     cmpi.b    #%10001000,d0        St high ?
  77.     bne.s    .v1
  78.     moveq.l    #2,d0
  79.     rte
  80. .v1
  81.     cmpi.b    #%10001001,d0        St medium ?
  82.     bne.s    .v2
  83.     moveq.l    #1,d0
  84.     rte
  85. .v2
  86.     cmpi.b    #%10000010,d0        St low ?
  87.     bne.s    .v3
  88.     moveq.l    #0,d0
  89.     rte
  90. .v3
  91.     cmpi.b    #%00001010,d0        TT medium ?
  92.     bne.s    .v4
  93.     moveq.l    #4,d0
  94.     rte
  95. .v4
  96.     cmpi.b    #%00000011,d0        TT low ?
  97.     bne.s    .v5
  98.     moveq.l    #7,d0
  99.     rte
  100. .v5
  101.     moveq.l    #5,d0            Returns unknown.
  102.     rte
  103.     
  104.     
  105. ***    Le message !
  106.  
  107. message    dc.b    'GETREZ patch V 0.0 installed',10,13,00
  108.  
  109. ***    that's all !!!
  110.  
  111.     end