Path: chuka.playstation.co.uk!news From: James Russell Newsgroups: scee.yaroze.beginners Subject: Memory for beginners Date: Tue, 15 Sep 1998 10:14:30 +0100 Organization: Sony Computer Entertainment Europe Lines: 63 Message-ID: <35FE2FF6.B60CF288@scee.sony.co.uk> References: <35F74397.7E93@earthlink.net> NNTP-Posting-Host: mailgate.scee.sony.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5b1 [en] (Win95; I) X-Accept-Language: en Very quick overview of memory.... The strange and twisted analogy I was taught when I first learnt what all this meant was: Imagine memory to be a long street with houses down one side. Each house has eight light switches which can either be on or off. The postal address of the first house is 0, and the postal address of the last house (in most computers, anyway) is 4294967295. That's a long postal route! The combination of lights on/off in each house allows the computer to store numbers, pictures, sounds, whatever. Each house represents one "byte", and each of the eight light switches in the house represent one "bit". The CPU can set a house's light switches and retrieve the status of a house's light switches. The combination of on/off lightswitches can represent different things, depending on the programmer's wishes. They could represent numbers, instructions to the CPU, parts of graphics or sound, whatever. There's no separate thing to say what these light switches represent, you just have to know. It's like if you scribble down the number "10", it could mean your house number, your bank balance, whatever you want. Now because memory chips cost money, the whole street isn't full of houses. Some have just empty lots, which means the CPU can't use them. Actually, most of them have empty lots. In the Playstation, the houses start at 2147483648 and end at 2149580799. There are some other houses, but you don't need to know about them. The houses mentioned above are the only ones you need to know about for now. Storing a byte at an address means setting the light switches at that address to an appropriate value. Loading a file into memory at a particular address 'X' means storing the contents of the first byte of the file at address 'X', the second byte of the file at address 'X+1', and so until you run out of bytes in the file to store. So basically you're setting the value of a whole lot of consecutive houses' light switches. Now, occassionally you have to specify which address to start at, and as you can see above, those numbers are pretty big and horrible. An easier way to manage those numbers is to use hexadecimal, which is an alternative representation of normal decimal numbers. A hexadecimal number is made up of the digits from 0-9, and the letters A-F. The advantage of hexadecimal is that any address is represented in 8 digits maximum. You can always tell a hexadecimal number in the C language, because it starts with '0x'. The first address of real Playstation memory (2147483648) is 0x80000000. If you are using Windows95, the Calculator program can convert between decimal and hexadecimal (and binary). Experiment with it and try to see how hexadecimal works. Your link to the Playstation memory is the program SIOCONS (unless you are using CodeWarrior). SIOCONS has commands like 'dload' which will take a file you specify and put it in memory starting at an address you specify in hexadecimal. People generate script files with a whole bunch of 'dload's that place all their sound and graphics data in memory, and a 'load' command that places the program in memory. Learning low-level stuff like this is never easy, and there can be many misunderstandings. But keep at it. What you're going through is what many other people here have had to go through. If this is your first foray into the world of programming, then I strongly advise getting some good C books (something very basic and easy), and getting some PC programs going first. Then when you're confident, move back to the Yaroze. As a general hint, most people read all the newsgroups, so don't crosspost the same question to many groups, because it splits the replies up. Just keep it to one. Cheers, James -- == James_Russell@scee.sony.co.uk +44 (171) 447-1626 == Developer Support Engineer - Sony Computer Entertainment Europe Socrates last words: "I drank WHAT?"