home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Games / JST / sources / src / loaders / Frenetic / frenetichd.asm < prev    next >
Encoding:
Assembly Source File  |  2001-03-19  |  3.3 KB  |  187 lines

  1. ; *** Frenetic HD Loader v1.1
  2. ; *** Written by Keith Krellwitz (kkrellwi@nmu.edu)
  3. ; *** Support for original and trainer by Codetapper/Action (codetapper@hotmail.com)
  4.  
  5.     MACHINE    68000
  6.  
  7.     include    "jst.i"
  8.  
  9.     HD_PARAMS    "Disk.",STD_DISK_SIZE,2
  10.  
  11. _loader:
  12.     RELOC_MOVEL    D0,trainer
  13.  
  14.     Mac_printf    "Frenetic HD Loader v1.1"
  15.     Mac_printf    "Programmed by Keith Krellwitz & Jeff 1997"
  16.     NEWLINE
  17.     Mac_printf    "Support for original and trainer by Codetapper/Action in 2000"
  18.     Mac_printf    "During the game, press Help to toggle infinite lives!"
  19.  
  20.     tst.l    D0
  21.     beq    notrain
  22.     NEWLINE
  23.     Mac_printf    "Trainer activated"
  24. notrain:
  25.     JSRABS    LoadDisks
  26.  
  27.     move.l    #CACRF_CopyBack,D1
  28.     moveq.l    #0,D0
  29.     JSRABS    Degrade
  30.  
  31.     GO_SUPERVISOR
  32.     SAVE_OSDATA    $80000
  33.  
  34.     LEA        $0007F000,A7
  35.     MOVE    #$14,SR
  36.     JSRGEN    FreezeAll
  37.     BSET    #$01,$00BFE001
  38.  
  39.     move.l    #$0,d0
  40.     move.l    #$0,d3
  41.     lea        $a498,a0
  42.     move.l    #$3e8,d1                ;offset
  43.     move.l    #$14,d2                    ;length
  44.     JSRGEN  ReadRobSectors
  45.     PATCHUSRJMP    $a5ba,jumper1
  46.     JSRGEN    FlushCachesHard
  47.     jmp        $a4a0
  48. jumper1:
  49.     move.l    #$8394687,$71674
  50.     PATCHGENJMP    $70b68,ReadRobSectors
  51.     PATCHUSRJMP    $70b16,jumper2
  52.     JSRGEN    FlushCachesHard
  53.     jmp        $70ad6
  54.  
  55. jumper2:
  56.     PATCHUSRJMP    $62646,loadtracks
  57.     PATCHUSRJMP    $625ee,jumper3
  58.     bsr     swap
  59.     JSRGEN    FlushCachesHard
  60.     jmp        $65000
  61.  
  62. jumper3:
  63.     move.l    a0,-(sp)
  64.     bsr    loadtracks
  65.  
  66.     lea    $4000,a0        ;At this stage, detect version
  67.  
  68.     cmp.l    #$48e7ffff,(a0)        ;Original game
  69.     beq    _original
  70.  
  71.     cmp.l    #$000003f3,(a0)        ;Vince/Tristar packed (crack)
  72.     beq    _crack
  73.  
  74.     JSRGEN    InGameExit        ;Unknown version, quit!
  75.  
  76. ;======================================================================
  77.  
  78. _original:
  79.     PATCHUSRJMP    $4178,_reloc    ;Only works on ORIGINAL!
  80.     JSRGEN    FlushCachesHard
  81.     move.l    (sp)+,a0
  82.     jmp    $4000.w
  83.  
  84. _reloc:    move.b    (a0)+,(a1)+        ;Routine on stack to relocate to $4000
  85.     subq.l    #1,d0
  86.     bne.b    _reloc
  87. .clr:    clr.b    (a1)+
  88.     subq.l    #1,d1
  89.     bne.b    .clr
  90.     movem.l    (sp)+,d0-d7/a0-a6
  91.  
  92.     bsr    jumper4        ;Crack game, add quit key, beam wait
  93.     jmp    $4000
  94.  
  95. _crack:
  96.     PATCHUSRJMP    $423e,_crackfx
  97.     JSRGEN    FlushCachesHard
  98.     move.l    (sp)+,a0
  99.     jmp    $4020.w            ;It's a miracle $4000 ever worked!
  100.  
  101. _crackfx:
  102.     bsr    jumper4        ;Crack game (overkill!), add quit key, beam wait
  103.     jmp    (a2)
  104.  
  105. jumper4:
  106.     move.l    a0,-(sp)
  107.  
  108.     lea    $42f4,a0        ;Patch RNC protection :)
  109.     move.l    #$28bcad44,(a0)+
  110.     move.l    #$ba136000,(a0)+
  111.     move.w    #$08c4,(a0)+
  112.         
  113.     lea    $4d8e,a0        ;Send final protection to Valhalla :)
  114.     move.l    #$28bcad44,(a0)+    ;Hey diddily de,
  115.     move.l    #$ba136000,(a0)+    ;a crackers life for me :)
  116.     move.w    #$08c4,(a0)+
  117.  
  118.     PATCHUSRJMP    $27450,loadtracks
  119.     move.w    #$c000,$9a(a4)
  120.     PATCHUSRJSR    $af9c,KbInt
  121.  
  122.     PATCHUSRJMP    $100.W,BeamWait
  123.  
  124.     RELOC_TSTL    trainer
  125.     beq    skip$
  126.     eor.w    #$647f,$6724            ;Setup infinite lives
  127.  
  128. skip$
  129.     JSRGEN    GoECS
  130.     JSRGEN    FlushCachesHard
  131.     move.l    (sp)+,a0
  132.     rts
  133.  
  134. BeamWait:
  135.     divu.w    #$28,D0
  136.     swap    D0
  137.     clr.w    D0
  138.     swap    D0
  139.     JSRGEN    BeamDelay
  140.     rts
  141.  
  142. loadtracks:
  143.     move.l    disknum(pc),d0
  144.     JSRGEN ReadRobSectors
  145.  
  146.     cmp.l    #$51C8FFFE,$156A6
  147.     bne.b    skip
  148.     move.l    #$4EB80100,D0
  149.     move.l    D0,$156A6
  150.     move.l    D0,$156B4
  151.     move.l    D0,$15BCC
  152.     move.l    D0,$15BF8
  153. skip:
  154.     JSRGEN    FlushCachesHard
  155.     moveq.l    #0,D0
  156.     rts
  157.  
  158. swap:
  159.     STORE_REGS
  160.     lea    disknum(pc),a0
  161.     move.l    (a0),d0
  162.     eor.b    #$1,d0
  163.     move.l    d0,(a0)
  164.     RESTORE_REGS
  165.     rts
  166.  
  167. KbInt:
  168.     move.b    d0,$af50
  169.     cmp.b     #$59,d0                ; f10    
  170.     bne    noquit
  171.     JSRGEN    InGameExit
  172. noquit:    cmp.b    #$5f,d0
  173.     bne    _NoTrainer
  174.     cmp.w    #$479,$6724
  175.     bne    _NoFlash
  176.     move.w    #$fff,$dff180
  177. _NoFlash:
  178.     eor.w    #$647f,$6724        ;$479 = no trainer, $6006 = trainer
  179. _NoTrainer:
  180.     rts
  181.  
  182. disknum:
  183.     dc.l    0
  184. trainer:
  185.     dc.l    0
  186.  
  187.