--------------------------------------------------------------------------- -- -- Filename: -- -- peek_and_poke.adb -- -- Description: -- -- Direct access to 16-bit memory words using peek and poke -- subprograms. Uses package Machine_Code to code read and write -- instructions. -- -- Credits: -- -- Copyright (c) 1998, XGC Software -- -- License: -- -- Permission to use copy, modify, and distribute this software for any -- purpose without fee is hereby granted. This software is provided -- "as is", without any express or implied warranty. -- -- Revision: -- -- $Id: $ -- --------------------------------------------------------------------------- with Machine_Code; use Machine_Code; package body Peek_and_Poke is ---------- -- Peek -- ---------- procedure Peek ( Item : out Interfaces.Unsigned_16; Addr : in System.Address) is begin Asm ("ldsh [%1],%0", Outputs => (Interfaces.Unsigned_16'Asm_Output ("=r", Item)), Inputs => (System.Address'Asm_Input ("r", Addr))); end Peek; ---------- -- Poke -- ---------- procedure Poke ( Item : in Interfaces.Unsigned_16; Addr : in System.Address) is begin Asm ("sth %0,[%1]", Inputs => (Interfaces.Unsigned_16'Asm_Input ("r", Item), System.Address'Asm_Input ("r", Addr))); end Poke; end Peek_and_Poke;