home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / MISC / mtp.shar / mtpvalid.a < prev    next >
Text File  |  2009-11-06  |  1KB  |  55 lines

  1. * mtpvalid.a, Version 1.1, Created 2/9/90
  2. * Dr Alan M. McIvor, BP Sunbury Research Centre
  3.  
  4.     use <oskdefs.d>
  5.  
  6. Typ     equ    1
  7. Edit     equ     7
  8. Stk     equ     2048+1024         some default stack size
  9. Cerror     equ     257             arbitrary C error
  10.  
  11.     psect mtpvalid,(Prgrm<<8)!Objct,(ReEnt<<8)!(SupStat<<8)!2,Edit,Stk,main,0
  12.  
  13. main:
  14.     moveq #1,d1            Put error code in d1
  15.     cmpi.l #4,d5            Bad number of args?
  16.     ble.s BadRet            Yes, then exit
  17.     cmpi.l #$FEEDFEED,(a5)+        Does it have the right header?
  18.     bne.s BadRet            No, then exit
  19.     move.l (a5)+,d0            Which command is it?
  20.     cmpi.l #0,d0            GetSysMem Command?
  21.     beq.s GetSysMem            Yes, then go do it
  22.     cmpi.l #1,d0            FreeSysMem Command?
  23.     beq.s FreeSysMem        Yes, then go do it
  24.     cmpi.l #2,d0            Validate Command?
  25.     bne.s BadRet            No, then exit
  26.  
  27. Validate:
  28.     move.l (a5)+,a0            Get Pointer to the memory
  29.     move.l a0,d0            Save pointer to memory
  30.     move.l (a5)+,d1            Save memory size
  31.     OS9 F$VModul            Validate module
  32.     bcs.s BadRet            Some thing is wrong
  33.     bra GoodRet
  34.  
  35. GetSysMem:
  36.     move.l (a5)+,d0            Get size of buffer
  37.     OS9 F$SRqMem            Get System memory
  38.     bcs.s BadRet
  39.     move.l (a5)+,a0
  40.     move.l a2,(a0)            Store return address
  41.     bra GoodRet
  42.  
  43. FreeSysMem:
  44.     move.l (a5)+,a2            Get address of buffer
  45.     move.l (a5)+,d0            Get size of buffer
  46.     OS9 F$SRtMem            Return System memory
  47.     bcs.s BadRet
  48.     bra GoodRet
  49.  
  50. GoodRet:
  51.     moveq #0,d1
  52. BadRet:
  53.     OS9 F$Exit
  54.     ends
  55.