Re: [ql-users] Re: pointer programming - 'C' routine problem list

2002-12-02 Thread James Hunkins
Sigh, I need to be careful as to how I write my emails, especially when I am in a hurry.  Thanks to everyone who jumped in and looked at these.

I had originally found some errors in some of the GD2 wrappers but with George's and Dave (Walker)'s help, these were quickly fixed and are available to everyone.  What I meant to emphasize that users should make sure they have the latest updates.  Also, there may be other bugs that weren't found (pure speculation) - I haven't tried all the calls and don't know what level of testing there has been.

But as I said, George and Dave were really  on top of it as soon as I reported the problems.

The four routines below did cause me issues depending on how they were used.  Note that some usage was ok and other usage was random, depending of memory/stack usage.

Since I did cause a flurry of emails with my 'helpful' caution (as I said - need to be a bit more careful), I will try to get some time this weekend to post what I found and compare them to George's and the other comments.

More to come...

Cheers,
jim

On Sunday, December 1, 2002, at 09:25  AM, [EMAIL PROTECTED] wrote:

In a message dated 28/11/02 06:51:24 GMT Standard Time, [EMAIL PROTECTED] writes:


Sorry, left a major one off my list of 'C' wrappers that have errors.  
Here is the revised list:

iop_flim
sms_sevt
sms_wext
wm_rptrt

Jim


Re: [ql-users] Re: pointer programming - 'C' routine problem list

2002-12-01 Thread Geogwilt
In a message dated 28/11/02 06:51:24 GMT Standard Time, [EMAIL PROTECTED] writes:


Sorry, left a major one off my list of 'C' wrappers that have errors. 
Here is the revised list:

iop_flim
sms_sevt
sms_wext
wm_rptrt

Jim



I thought Jim was saying that there were errors in the GD2 routines. In fact I tested these about two year's ago and they seemed OK then.

The items Jim has listed as containing errors are not GD2 after all! However, since I promised to look into these I will now report.

iop_flim

The code for this is very simple and seems to contain no errors. I tried it in a C program and found that it worked. So what is the problem here?

sms_sevt

The program here is also very simple:

 MOVEQ #$3A,D0
 MOVE.L 4(A7),D1 destination job ID
 MOVE.W 6(A7),D2 events to notify
 TRAP #1 do it
 RTS

I didn't try it, but what is wrong with it?


sms_wext

The program for this is as follows.

 MOVEQ #3B,D0
 MOVE.L 4(A7),A1 address containing events to wait for
 MOVE.B (A1),D2 this moves the top byte of (A1) to D2
 (we must hope that the top byte IS the event byte!)
 MOVE.W 6(A7),D3 timeout
 TRAP #1 do it
 MOVE.L 4(A7),A1 retrieve the address for the event byte
 M0VE.B D2,(A1) push the events causing the return - (A1)
 RTS

Provided the top byte of the address sent to the routine contains the event byte this looks as though it will work.

Unfortunately D3 is not preserved. As I understand it D3 may be used to hold data by C68 and so should be preserved.

A better program might be

 MOVE.L D3,-(A7)
 MOVEQ #$3B,D0
 MOVE.L 8(A7),A1 4 added because of the saving of D3
 MOVE.B (A1),D2
 MOVE.W 10(A7),D3 " "
 TRAP #1
 MOVE.L 8(A7),A1 " "
 MOVE.B D2,(A1)
 MOVE.L (A7)+,D3
 RTS

If the return from sms_wevt is to be the error code we perhaps should also add

 MOVEQ #0,D0

before the RTS since sms.wevt returns no errors (but does it clear DO?). 


wm_rptrt

It is clear from the coding that no-one except Jim has attempted to use wm_rptrt. I give the code below and you will see why.

 MOVEM.L D2-3/A4,-(A7)
 MOVE.L $10(A7),A4 1st parameter - pointer to working defn
 MOVE.W $14,D3 Hmmm!!!
 MOVE.W $16,D2 Hmmm!!!
 MOVEQ #$78,D0
 JSR wm_chkv get the vector
 BMI.S L oops - no vector
 JSR (A0,D0,L) do wm_rptrt
 TST.L D0 OK . . .
 BMI.S L . . . no
 MOVE.L A0,D0 channel ID to be returned
L MOVEM.L (A7)+,A4/D2-3
 RTS

The two lines with "H!!!" are missing the (A7) which rather spoils the program.

If I were changing this code I might consider NOT preserving D2, since it is only used by C68 as a scratch register.

I hope this is of help to some. And also that Dave Walker is listening in.

Cheers

George 


Re: [ql-users] Re: pointer programming - 'C' routine problem list

2002-12-01 Thread Marcel Kilgus

[EMAIL PROTECTED] wrote:
 It is clear from the coding that no-one except Jim has attempted to use
 wm_rptrt. I give the code below and you will see why.

MOVEM.L  D2-3/A4,-(A7)
MOVE.L $10(A7),A41st parameter - pointer to working defn
MOVE.W$14,D3 Hmmm!!!
MOVE.W$16,D2 Hmmm!!!

Ah yes, I remember spending the night just before my flight back to
Europe with Jim hunting down that bug. It was a typical argh, why
didn't I notice that one hour ago experience ;)

Marcel