home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Various Unprotection Examples
/
unprotect.zip
/
unprotect
/
SPYHUNT
/
SPYHUNT.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-05-12
|
13KB
|
300 lines
page ,132
title Spy Hunter
;spyhunt.asm -- loader program for Spy Hunter
; The Ross DOS
; 5-27-86
; From a great southern Engineering / Science college
CR equ 13 ;carriage return
LF equ 10 ;line feed
cseg segment para public 'code'
assume cs:cseg,ss:stack ;already set by DOS loader
cosmic proc far ;entry point from dos
push ds ;set up the stack to
xor ax,ax ; the double word vector so the
push ax ; far return will go back to dos
mov ax,dseg ;set up addressability to
mov ds,ax ; the data segment
assume ds:dseg ;tell the assembler what I did
;switch to the color monitor
push es ;save the extra segment
mov ax,0 ;set the
mov es,ax ; extra segment to 0
mov bx,449h ;offset
mov byte ptr es:[bx],2 ;80-colomn text, no color, CGA
pop es ;restore the extra segment
;set video mode
mov al,2 ;mode, text 80x25
mov ah,0 ;service 0 of int 10h
int 10h ;set video mode
;turn off the screen
mov dx,3d8h ;CGA port to set mode
mov al,0001b ;set bit 3 off to turn video off
out dx,al ;set new mode
;display text
mov dx,offset text1 ;data address
mov ah,9h ;service 9h of int 21h
int 21h ;display text
;turn on the screen
mov dx,3d8h ;CGA port to set mode
mov al,1001b ;set bit 3 on to turn video on
out dx,al ;set new mode
;wait for a key
mov ah,8h ;service 8h of int 21h
int 21h ;wait for a key
;display text
mov dx,offset text2 ;data address
mov ah,9h ;service 9h of int 21h
int 21h ;display text
;modify memory block allocated by DOS
;the extra segment is already set
mov bx,10h ;skip to the end of the PSP
mov ah,4ah ;service 4ah of int 21h
int 21h ;free memory
;allocate enough memory
mov bx,gsize ;memory game program needs
mov ah,48h ;service 48h of int 21h
int 21h ;allocate memory
jnc sabs ;jump if no error
jmp err1 ;jump on error
sabs: mov buffer,ax ;save allocated buffer segment
;open the program file
mov dx,offset file ;data address
mov al,0 ;read only
mov ah,3dh ;service 3dh
int 21h ; of int 21h
jnc rtf ;jump if no error
jmp err2 ;jump on error
;read the file into memory
rtf: mov bx,ax ;bx is the file handle
mov ax,ds ;save the data segment
mov es,ax ; using the extra segment
mov cx,28 ;read in 28 tracks (112 KB)
mov ax,buffer ;get the buffer's segment address
mov ds,ax ;ds now starts at the buffer
rfm: push cx ;save the count
mov dx,0 ;buffer offset is 0
mov cx,1000h ;read in 4 KB of data
mov ah,3fh ;service 3fh of int 21h
int 21h ;read in part of the file
pop cx ;restore the count
jnc ids ;jump on no error
jmp err3 ;jump on error
ids: mov ax,ds ;increment the data segment
add ax,100h ; by 100h
mov ds,ax ; which is 4 KB (absolute address)
loop rfm ;loop and finish the count
;restore the data segment
mov ax,es ;get the data segment from
mov ds,ax ; the extra sement
;close the file
mov ah,3eh ;service 3ef of int 21h
int 21h ;close the file
jnc wuds ;jump on no error
jmp err4 ;jump on error
;wait until the drive stops
wuds: mov ax,0 ;set the
mov es,ax ; extra segment to beginning of memory
wait: mov al,es:[43fh] ;get the byte which has the drive status
cmp al,0 ;is it zero?
jne wait ;no, then loop until it is
;reset the int 8h vector
mov ax,0 ;set the
mov es,ax ; extra segment to beginning of memory
mov bx,8h*4 ;vector offset
mov ax,int8h ;offset
mov cx,rom ;segment
mov es:[bx],ax ;reset vector offset
mov es:[bx+2],cx ;reset vector segment
;reset the int 9h vector
mov ax,0 ;set the
mov es,ax ; extra segment to beginning of memory
mov bx,9h*4 ;vector offset
mov ax,int9h ;offset
mov cx,rom ;segment
mov es:[bx],ax ;reset vector offset
mov es:[bx+2],cx ;reset vector segment
;reset the int 16h vector
mov ax,0 ;set the
mov es,ax ; extra segment to beginning of memory
mov bx,16h*4 ;vector offset
mov ax,int16h ;offset
mov cx,rom ;segment
mov es:[bx],ax ;reset vector offset
mov es:[bx+2],cx ;reset vector segment
;reset the int 1bh vector
mov ax,0 ;set the
mov es,ax ; extra segment to beginning of memory
mov bx,1bh*4 ;vector offset
mov ax,int1ch ;offset
mov cx,rom ;segment
mov es:[bx],ax ;reset vector offset
mov es:[bx+2],cx ;reset vector segment
;reset the int 1ch vector
mov ax,0 ;set the
mov es,ax ; extra segment to beginning of memory
mov bx,1ch*4 ;vector offset
mov ax,int1ch ;offset
mov cx,rom ;segment
mov es:[bx],ax ;reset vector offset
mov es:[bx+2],cx ;reset vector segment
;move the program down to low memory
push ds
mov si,0 ;source offset
mov di,0ff1h ;destination offset
mov ax,buffer ;set the data segment
mov ds,ax ; to the buffer
mov ax,100h ;set the extra segment
mov es,ax ; to low memory
mov cx,0e000h ;move 56 KB
rep movsb