home *** CD-ROM | disk | FTP | other *** search
- ; TURBO PASCAL VERSION 3.0 PATCH BY JAY SAGE, 04/22/85
-
- ; This code patches TURBO Pascal Version 3.0 so that it will find the
- ; error message overlay file TURBO.MSG in a different user area (given
- ; by the equate TUSER below). The patch is appended to the standard code
- ; but relocates itself higher in memory so that it is not overwritten by
- ; the error message text as it is loaded. The call at address 2232h is
- ; the one made if the question about including the error messages was answered
- ; in the affirmative. The call is replaced by a conditional call to this
- ; patch code. The patch code in turn calls the original code, but only after
- ; the user number has been switched to the special value. After the MSG file
- ; is loaded, the patch code re-logs the original user area. This patch does
- ; nothing about the logged drive, since Turbo itself tries a number of drives.
- ; My directory TURBO: is on drive A and is always found. If this patch fails
- ; to find the right drive for you, try adding code to log in the desired
- ; drive in the same way. Remember that the relocated code has no absolute
- ; addresses so that it can simply be copied to its new location.
-
-
- tbdos equ 7265h ;Turbo's BDOS call (protects IX, IY)
- userf equ 20h ;BDOS get/set user number function
- tuser equ 2 ;user number of TURBO: directory
- dest equ 9000h ;destination for relocated section (above
- ;..area used for messages)
-
- ; --------------------
-
- org 2232h ;original code to patch
-
- call nz,patch
-
- ; --------------------
-
- org 7980h ;new code to append to original code
-
- patch:
- push hl ;save registers
- push de
- push bc
-
- ;relocate patch code to safe area
-
- ld hl,pbeg ;source of code to move
- ld de,dest ;destination
- ld bc,pend-pbeg ;length of section to move
- ldir ;move it
- jp dest ;continue with moved code
-
- ;code to be relocated
-
- pbeg:
- ld c,userf ;get current user #
- ld e,0ffh
- call tbdos
- push af ;save user number
-
- ld c,userf ;log in Turbo user area
- ld e,tuser
- call tbdos
-
- call 2da4h ;call Turbo code for loading TURBO.MSG
-
- pop af ;restore user number
- ld e,a
- ld c,userf
- call tbdos
-
- pop bc ;restore registers
- pop de
- pop hl
- ret
-
- pend equ $ ;mark end of code for relocation
-
- end
-