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             Hmmmmmmmmmmm!!!
      MOVE.W    $16,D2             Hmmmmmmmmmmm!!!
      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 "Hmmmmmmmm!!!" 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  

Reply via email to