home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Games / WHDLoad / Src / sources / whdload / blitfix_imm_58a5.s < prev    next >
Text File  |  2000-08-07  |  2KB  |  79 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Modul.    blitfix_imm_58a5.s
  3. ;  :Contents.    routine to fix program that does not correctly wait for
  4. ;        blitter finish
  5. ;        the instruction which writes the "bltsize" register will be
  6. ;        patched with a routine which will wait for blitter finish
  7. ;        after writing "bltsize"
  8. ;  :Version.    $Id: blitfix_imm_58a5.s 1.5 2000/04/16 16:46:17 jah Exp $
  9. ;  :History.    13.09.98 generated from blitfix_imm_58a4.s
  10. ;        13.09.98 now it saves all registers
  11. ;        19.03.99 checked area fixed, a2 now returns pointer
  12. ;        09.04.00 interrupt blit check added
  13. ;  :Requires.    -
  14. ;  :Copyright.    Public Domain
  15. ;  :Language.    68000 Assembler
  16. ;  :Translator.    Barfly V1.131
  17. ;  :To Do.
  18. ;---------------------------------------------------------------------------*
  19. ;
  20. ; this will patch the following instruction:
  21. ;        move.w    #XXXX,($58,a5)
  22. ;
  23. ; IN:    A0 = APTR start of memory to patch
  24. ;    A1 = APTR end of memory to patch
  25. ;    A2 = APTR space for patch routine MUST be < $8000 !!!
  26. ; OUT:    D0-D1/A0-A1 unchanged
  27. ;    A2 = APTR points to the end of patch routine
  28.  
  29. _blitfix_imm_58a5
  30.         movem.l    a0-a1,-(a7)
  31.  
  32.     IFD PATCHCOUNT
  33.         clr.w    (6,a2)
  34.     ENDC
  35.  
  36.         subq.l    #4,a1
  37. .loop        cmp.w    #$3b7c,(a0)+        ;move.w #xxxx,($xxxx,a5)
  38.         bne    .next
  39.         cmp.w    #$0058,(2,a0)
  40.         bne    .next
  41.         move.w    (a0),(2,a0)        ;save blitsize
  42.         subq.w    #2,a0
  43.         move.w    #$4eb8,(a0)+        ;JSR $xxxx.w
  44.         move.w    a2,(a0)+
  45.  
  46.     IFD PATCHCOUNT
  47.         addq.w    #1,(6,a2)
  48.     ENDC
  49.  
  50. .next        cmp.l    a0,a1
  51.         bhs    .loop
  52.  
  53.         move.w    #$4ef9,(a2)+        ;JMP $xxxxxxxx.l
  54.         lea    .movewait,a0
  55.         move.l    a0,(a2)+
  56.  
  57.     IFD PATCHCOUNT
  58.         addq.w    #2,a2
  59.     ENDC
  60.  
  61.         movem.l    (a7)+,a0-a1
  62.         rts
  63.  
  64. .movewait    move.l    a0,-(a7)
  65.         move.l    (4,a7),a0
  66.         move.w    (a0)+,($58,a5)
  67.         move.l    a0,(4,a7)
  68.         move.l    (a7)+,a0
  69.         BLITWAIT a5
  70.     IFD INTBLITCHECK
  71.         move.l    d0,-(a7)
  72.         move    sr,d0
  73.         and.w    #$0700,d0
  74.         beq    .intok
  75.         illegal
  76. .intok        move.l    (a7)+,d0
  77.     ENDC
  78.         rts
  79.