modelist.pas 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Program ModeList;
  2. { ***********************************************************************
  3. * This is example shows how to use p96AllocModeListTagList()
  4. *
  5. * tabt (Sat Dec 28 03:44:35 1996)
  6. *********************************************************************** }
  7. {
  8. Translated to fpc pascal.
  9. 2 Mars 2001.
  10. Updated for fpc 1.0.7
  11. 08 Jan 2003.
  12. [email protected]
  13. }
  14. uses exec, amigados, picasso96api, utility;
  15. Const
  16. template : pchar = 'Width=W/N,Height=H/N,Depth=D/N';
  17. vecarray : Array[0..2] of long = (0,0,0);
  18. Var
  19. ml : pList;
  20. width,
  21. height,
  22. depth : longint;
  23. rda : pRDArgs;
  24. mn : pP96Mode;
  25. Begin
  26. if not Assigned(P96Base) then
  27. begin
  28. writeln('Cannot open ', PICASSO96APINAME);
  29. Halt(5);
  30. end;
  31. width:=640;
  32. height:=480;
  33. depth:=8;
  34. rda:=ReadArgs (template,@vecarray,Nil);
  35. If rda<>Nil Then Begin
  36. If vecarray[0] <> 0 then width := long(@vecarray[0]);
  37. If vecarray[1] <> 0 then height := long(@vecarray[1]);
  38. If vecarray[2] <> 0 then depth := long(@vecarray[2]);
  39. FreeArgs(rda);
  40. End;
  41. ml:=p96AllocModeListTags([P96MA_MinWidth, width,
  42. P96MA_MinHeight, height,
  43. P96MA_MinDepth, depth,
  44. TAG_DONE]);
  45. If ml<>Nil Then Begin
  46. mn := pointer(ml^.lh_Head);
  47. If mn <> Nil Then Begin
  48. While mn^.Node.ln_Succ <> Nil Do Begin
  49. Writeln (mn^.Description);
  50. mn := pointer(mn^.Node.ln_Succ);
  51. End;
  52. End;
  53. p96FreeModeList(ml);
  54. End Else
  55. Writeln ('Unable to allocate list.');
  56. End.