[comp.sys.atari.st.tech] How to intercept TOS vectores

micro@imada.ou.dk (Klaus Pedersen) (05/20/91)

I have collected the following BAD things from the Overscan driver at 
atari.archive. I post this in the hope that this can stop BAD things!
 
- move SR,Dx - the instruction was used to check if the CPU 
  was in USER or SUPER mode!!! The instruction can be used 
  to that on all 680x0 cpus, but cpu's later than the 68000 
  will tell you, that the cpu is in user mode with a PRIVILEGE 
  VIALTION exception.

- the new 68K cpus put more on the stack when processing an exception
  this means that the offsets to parameters from within the trap 
  dispatchers are diffrend on new (10/20...) cpus. To fix this it is
  possible to use the new system variable 'longframe'. 

- remember that GEMDOS, XBIOS, BIOS is documented to change
  D0-D2/A0-A2, this means that you should be able to use them too,
  If is wasn't for TurboC and many other applications, that consider
  A2 safe! (use as few registers as possible and don't use D3-D7/
  A2-A6)!
  AES and the VDI are special! Here you can't even A0 and A1 and
  D0 and D1 is used to pass parameters! (Save all registers!)

The next don't have anything thing to do with Overscan:

- Remember to use the XBRA protocol, when taking a vector, there
  is nothing to it. Put the following just about the entry point

  XBRA_ID:   DC.B 'XBRA'    ; Tell that the XBRA is used. 
  APPL_ID:   DC.B 'name'    ; your identifyer (like cookies)
  OLD_VEC:   DS.L 1         ; Save the old vector here!
entry:

- When you use the VDI, then remember to get the handle for the
  Screen from the AES, with graf_handle(). It is really painfull
  to use a program that don't, when AMCGDOS is installed:
     "Your application uses illigal handles!", 
  SFX_PAK, CAL4.7 (or something) and many DC-utilities comes to 
  mind.

Do you have any things that you would hope people stopped doing, besides
minding their own business.


   LINK INTO GEMDOS
=====================  
longframe       EQU $059E

                DC.B "XBRAnnnn" ; This is all XBRA is about
OldDos:         DC.L 0          ; place the old address here!
MyDos:          move    USP,A0
                btst    #5,(SP)      ; called from Supervisor- or User-mode?
                beq.s   tst_funcs    ; Parameter is on USER stack
                lea     6(SP),A0     ; Old (small) stack frame.
                tst.w   longframe.w  ; Is this running on a CPU
                beq.s   tst_funcs    ; with a long stackframe?
                addq.w  #2,A0        ;    -then add 2 more bytes.
tst_funcs:      cmpi.w  #Pterm0,(A0) ; Check the FUNCTION numbers!
                bne.s   notmine

... here do the stuff you need to do ...
 
notmine:        movea.l OldDos(PC),A0 ; Now return to the original!
                jmp     (A0)


   LINK INTO VDI/AES
======================
magicAES        EQU  200
magicVDI        EQU  115

                DC.B "XBRAnnnn"
OldVec:         DC.L 0
MyGem:          cmpi.w  #magicVDI,D0    ; Is it a [VDI]-call ?
                bne.s   NotMyGem1       ;   no -> continue
                movem.l A0-A1,-(SP)     ; preserve all A-Regs!
                movea.l D1,A1           ; Address of VDI-Parameters
                movea.l (A1)+,A0        ; Control[0] = function number
                cmpi.w  #func,(A0)      ; Check the FUNCTION numbers!
                bne.s   NotMyGem        ;    not mine -> next; 

... here do the stuff you need to do ...

NotMyGem:       movem.l (SP)+,A0-A1
NotMyGem1:      move.l  OldVec(PC),-(SP) ; call Orginal GEM-dispatcher
                rts                     ; ... call

---
Klaus, micro@imada.ou.dk    

uace0@menudo.uh.edu (Michael B. Vederman) (05/20/91)

In article <1991May19.185424.18475@imada.ou.dk> micro@imada.ou.dk (Klaus Pedersen) writes:
>
>- When you use the VDI, then remember to get the handle for the
>  Screen from the AES, with graf_handle(). It is really painfull
>  to use a program that don't, when AMCGDOS is installed:
>     "Your application uses illigal handles!", 
>  SFX_PAK, CAL4.7 (or something) and many DC-utilities comes to 
>  mind.
>
>---
>Klaus, micro@imada.ou.dk    

WRONG!  WRONG!  WRONG!

Only our very old DC Formatter prior to version 3.0x had this problem (and
still do, since they obviously still exist on someone's system somewhere).
We basically cut our teeth on that program.

Many DC Utilties my ass!  I can gurantee we know a lot more about the operation
of TOS and GEM than 99% of the folx (including you) out there.

If you have hard evidence, I will recend my statement.  Until then, it is slop!

- mike vederman

-- 
------------------------------------------------------------------------------
Double Click Me | Double Click Software | P.O. Box 741206 | Houston, Tx, 77274
------------------------------------------------------------------------------
Voice: (713)977-6520 | DC DESKTOP | DC FORMATTER | DC UTILITIES | and others

ki@opal.cs.tu-berlin.de (Karsten Isakovic) (05/21/91)

In article <1991May19.185424.18475@imada.ou.dk> micro@imada.ou.dk (Klaus Pedersen) writes:
>I have collected the following BAD things from the Overscan driver at 
>atari.archive.

I would be happy, if you always state, that you are talking of the
_very_old_PD_ overscan driver and not the actual driver. Everthing you
mention was fixed since january 1990.

> I post this in the hope that this can stop BAD things!
This is what i am doing in the german MAUS net. But in most cases i write
directly to the people, so they are not 'flamed' for their bugs and have a
chance to fix them.

>Klaus, micro@imada.ou.dk    
Karsten, ki@opal.cs.tu-berlin.de

micro@imada.ou.dk (Klaus Pedersen) (05/22/91)

I am very sorry, I will go somewhere where I can not harm people, sorry.

I would only help _the_other_ people, not flame anyone! 
I kind of cry when I see a great pice of software like the Calender, or great 
Idea like SFX and DC-desktop and it then don't work! 

The Idea I had was that if I could show what people did wrong, other people
did not have to do the errors. 
- and ultimately I could get more good programs! 

I was wrong, people don't care about quality. Many people blame TOS for many
bugs. I have heard people claim that there is a bug in the AES that means
that it can drop the menus while the VDI is drawing (also long time programmers
that would claim that they was among the best 1% of programmers). 
And who blames them, there are so many programs that do just that. (also 
Commercial)
And who belive you when you tell them that it is a bug in the programs, and
not in the operating system. (some even suggest that the programs that work
correctly, uses some kind of workaround!)

I had a list of topics. On top of the list was the use of 'wind_update()'.


-Klaus... (leaving). 

uace0@menudo.uh.edu (Michael B. Vederman) (05/23/91)

In article <1991May21.185858.2974@imada.ou.dk> micro@imada.ou.dk (Klaus Pedersen) writes:
>
>I am very sorry, I will go somewhere where I can not harm people, sorry.
>
>I would only help _the_other_ people, not flame anyone! 
>I kind of cry when I see a great pice of software like the Calender, or great 
>Idea like SFX and DC-desktop and it then don't work! 
>
>-Klaus... (leaving). 


No one is asking you to leave, but if you are going to make claims about
software that doesn't work (especially when the company that makes the
software is on the net AND when you have never complained OR registered
that company's software directly with the company), then you had better
substantiate your post!

You are once AGAIN making an unsubstatiated claim about our software!

DC Desktop DOES work, and we have _many_ satisfied customers!  DC Desktop,
however, is _highly_ ROM specific in order to wedge in and supplement the
OS functions.  If you have problems running our software, I would ask you
two questions:

1) Why not contact us directly, instead of spreading unsupportable claims?

2) Have you contacted our Netherland distributor, who has a specific version
   for the ROMs you probably have?

- mike vederman

-- 
------------------------------------------------------------------------------
Double Click Me | Double Click Software | P.O. Box 741206 | Houston, Tx, 77274
------------------------------------------------------------------------------
Voice: (713)977-6520 | DC DESKTOP | DC FORMATTER | DC UTILITIES | and others

micro@imada.ou.dk (Klaus Pedersen) (05/24/91)

I just want to continue my list of bad programming pratice, but without
examples.

  - Don't use ScanCodes to check for any key on the main keyboard, use them
    only to check for HELP, UNDO, Fx, ESC ...
    Don't use it for 'Z', 'Y', '[', or any other. If you use ALT+key, then
    use the KeyBoardTable to convert the scancode to ASCII, then check that.
    Don't replace the buildin Keyboardtable ('cept if that is what your program
    is supposed to do).

  - Remember to use wind_update(BEG_UPDATE)/wind_update(END_UNDATE), when
    you are drawing on the screen. To avoid an other process smears the screen
    (eg ScreenMgr)

  - Don't assume that because you only have one window, that you then don't 
    have to process WM_REDRAW or VM_TOP/WM_NEWTOP messages.

  - When you Allocate memory, then remember to leave some (8Kb+) for AES,
    VDI, GEMDOS, and accessorys. On a related subject, don't : 
          p = Malloc( (long) int_var);
    This will work if int_var is less than 32Kb, else it will fail big!
    The strange thing is that if replace it with a 'malloc-stdio' then
    it will probaly work, because it often is suppost to take int vars.

  - Don't mix BIOS/GEMDOS screen output (input?) with a Gem program. There 
    might come graphics cards that jump into textmode when it is told to 
    output text like (PC's).
  
  - Stop using the LineA routines. (I need help on this - also Init?).


-Klaus, micro@imada.ou.dk

micro@imada.ou.dk (Klaus Pedersen) (05/25/91)

uace0@menudo.uh.edu (Michael B. Vederman) writes:
>No one is asking you to leave, but if you are going to make claims about
>software that doesn't work (especially when the company that makes the
>software is on the net AND when you have never complained OR registered
>that company's software directly with the company), then you had better
>substantiate your post!

Now you wait a second, the software is shareware (or it might have been
a demoversion). It is therefor my right to try the software first and if
it don't work - then erase it from my harddisc, right? 
You can't expect that I pay for software I can't use, can you? If you can
then I have some ideas to make big money! 
Whats more, you can't expect that anyone with TOS 1.4 or the least programming
skill will pay money for a formatter! 

>You are once AGAIN making an unsubstatiated claim about our software!

again, correct me if it is wrong, I tried a formatter of yours, I could not
use it, now why should I try any other of your products?
Ok, I did try another(dcdesktop), and it did not work (not everybody have
an english desktop - and as you probaly can see english is not my main 
language, so there might have been a slight chance that that was the case, 
right?).

>DC Desktop DOES work, and we have _many_ satisfied customers!  DC Desktop,
I think it depends on who you are!
I would not be satisfied with software that took chances with undocumented
variables/text/functions.
And I hope for all the people that have bought your software that _you_
stay with Atari for many TOSses.

>however, is _highly_ ROM specific in order to wedge in and supplement the
>OS functions. 

Yes that is the problem when you have spent to many hours with a disassembler
in the area about 0xE0_0000. One can not resist the temptation - right?

> If you have problems running our software.
>1) Why not contact us directly, instead of spreading unsupportable claims?

I did not contact you because when I needed a formatter (PC-comp.) I tryed
out many diffrend ones (yours included), and If I should have mailed to all
the people with formatters that did not work, I would probaly still be mailing
today. And I did find a better alternative (FreeWare with source).

As I said in my previous post, it was not my intension to flame anybody, but
rather to give an example that people could relate to, and I thought that 
people knew your software - right...

This is becomming annoying, I wanted to help newcommers writing better software
and I end up arguing with a long time hacker. 

Klaus, micro@imada.ou.dk

>- mike vederman

uace0@menudo.uh.edu (Michael B. Vederman) (05/25/91)

In article <1991May24.175604.21137@imada.ou.dk> micro@imada.ou.dk (Klaus Pedersen) writes:
>uace0@menudo.uh.edu (Michael B. Vederman) writes:
>>No one is asking you to leave, but if you are going to make claims about
>>software that doesn't work (especially when the company that makes the
>>software is on the net AND when you have never complained OR registered
>>that company's software directly with the company), then you had better
>>substantiate your post!
>
>Now you wait a second, the software is shareware (or it might have been
>a demoversion). It is therefor my right to try the software first and if
>it don't work - then erase it from my harddisc, right? 

You are correct about DC Formatter, it is shareware.  And as such, you have
every right to do whatever you deem necessary with it (including, but not
excluding FILE 13 - the trash).

If you were paying attention, I wasn't referring to that, but rather
DC Desktop.

Your original post (to paraphrase) said somethin like: "Many programs suffer
this problem, several come to mind including DC Stuff..."

Such a broad sweeping statement deserves attention and immediate rebuttal.


>You can't expect that I pay for software I can't use, can you? If you can
>then I have some ideas to make big money! 
>Whats more, you can't expect that anyone with TOS 1.4 or the least programming
>skill will pay money for a formatter! 
>
>>You are once AGAIN making an unsubstatiated claim about our software!
>
>again, correct me if it is wrong, I tried a formatter of yours, I could not
>use it, now why should I try any other of your products?

Again, you can act as you like, at least over here, it is a free country and
I respect your right to do what you want.  HOWEVER (and this is a big HOWEVER)
you do not have the right to hurt someone else (or attempt to damage someone's
or some company's reputation) in doing so.

Your unsupported claims caused my zealous reaction.

I have already conceeded DC Formatter's problem with opening a bad VDI handle,
but this will not affect you (usually) unless you have GDOS installed.  Barring
the use of GDOS (or equivalent), you should have been able to use it.

>Ok, I did try another(dcdesktop), and it did not work (not everybody have
>an english desktop - and as you probaly can see english is not my main 
>language, so there might have been a slight chance that that was the case, 
>right?).

Again, I already conceeded that point, so what's the point you are making?
DC Desktop is highly ROM dependent.  We have and are working with our
overseas distributors to insure that it will work with non-American TOSes.
Which it does for all ROM versions we have been able to get our hands on.

>
>>DC Desktop DOES work, and we have _many_ satisfied customers!  DC Desktop,
>I think it depends on who you are!
>I would not be satisfied with software that took chances with undocumented
>variables/text/functions.

You only have our guarantee that if you want these features in the manner
we provide them (supplementing the existing OS, not replacing it) then
this is the only way to do it.

Our knowledge of the workings of GEM and TOS is quite extensive.

The only "chance" the software takes is that it will not work on a version
it does not recognize.

>And I hope for all the people that have bought your software that _you_
>stay with Atari for many TOSses.
>
>>however, is _highly_ ROM specific in order to wedge in and supplement the
>>OS functions. 

Double Click Software has been in business since 1986, and we have every
intention to continue developing and supporting the Atari computers as
long as they are around.

All of our staff have been using Atari computers since the days of the
Atari 400, and programming for just as long on them.

>
>Yes that is the problem when you have spent to many hours with a disassembler
>in the area about 0xE0_0000. One can not resist the temptation - right?
>
>> If you have problems running our software.
>>1) Why not contact us directly, instead of spreading unsupportable claims?
>
>I did not contact you because when I needed a formatter (PC-comp.) I tryed
>out many diffrend ones (yours included), and If I should have mailed to all
>the people with formatters that did not work, I would probaly still be mailing
>today. And I did find a better alternative (FreeWare with source).
>

Again, confusion in what we are discussing.  I was talking about your claims
about DC Desktop.  As for DC Formatter, do as you like...

>As I said in my previous post, it was not my intension to flame anybody, but
>rather to give an example that people could relate to, and I thought that 
>people knew your software - right...
>

Sure, what damage can happen by just making a broad statement about software
that doesn't work and tacking on the end "and DC program have problems too"
(to paraphrase).

If you didn't mean to flame anyone, then don't mention names!

It seems quite clear from your posts that you singled us out of the thousands
of problem programs.  Why?  I can't begin to guess why.  Perhaps your knowledge
of programs which have the problem you originally described (a bad VDI handle)
was not as extensive as you would have us believe, therefore, without providing
any real evidence, you committed a fallacy in logic and decided to group all
of our programs together, simply because a _very_ old program (our first)
exhibited the problem (the fallacy is 'generalization').

>This is becomming annoying, I wanted to help newcommers writing better software
>and I end up arguing with a long time hacker. 
>
>Klaus, micro@imada.ou.dk
>
>>- mike vederman

If you want to help out, then don't attempt to come off as a 'know-it-all'.

State precisely what you have knowledge about and leave it at that.

Had you originally just said "I know DC Formatter has this problem.  Others
may exist, but I can't comment about them since I don't have first hand
experience with them."

We would not be wasting band-width attempting to straighten out a misleading
satement.

And now back to the originally scheduled discussion...

- mike vederman

-- 
------------------------------------------------------------------------------
Double Click Me | Double Click Software | P.O. Box 741206 | Houston, Tx, 77274
------------------------------------------------------------------------------
Voice: (713)977-6520 | DC DESKTOP | DC FORMATTER | DC UTILITIES | and others