[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Digging Donkey Kong (for possible packing)



On 3 jan, 05:36, Steve Nickolas <lyricalnan...@usotsuki.hoshinet.org>
wrote:
> Replying to myself because LOL STATUS.
>
> I am understanding the program as 3 phases:
>
> 1. Bootstrap phase 1 - that loads the core routines off disk.
> 2. Bootstrap phase 2 - that contains the RWTS and gets the rest of the
> program going.
> 3. Everything else - which uses the code loaded in phase 2 to swap itself
> in and out of memory as needed.
>
> Phases 1 and 2 are track 0 (phase 1 is the boot sector), and will
> correspond to DKONG.SYSTEM in the final version - a relocator to move the
> phase 2 code up to B600-BAFF, (BB00-BEFF will be the buffer ProDOS uses
> during file reads) and an emulation of the phase 2 code.  Phase 3 is the
> bulk of the disk image stored in a file called DKONG.DATA.
>
> The key is, I guess, to make sure the bootstrap is emulated - to minimize
> the amount of patches necessary to DKONG.DATA - and to make sure the
> resulting files are viable.  I guess right now I need to do a boot trace,
> which is something I am really not very well-versed in...lol
>
> -uso.

I'd rather set the memory usage as the following:
- $B700..B7FF: the original RWTS code and IOB
- $B800..$BBFF: the 1 KiB ProDOS file buffer
- $BC00..$BCFF: if necessary, 256 bytes for disk<->RAM manipulation
- $BD00..$BEFF: a rewritten RWTS entry point (handles all RWTS
functions: read/write/format)
- $BF00..$BFFF: the ProDOS MLI buffer

$B7B5 should not be considered as the official RWTS entry point but
the one used to load DOS 3.3. The official entry point if $BD00, set
by DOS 3.3 in a vector in page 3 (can't recall right now).

It would be safer to keep the $B700 page as it contains useful data
(first stage of DOS 3.3 load and a IOB) and the $BD00..$BEFF pages for
a rewritten RWTS entry point.

Your first system file may, first set the ProDOS prefix, then load a
text file divided into two parts:
  DISPLAY NAME OF THE DOS 3.3 PROGRAM 1,PRODOSNAME1
  DISPLAY NAME OF THE DOS 3.3 PROGRAM 2,PRODOSNAME2
Load that list, display it on the screen, let the user select the
program s/he would like to launch.
Upon selection, move the PRODOSNAMEx to $BEF0..$BEFF and use it for
file operations.
Open the file, read page 1, move it to $B700..$B7FF and execute (pass
X=#$60 as an argument)

Your rewritten RWTS entry point should handle read/write/format
(forget about format now). For each sector to load/save, move the
marker in the file. What is great is that it is easy to compute the
track/sector (following info in hex values) into a file position (it
is a three-byte info):
  T0/S0 = FP $000000
  T1/S0 = FP $001000
  T1/S8 = FP $001800
  T8/S9 = FP $008900
  T10/S5 = FP $015000
  T22/S0 = FP $022000
I let you write the TS to file position routine

Eh, that's fun!