Re: Request for IBM Program to Clean /CMD Files - Response 3
- From: "Lord Apollyon" <google@xxxxxxxxx>
- Date: 22 Jul 2005 11:33:45 -0700
David S wrote:
> (Or if this vector code appears.-? Can someone explain the vector
> table issue more?)
On most Disk-based operating systems (but oddly, not TRSDOS 1.3), the
vectors which tie into the keyboard input and display routines are
modified to point to code within the DOS. Low address loading software
(TAPE and especially programs designed for 4/16KB RAM systems), load
right on top of DOS unless they're relocated. Most people are aware of
this issue from the perspective of avoiding the DOS trample upon load,
but many don't realise you also have to be careful to reset the vectors
to the ROM defaults.
I wrote a tiny scrap of code to do this properly for both Model I and
Model III systems when I created a "merged" Haunted House for Ira's
archive. It had two fragments, the second of which was loaded by the
first when you reached a certain section of the game. In my patched
version of this, there was a secondary relocation and dispatch so it
continued along instantly (the first section was torched of course, but
it was like this in the original game which was designed for 4KB
systems). See below for the code (with opcodes).
I would caution against trying to be "too clever" with LDIR (EDB0)
pattern detectors and whatnot... 99% of the games requiring relocation
ARE single block relos + dispatches, but some might be tricky. I can
remember having to do multi-segment relos and unusual dispatches for a
game or two back then.
> The same launcher could scan the code for calls for "Model I Only"
> keyboard input routines--the common high score table lock-up issue--and
> thus flag a file with the requirement of "Cassette BASIC Only".
>
> Although from reading this thread, am I being told that this common
> lock up problem really was due to DOS clobbering some BASIC vector
> tables that were used for a common keyboard input routine? I never
> understood why some versions of games would hang on the high score
> table input. This was common with early Big Five games.
It's easily avoided... tiny bits of code to reset the vectors would
solve it. Using TRSDOS 1.3 instead of almost any other DOS (Model III)
would also avoid the problem.
=Lord Apollyon=
(Poster Emeritus)
;
; ancient tape software relocator/ROM-vector fixer-upper
; (tested on Model Is and IIIs, as well as Model III mode of
; the Model 4)
;
; contributed by Lord Apollyon
;
; the following symbols are just an example....
;
relocated_code equ 6000h
; this is a nice relo area - well past DOS
original_code equ 42e9h
code_size equ 0dffh
entry_point equ 42e9h
0000 F3 di ; disable the interrupts -
; just in case
0001 CD1A00 call getvectors
0004 110040 ld de,4000h
0007 EDB0 ldir
; we've installed ROM's RST and keyboard/screen vectors
0009 210060 ld hl,relocated_code
000C 11E942 ld de,original_code
000F 01FF0D ld bc,code_size
0012 EDB0 ldir
0014 CDC901 call 01c9h ; clear the screen
;
; important !!! don't use 01c9 to clear the screen if the vectors
; are dangling in nowhere land. CLS is implemented as a pair of
; control calls to the *DO driver. You get big boom-boom if
; *DO is whacked.
;
0017 C3E942 jp entry_point
001A getvectors:
001A 21AA36 ld hl,36aah
001D 014C00 ld bc,004ch
; Model 1 (0004h=06) while Model 3 (0004h=30h)
0020 3A0400 ld a,(0004h)
0023 FE30 cp 30h
0025 C8 ret z
;
; this is the Model I vector area and size (all 3 Model 1 ROM
; versions checked)
;
0026 21D206 ld hl,06d2h
0029 013600 ld bc,0036h
002C C9 ret
.
- Follow-Ups:
- Re: Request for IBM Program to Clean /CMD Files - Response 3
- From: Knut Roll-Lund
- Re: Request for IBM Program to Clean /CMD Files - Response 3
- From: NSM
- Re: Request for IBM Program to Clean /CMD Files - Response 3
- References:
- Request for IBM Program to Clean /CMD Files
- From: Ira
- Re: Request for IBM Program to Clean /CMD Files
- From: Mark McDougall
- Request for IBM Program to Clean /CMD Files - Response 1
- From: Ira
- Re: Request for IBM Program to Clean /CMD Files - Response 1
- From: Larry
- Request for IBM Program to Clean /CMD Files - Response 2
- From: Ira
- Re: Request for IBM Program to Clean /CMD Files - Response 2
- From: Tim Mann
- Re: Request for IBM Program to Clean /CMD Files - Response 2
- From: Mark McDougall
- Re: Request for IBM Program to Clean /CMD Files - Response 2
- From: David Librik
- Re: Request for IBM Program to Clean /CMD Files - Response 2
- From: NSM
- Re: Request for IBM Program to Clean /CMD Files - Response 3
- From: Ira
- Re: Request for IBM Program to Clean /CMD Files - Response 3
- From: David S
- Request for IBM Program to Clean /CMD Files
- Prev by Date: Re: Request for IBM Program to Clean /CMD Files - Response 3
- Next by Date: Re: Request for IBM Program to Clean /CMD Files - Response 3
- Previous by thread: Re: Request for IBM Program to Clean /CMD Files - Response 3
- Next by thread: Re: Request for IBM Program to Clean /CMD Files - Response 3
- Index(es):
Relevant Pages
|