Important (for MagicPC Users): Patch 19) only works as planed with a MagicPC version which will be published sometime later in 2000+x.

This patch is supposed to bring the Pure Debugger to modern times. The problem is, that (AFAIK) ASH is not allowed, for license reasons, to make an update by themselves. Therefore somebody else had to do it, without the source code. Since I like using PD I did so.

Problems of PD I know of, their conditions of occurrence, and their status (S = solved, N = not solved, U= understood but still unsolved):
Nr. SNU occurrence Explanation
1 U Multitasking Sometimes at leaving PD the left mouse button seams pressed.
2 S MagiC PC can't start PD as single task.
3 S MagiC... PD does not closes open files on 'Program reset' -> on restart Fopen produces an error.
4 S always PD does not uses XBRA.
5 S always PD redirects vectors but does not test if a program, jumping over these vectors is PD or anybody else -> for example if a program, running parallel to PD finishes (Pterm), PD assumes, that this means, that the program to debug has finished.
6 graphic card changing screen per Setscreen does not work.
7 always On running the first program, PD prints an ESC H -> if a console window (Gemini,...) is open, the Cursor goes to the upper left corner.
8 S Multitasking  sometimes the wrong menu is visible.
9 S MiNT PD does not work at all, I was told.
10 S 2 monitors this is not solving an error, but adding a new feature: you can now run PD on 2 monitors.
11 S ? Sometimes the mouse cursor disappears.
12 S Multitasking PD sometimes tries to get memory at the top end, this routine sometimes fails under multitasking OS and always under MagiC. Normally this has no direct effect, since PD reserves memory at a random position in this case.
13 S ? For some time the one monitor version, including the unpatched PD, crashed when it tried to change the screen by Setscreen. Since changing the method in the option menu didn't helped an other patch become necessary.
14 S >Gemdos 0.19  PD memorizes all Malloc actions to be able to free this memory in program reset. But it ignores Mxalloc.
15 S always View File opens a file, reads it, but never closes it. -> Handles get lost and on OS which test if a file is already open, a file can not be written back again.
16 S PCI-MAC PD tests if a MegaST(E) FPU is present, this test causes a crash on PCI-Macs
17 ? CPU>68030 The Cache is always cleared according on the 68020/30 way.
18 S >= TT In 'Program info' Addresses and Length are given as 6 digit HEX numbers. This is not enough on 32 bit address bus machines.
19 S MagiC PC>6.1  MagiC PC 6.1 has a compiler-modus which is incompatible with PD. Therefore the Compiler is automatically switched off.
20 MiNT/N.AES  PD takes no input from Keyboard. 
21 U always To enter a watch expression a form which accepts 63 characters is used, but only 49 are processed.
22 S Drives>P: Pd only accepts pathes on drives <=P


To add new routines, some addresses in PD have to be known. This addresses are stored in PD_ADDR.DAT. On the first run Patch tries to find this addresses and stores them for future use. But this is not foolproof:

  • The searched routines have changed (different PD version than mine)-> wrong or no address found.
  • Somewhere else something has changed, so that by chance it looks like the routine -> it seams to be found twice.
  • If none or more then one occurrences are found, an error message is issued. Since not all addresses are needed for every patch, you can still try. If a needed address is unknown the patch will stop. For easier control, there will be a text version of pd_addr.dat written: pd_addr.txt

    How does it works

    1. Run PATCH.PRG and answer the questions.
      1. One- or two-monitor-version?: what ever you want. see 10)
      2. May Setscreen be used? (will only be important if patching a 1-monitor PD) First try using Setscreen. Only if this produces a crash then make an other patch and answer with no. see 13)
      3. Use gemdos function instead of BIOS functions for keyboard input? see 20)
      4. When giving out ESC H ?: see 7)
      5. use the CPU-Cache patch? see 17)
      6. use the PCI-MAC patch? see 16)
      7. allow drives > P? Use drive U: in Fileselect box? see 22)
    1. if you wish to run the new PDs out of PC: copy the PD.PRG into the PC-directory. Therefore you have to rename the original PD.PRG.
    2. test it.
    If you want to change something in the patch yourself please set the options in PC as follow:
  • Compiler: -C, -P
  • Assembler: -S
  • Linker -G, -L, -F, Stacksize 100000
  • usually I also have -Y set in all 3 categories, but this is not mandatory. Now I also set this options in the PRJ-File, so setting them explicitly in PC is probably not necessary anymore. If for whatever reasons you are using an other Compiler but PC, don't expect to have no problems.

    The different problems and their solutions

    1) left mouse-button pressed

    Since menus, windows and the like are not drawn by AES in PD, but are drawn directly by VDI on the screen, they are kind of invisible to mouse clicks. The only reason there are not more problems is because PD runs in supervisor mode, but at the end of the program problems occurre. I tried solving this problem using wind_update(BEG_MOUSCTRL) but received some strange effects.

    2) Running PD as single task (MagiC)

    To be able to run PD out of PC in single task I wrote a starter (START_PD). It starts PD by sending a message (AV-Protocol) to the shell. If this shell understands AV it should find out, if PD has to be run in single task and if so starts it in single task. There has been a problem with the desktop EASE, it didn't gave PD the comandline. If you press the ALTERNATE button while starting START_PD it will ask some questions:

  • singletask or multitask?
  • 1 or 2 monitors? (PD_1.PRG or PD_2.PRG)
  • To make it clear, telling the starter to start PD as singletask only works, if the AV-Server does it.

    3) open files

    If at the end of the program (the one to be debugged) or on a break there are still files open, they will still be open on a new run. Some OS like MagiC realize, that this file is tried to be opened for a second time and exit an error. My solution is to log the calls of Fcreate, Fopen and Fdelete. On 'program reset' these files are closed automatically. Until now only handles between 6 and 63 are observed. If this should not be enough, change p_flags in PDX, and all routines using it. But the worst case possible is that PD reacts for files with handle >63 as it used to with any handle.

    4) XBRA

    I introduced a XBRA structure for all routines changed by Setexc. The ID is 'PDeb' for PD_1 and 'PDEB' for PD_2. The XBRA-Implementation is complete now, meaning, that also deinstalling is done by XBRA. But since PD is to be used with unfinished software, this is not always possible. So if the deinstalling routine does not find it's own ID, it will reset the vector to the original state. The reason for using 2 ID's is, to be able to debug PD_1 with PD_2.

    5) identification of caller

    PD does not test who is jumping over changed vectors. In single task this is fine, but not in multitasking. One very 'nice' error occurs, when you end a program running parallel to PD. PD exits the message 'program terminated' and exits the run modus. But the program which was debugged is still running, even after finishing PD! Don't ask me what this can cause for problems (who owns the memory,...). Before finding out I always pressed reset. Now PD saves the address of its Basepage at the beginning. Every time a changed vector (XBRA) is used, it is tested if it's PD or not. Either the original routine is used or the PD one. This patch needs 4) and is needed for 3). For every rule there is an exeption. PD uses the hardcopy Interrupt as a break. (<ALT><HELP>) If this would be only active while PD is executed, this would mean that you have to press <ALT><HELP> for some time. Since this routine only sets a flag, there is no problem of letting it being active even if an other program is executed. This flag is tested during the vertical Blanc routine. Meaning, that the <ALT><HELP> is memorized at all time, but that PD only reacts if there is a vb during the time PD is executed. So if PD does not react try pressing a button, moving a Window of the program debugged,...

    6) Setscreen

    PD reserves ST-RAM for a 2nd and 3rd screen, then it tries out if Setscreen is working. Setscreen would work on some graphic-cards (NOVA,...) if their RAM and not ST-RAM would be used. So I tried to fake the malloc, but without success. The problem seems to be that NOVA-RAM starts at 0xFEC00000 which is negative... . As a partial solution TT-Ram is used in case a graphic card is recognized. By now only NOVA cards are recognized by:

    if (get_cookie('IMNE',(long *)&icb))
    for other graphic cards, the if-condition can either be changed to recognize other cards by adding '||...' or if the card is always used by deleting the "if" totally. X_pd.p_bs_m includes the Mxalloc modus. It is usually 0, but will be changed here to 3. This patch is only included in the one-monitor-patch.

    7) ESC H

    On the first RUN PD prints ESC H, if a console window(Gemini,...) is open, the cursor goes to the upper left corner. If this is wanted or not can be chosen by everybody self. I introduced 3 possibilities:

    1. never printing ESC H
    2. only at the first RUN (as in the original)
    3. at every RUN

    8) Menu title

    In multitasking environments sometimes the wrong menu is visible, even if the right one is active. I didn't found all circumstances under which it occurs. Therefore I only added an automatic redraw of the menu shortly after the start of the program, and for all other cases I added an manual possibility. Just click in the menu line (y<18) and the menu is redrawn. Of course this should be done in the right unused part of the menu. This is only included in the one-monitor-solution, since this problem does not exist with 2 monitors.

    9) MiNT

    I don't know. I never installed MiNT, I am not actually interested in it. But Thomas Künneth and Chris Felsch wrote a starter which makes it possible to run PD under MiNT. I included this starter in my own ( see 2) ) and so it should be possible to use PD under MiNT now.

    10) two monitors

    This was the reason I started writing this patch in the first place. With this version it is possible to use 2 monitors, similar to the very good program, SYSMON. It is quite difficult to redirect AES-output, even more to a different resolution. But luckily this is not necessary, since PD only uses VDI-calls. Therefore it is only necessary to open a OFF-Screen Bitmap and return PD that handle instead to the one expected of v_opnvwk. Besides the mouse cursor has to be drawn by PD itselve. But all this problems are solved under some conditions:

  • VDI which supports OFF-screen bitmaps, either per v_opnvwk2 (NOVA-VDI) or by v_opnbm (NVDI, NOVA and others if the EdDI-cookie is present with version >=1.1)
  • ATARI-compatible monitor and second monitor by graphic card is present.
  • Problems could occur, if a second program, uses two monitors too, but the only other program doing so I know off, SYSMON works together with my one just fine.
    There had been problems with the program BLACKSCR.PRG, which sets all colors of the 2nd monitor to black. This has only an effect in the monochrome mode on TTs. Therefore if it is a TT I now set the colors to black/white. Now I use a PC with MagiC PC. Since there I only have one monitor, I can actually not use this feature myself anymore.

    11) disappearing mouse cursor.

    As I never observed this error while using my TT, which probably is mainly caused by the fact, that I almost always used PD with 2 monitors, I only introduced a symptomatic solution. Now on the PC I did had that error, but debugging PD while it is debugging on a one monitor machine would be verry difficult. So if the cursor disappears, just press the right mouse button and it should reappear.

    12) Malloc for high memory

    While trying to further improve my XBRA implementation (see 4)) I analyzed a routine and realized, that it had 2 errors. PD sometimes try to get memory at the top end. Therefore it first reserves all memory (in a loop containing Malloc(-1)), but this fails if a other program reserves memory in the meantime. This could be solved by changing the break - condition. Then PD looks for the highest so reserved block and tries to split it so, that the top part gets the needed size. This doesn't function under MagiC, since there 32 extra Bytes are reserved with any Malloc. For example if the Block has 3000 Byte and PD needs 1000, PD shrinks (Mshrink) the Block to 2000 and tries to reserve 1000. But under MagiC there are only 968 Bytes left. To be on the safe side I now always shrink to 64 Bytes less then required under TOS -> I spoil 64 Bytes under TOS, 32 under MagiC. But maybe some other OS needs more. Of course I could calculate the exact length needed, but to save a few byte this is not sensible, certainly not if the produced code would be longer than the saved memory.

    13) Setscreen for 1 monitor

    This patch is optional and should only be used if PD otherwise does not run. I just exchanged the original Setscreen by an empty function:
    this works because PD checks after using Setscreen if it was successful, and if not uses an other way of changing the screen.

    14) Mxalloc

    Since I already introduced my own Fopen, Fcreate and Fclose I decided to include a complete Version of the Gemdos Dispatcher into the Patch. This also includes Mxalloc, where, as with Malloc in the original PD, all memory allocation is memorized.

    15) View File

    View File opens a file, reads it, but never closes it. -> Handles get lost and on OS which test if a file is already open, a file can not be written back again. Therefore I included a Fclose.

    16) PCI-MAC

    Now it is possible to deactivate the test for an MegaST(E) FPU so it should work an PCI-MACs, which I can not test myself.

    17) Delete Cache

    The Cache can now be cleared alternatively on the 68020/30 or 68040 way or not at all. To decide which method to use, the _CPU cookie is analyzed. This patch is in a ß-stadium, I can not test it, so please if you can tell me if it works and if not try to change the routine clear_cpu_0 in PD_LIB_s.s.

    18) Programm info

    I increased the size of the output of the addresses and length to 8 digit.

    19) MagicPC Compiler-mode

    The new MagicPC compiler mode causes problems with PD, for example there are problems with the keyboard. Therefore the compiler is switched off by PD. This does not work with MagicPC6.1 (before 7.OCT.99), so the compiler has to be switched off by hand (get an update). And with versions before 2000 the compiler will always be switched on at the end. With the next MagicPC Version it will be returned to the status at which PD was started.


    MagiCPC Version Compiler mode controlable per Software Problems with PD
    <6.10 no no all OK
    6.10 before 7.OCT.99 yes only manually Problems with keyboard entries
    6.10 of 7.OCT.99 yes switching on/off : yes, checking actual state : no PD doesn't restores state at the end but always switches compiler on.
    after 1.1.2000 yes checking too all OK

    20) No keyboard input under MiNT/N.AES

    Under some configurations PD takes no input from keyboard. This is due to the fact, that there is a problem with this configurations and input by BIOS functions. This is no error of PD but can be solved here. The solution is to use Gemdos functions instead.

    21) Watch

    PD uses for some entries the same form, in which only the title is set accordingly. This form accepts entries up to 63 characters. But internally PD only works with watch expressions of 49 characters. So the last characters entered may be ignored. It is almost impossible to change the length of the watch expressions by a patch. And since the form (and the routine behind it) is used for other entries too, I also can't shorten the length there. So I only mention this error here.

    22) Drive>P

    PD only allows Pathes on Drives <=P, this can now be eliminated. To be able to access all this extra drives from the fileselect box, it is now possible, to change PD so, that instead of a button for drive P:, there is one for U:. On most OS which allow drives >P, there´ll be also this drive U, which allows to access all drives as directories, i.e. U:\R\ instead of R:\ .

    23) other changes

    as said in 9) I will try to solve other problems with PD anybody tells me off. It has a good reason, that I include the source code. So anybody can include patches by himself, this is needed either when I am not reachable or if it's a problem I don't have with my configuration. But I recommend, that every change/addition is brought to my attention. Then I'll include it in a new public version. This definitely includes the case, that GET_ADDR doesn't find an address by itself but you find it by yourself.


    This program is Fairware, it may be copied freely, but if somebody needs to get rid of some money...


    On no circumstance PD, either the original or a patched version may be exchanged without the prior approval of ASH. This program may only be used to patch officially bought versions of the Pure Debugger. This is especially true, since some routines (xbra_exc and xbra_Gd_trm) included in the source code are variations of the original PD code. These are specially marked. Exeption, I will give a patched version to ASH. Probably they will put it in their BOX, so that it is accessible to registered users. But since there are some options on patching PD, this is only 2nd best to patching it by yourself.

    Used product names are registered trademarks.


    Thanks to

    Bernhard Held volunteered as ß-tester.
    Thomas Künneth and Chris Felsch for their Mint-starter
    Wilfried Behne for his help in searching an error (in my patch) in connection with NVDI.
    Oliver Buchmann for answering many question about MagicPC.


    Dimitri Junker
    Adenauerallee 30
    52066 Aachen
    for normal mails (<16k):Dimitri_Junker@AC2.Maus.De
    for long mails (>16k):Dimitri.Junker@EPost.De