home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 100 / af100b.adf / patches.lzx / PinballDreamsPatch / src / PinballPatch / pinballhd.asm < prev   
Encoding:
Assembly Source File  |  1997-06-18  |  2.9 KB  |  165 lines

  1. ; *** Pinball Dreams Turbo Board Launcher
  2. ; *** Written by Jean-François Fabre in 1997
  3.  
  4. ; *** For more infomation about this source code
  5. ; *** and the HDStartup technology, see my web site
  6.  
  7. ; *** http://www.ensica.fr/~jffabre/patches.html
  8. ; *** e-mail: jffabre@ensica.fr
  9.  
  10.  
  11.     include    "/lib/libs.i"
  12.     include    "/lib/macros.i"
  13.     include    "/lib/refs.i"
  14.  
  15. ; *** This game is a cool game, but it's programmed
  16. ; *** like shit (but I could not do such a game)
  17.  
  18. _loader:
  19.     move.l    #$80000,D0
  20.     JSRABS    AllocExtMem
  21.     move.l    D0,ExtBase
  22.     beq    MemErr
  23.  
  24.     Mac_printf    "Pinball dreams turbo board patch"
  25.     Mac_printf    "Programmed by Jean-François Fabre © 1997"
  26.     NEWLINE
  27.     Mac_printf    "Please insert Pinball Dreams Disk 1 in DF0:"
  28.     Mac_printf    "And click the left mouse button"
  29.  
  30.     JSRABS    TransfRoutines
  31.  
  32.     WAIT_LMB
  33.  
  34.     moveq.l    #0,D0
  35.     move.l    #CACRF_CopyBack,D1
  36.     JSRABS    Degrade
  37.  
  38.     GO_SUPERVISOR
  39.     SAVE_OSDATA    $80000
  40.     move.w    #$2700,SR
  41.  
  42.     ; **** boot stuff and patch
  43.  
  44.  
  45.     lea    boot,A0
  46.     lea    $100.W,A1
  47.  
  48. copy$
  49.     move.l    (A0)+,(A1)+
  50.     cmp.l    #$2900,A1
  51.     bne.b    copy$
  52.  
  53.     ; *** replaces memory check
  54.  
  55.     move.l    ExtBase(pc),$3B4.W
  56.     move.l    #$60000076,$162.W
  57.  
  58.     ; *** installs level 6 interrupt
  59.  
  60.     GETUSRADDR    PatchIntCIAB
  61.     move.l    D0,$78.W
  62.  
  63.     ; *** a patch
  64.  
  65.     PATCHUSRJSR    $262.W,Patch262
  66.  
  67.     ; *** flush caches
  68.  
  69.     JSRGEN    FlushCachesHard
  70.  
  71.     nop
  72.     nop
  73.     jmp    $100.W        ; GO GO GO
  74.     nop
  75.     nop
  76.  
  77.  
  78. MemErr:
  79.     Mac_printf    "** Not enough mem to run Pinball Dreams!"
  80.     JMPABS    CloseAll
  81.  
  82. ; *** routines relocated on the top of the memory, either in chip or fast
  83.  
  84. _UserPatchRoutines:
  85.  
  86. ; *** on 68060, this interrupt occurs at least once
  87. ; *** We have to trap it, and acknowledge
  88.  
  89. PatchIntCIAB:
  90.     move.w    #$2000,intreq+$DFF000
  91.     btst.b    #0,$BFDD00        ; acknowledge CIA-B Timer A interrupt
  92.     RTE
  93.  
  94. Patch1372:
  95.  
  96.     ; *** Removes a check causing incompatibility
  97.     ; *** with 68060 boards (possibly 68040 too)
  98.  
  99.     move.l    A0,-(sp)
  100.     move.l    ExtBase(pc),A0
  101.     add.l    #$C968,A0
  102.     cmp.l    #'FUCK',2(A0)
  103.     bne    nopatch0$
  104.  
  105.     move.l    #$4E754E75,(A0)    
  106.     JSRGEN    GoECS            ; normal sprite size
  107.  
  108. nopatch0$
  109.     move.l    (sp)+,A0
  110.  
  111.     ; *** keyboard interrupt (menu only, needs 1MB of fast memory)
  112.  
  113.     cmp.l    #$423900BF,$1F4E.W
  114.     bne    nopatch2$
  115.     PATCHUSRJSR    $1F4E.W,KbInt
  116. nopatch2$
  117.  
  118.     MOVEA.L    $7C000,A0        ;02: 20790007C000
  119.     MOVEA.L    $257A.W,A1        ;08: 2278257A
  120. LAB_0000:
  121.     MOVE.B    (A0)+,(A1)+        ;0C: 12D8
  122.     SUBQ.L    #1,$257E.W        ;0E: 53B8257E
  123.     BNE.S    LAB_0000        ;12: 66F8
  124.     MOVE.L    A0,$7C000
  125.  
  126.     PATCHUSRJMP    $1372.W,Patch1372    ; re installs the patch
  127.  
  128.     JSRGEN    FlushCachesHard
  129.     RTS
  130.  
  131. Patch262:
  132.     move.l    #'PD00',D0
  133.     PATCHUSRJMP    $1372.W,Patch1372
  134.     JSRGEN    FlushCachesHard
  135.     rts
  136.  
  137. KbInt:
  138.     move.l    D0,-(sp)
  139.     not.b    D0
  140.     ror.b    #1,D0
  141.     cmp.b    #$45,D0        ; ESC from the menu
  142.     bne    noquit$
  143.     JSRGEN    InGameExit
  144. noquit$:
  145.     move.l    (sp)+,D0
  146.     rts
  147.  
  148.  
  149. _user_pbuffer:
  150.     dc.l    0
  151. _general_pbuffer:
  152.     dc.l    0
  153. ExtBase:
  154.     dc.l    0
  155. _EndUserPatchRoutines:
  156.  
  157.     ; ** not used, but necessary for the link
  158.  
  159.     HD_PARAMS    "","CON:20/20/400/250/Pinball Dreams Patch",0,1
  160.  
  161.     ; ** the startup program I had to rip on a 68020
  162.     ; ** I could not do any other way, sorry...
  163. boot:
  164.     incbin    "pdmain.bin"
  165. end_