--------------------------------------------------------------------------------
--                                                                            --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers.               --
--                                                                            --
-- This library is free software; you can redistribute it and/or              --
-- modify it under the terms of the GNU Lesser General Public                 --
-- License as published by the Free Software Foundation; either               --
-- version 2.1 of the License, or (at your option) any later version.         --
--                                                                            --
-- This library is distributed in the hope that it will be useful,            --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of             --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           --
-- Lesser General Public License for more details.                            --
--                                                                            --
-- You should have received a copy of the GNU Lesser General Public           --
-- License along with this library; if not, write to the Free Software        --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    --
--                                                                            --
--------------------------------------------------------------------------------

-- $Author$
-- $Date$
-- $Revision$

with RASCAL.OS;      use RASCAL.OS;
with RASCAL.Utility; use RASCAL.Utility;

with Interfaces.C;   use Interfaces.C;
with Kernel;         use Kernel;


package body RASCAL.VDU is

   OS_WriteI : constant := 16#100#; -- Base
   CLG       : constant := 16;      -- Clear gfx window

   --

   procedure Write (VDU_Code : in Integer) is

      Error      : Kernel.OSError_Access;
      Register   : aliased Kernel.swi_regs;
      SWI_Nr     : Interfaces.C.unsigned := OS_WriteI+Interfaces.C.unsigned(VDU_Code);
   begin
      Error := Kernel.SWI (SWI_Nr,Register'access,Register'access);
      if Error /= null then
         pragma Debug(Report ("VDU.Write : " & To_Ada (Error.errmess)));
         OS.Raise_Error(Error);
      end if;
   end Write;

   --

end RASCAL.VDU;