Advertisement
Guest User

An old trainer for the MS-Dos version of Arkanoid II

a guest
Jul 21st, 2011
2,396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ****************************************************************************
  2. ; *                                                                          *
  3. ; *  RESIDENT TRAINER FOR ARKANOID II     -   by MWPC2                       *
  4. ; *  This is part of LE GRAND MANITOU.                                       *
  5. ; *                                                                          *
  6. ; *  Feel free to reuse this source.  Please do not forget the credit.       *
  7. ; *                                                                          *
  8. ; *  Source for TASM 3.2.    8086 code.                                      *
  9. ; *                                                                          *
  10. ; *  Assemble with: TASM ARKA2TRN                                            *
  11. ; *                 TLINK ARKA2TRN /t                                        *
  12. ; *                                                                          *
  13. ; ****************************************************************************
  14.  
  15.  
  16. ; First, we declare a segment.
  17. MYSEG           segment byte 'CODE'
  18.                 assume cs:MYSEG
  19.                 org     0100h           ; needed for a COM file
  20.                 assume es:MYSEG, ss:MYSEG, ds:MYSEG
  21.  
  22. start:          jmp     realstart
  23.  
  24. ; ====RESIDENT PART==========================================================
  25.  
  26. ; New INT 21h handler
  27. int_21h:        pushf
  28.                 cli
  29.                 cmp     ah,3Dh          ; is it "open file" function ?
  30.                 jnz     giveup2         ; if not, give up.
  31.                 push    ax
  32.                 push    bx
  33.                 push    cx              ; we save ALL registers
  34.                 push    ds
  35.                 push    si
  36.                 push    es
  37.                 push    di
  38.  
  39.  
  40.         ; We search where segment the INT 21h has been called from.
  41.  
  42.                 push    ss
  43.                 pop     es
  44.                 push    sp
  45.                 pop     di
  46.                 mov     ax,word ptr es:[di+18]
  47.  
  48.         ; At this point, AX contains the segment CS where the INT 21h
  49.         ; was called from.
  50.  
  51.         ; Now we compare the program that called INT 21h with a footprint
  52.         ; of the original ARKANOID executable.
  53.  
  54.                 mov     es,ax
  55.                 mov     di,0c7ah
  56.  
  57.                 push    cs
  58.                 pop     ds
  59.                 mov     si,offset datatsr
  60.  
  61.                 mov     cx,8   ; 8 words (16 bytes) to compare.
  62.                 cld
  63.  
  64.                 rep     cmpsw   ; compare word at DS:SI with ES:DI
  65.                 jnz     giveup  ; if different, then give up.
  66.  
  67.  
  68.         ; It's ok... let's kill the instruction that decrements the lives
  69.                 mov     di,0c7ah
  70.                 mov     ax,09090h    ; 90 is the opcode for the NOP instruction
  71.                 stosw                ; The NOP instruction does NOTHING.
  72.                 stosw
  73.                 stosw           ; we write 3*2=6 NOPs.
  74.  
  75. giveup:         pop     di
  76.                 pop     es
  77.                 pop     si
  78.                 pop     ds
  79.                 pop     cx      ; we restore all registers
  80.                 pop     bx
  81.                 pop     ax
  82. giveup2:        popf
  83.         ; * We call the old INT 21h
  84.                 jmp     cs:dword ptr [offset OLDINT21]
  85.  
  86.  
  87. ; Original INT 21h vector (adress)
  88. OLDINT21        dd 0h
  89.  
  90. ; Footprint of the original ARKANOID 2 executable
  91. datatsr:        db      0feh,00eh,097h,004h,074h,01fh,0c3h,080h,03eh,04dh
  92.                 db      00ah,001h,074h,03eh,0feh,006h
  93.  
  94.  
  95. ; =======END OF RESIDENT PART==================================================
  96.  
  97.  
  98. useless:        db      '°Û±'   ; this is a useless french flag... tatata...
  99.  
  100. realstart:
  101.  
  102.         ; We get the old INT 21h vector and we save it.
  103.                 mov     ax, 3521h
  104.                 int     21h
  105.                 mov     word ptr CS:[offset OLDINT21],bx
  106.                 mov     word ptr CS:[offset OLDINT21+2h],es
  107.  
  108.         ; Installation of the new INT 21h handler.
  109.                 push    cs
  110.                 pop     ds
  111.                 mov     dx, offset int_21h
  112.                 mov     ax, 2521h
  113.                 int     21h
  114.  
  115.         ; Print out some silly texte...
  116.                 push    cs
  117.                 pop     ds
  118.                 mov     dx,offset text
  119.                 mov     ax,0900h
  120.                 int     21h
  121.  
  122.         ; Hop... the program is resident.
  123.                 mov     ax,3100h
  124.                 mov     dx,offset useless
  125.                 mov     cl,4
  126.                 shr     dx,cl
  127.                 inc     dx
  128.                 int     21h
  129.  
  130.  
  131. text            db 13,10
  132.                 db ' >>> ARKANOID II : REVENGE OF DOH  [+1] trainer <<<       by  ÄÍðMWPC2ðÍÄ',13,10,13,10
  133.                 db '      - unlimited lives',13,10,13,10
  134.                 db ' Just another quick & dirty trainer...',13,10
  135.                 db ' Ok, resident part installed.',13,10,'$'
  136.  
  137.  
  138. MYSEG           ends
  139.                 end    start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement