Short: Peeking memory from Python ONLY Author: wisecracker@tesco.net (Barry Walker) Uploader: wisecracker tesco net (Barry Walker) Type: dev/src Version: 0.00.10 Architecture: generic; m68k-amigaos Distribution: Public Domain, Emailware. ============================================================================ Architectures: Classic AMIGAs and WinUAE. ----------------------------------------- MINIMUM Requirements Are:- -------------------------- 68EC020 CPU and 2MB RAM total, example, a standard A1200(HD). WinUAE Version 1.5.3 minimum. Standard OS3.0x install or better. Full Python 1.4.x, minimum, installed. (Python 1.5.2 to 2.0.x are also available on AMINET.) (Now Python 2.4.6 is available for advanced 68K machines.) ---------------------------------------------------------------------------- History. -------- 01-07-2012. Version 0.00.10:- Original upload to AMINET... ---------------------------------------------------------------------------- To install just download the "AMIGA_Peek_Mem.py.txt" file and rename it to "AMIGA_Peek_Mem.py" without the quotes. Drag this file into the PYTHON: volume and away you go... From a Python prompt:- >>> execfile("PYTHON:AMIGA_Meek_Mem.py") And away you go... ---------------------------------------------------------------------------- For AMIGA-Heads Only. This code is purely for a minimum of a stock Classic AMIGA A1200(HD), E-UAE, and WinUAE running AMIGA OS3.0x to 3.1x. It will NOT work on any other platform! (It MIGHT work on OS3.5x and 3.9x with Python 2.4.6, but totally untested and I hold no reposibilty for the outcome when trying it.) It is a DEMO to peek a byte inside _ANY_ memory address inside the standard CPU 68EC020 16MB boundary. I experimented with this several years ago and have decided to finally release it. It works from Python Versions 1.4.0 to 2.0.1 for the classic AMIGA. Ensure that the T: Volume exists on the running machine. See inside the code and text below it also as to how it works... ---------------------------------------------------------------------------- How it works:- -------------- I suspect this will raise a few eyebrows but here goes... The original idea was to find out exactly where a string was in memory just for fun, fill it with a binary executable then finding a way of calling that executable to hit the AMIGA HW directly... (NOTE:- This idea DOES work on this particular platform!) The first few lines of non-commented code are just the usual type of lines needed to run correctly inside the lowest Python Version. Next is the peek() function whose default address is the start of ROM at $F80000. On calling this function any address that is entered is corrected to be kept inside the limits shown and converted to into a 4 byte string. A new string is now generated with these four characters inside the new string and a file created and saved to the T: Volume as PeekMem. It is then made executable and run... Now the eyebrow bit... ;o) The byte value read in this new executable is a return code and is passed back to the Python code for printing to the screen if required. Now the first part reads the last byte in ROM at odd address $FFFFFF as this is what the function was intended for, single byte read, however...... In the DEMO a 256 byte dump is generated next and although it is slow, (remember a stock AMIGA A1200(HD) does NOT run at several GHz but at 14MHz), is saved as a Binary.BIN file then converted to Binary.HEX, a pure text file. This method was to ensure printing to the screen ALWAYS worked from the default "Tool" icon. With user interevention the same is done again but the address of the string inside the Python code is found using the id() function. I now have the address exactly by _viewing_ the offset value and adding it to the id() function value generated. I DO have another version of _peek_ which was uploaded to AMINET some years ago but nothing like this. I kept this one to myself but have now decided to let it go for AMIGA community. I will be releasing a DEMO poke_(ing) a single byte into a memory address for the Classic AMIGA A1200(HD) in the not too distant future... Have fun finding simple solutions to often very difficult problems... ;o) ---------------------------------------------------------------------------- The archive is Public Domain/Emailware and you may modify it/them as you please for your OWN experiments. See below. I would dearly love an Email from you even if you think it is absolute rubbish... :) (Original idea and (C)2007 goes to B.Walker, G0LCU.) ---------------------------------------------------------------------------- IMPORTANT:- ----------- The Legal Stuff:- ----------------- These programs are Public Domain and no profit will be made from them, also all of the files must remain unaltered and intact including this one. The author is not responsible for any damage to, or loss of, or failure of equipment or data caused in any way by the use of these programs. There is NO warranty with the use of these software releases and YOU USE THEM AT YOUR OWN RISK. ---------------------------------------------------------------------------- Testing Evaluation:- -------------------- All WinUAE, and Classic AMIGA test conditions were/are running standard OS3.0x/OS3.1x and using standard ~topaz 8~ fonts throughout. I have no idea what strange configuration setups will create so refer to the ~The Legal Stuff~ above. ---------------------------------------------------------------------------- Contact:- --------- Mr Barry Walker, G0LCU. Email:- wisecracker@tesco.net Author of the ~TestGear?~ projects in the ~docs/hard~ drawer of AMINET. ---------------------------------------------------------------------------- A very useful HardWare related site, (C) Anthony Hoffman, for modifications, schematics, repairs and the like is:- http://amiga.serveftp.net/ ============================================================================