bryce@eris (Bryce Nesbitt) (03/29/88)
[A perfect ".tech" topic...] In article <> adam@lamont.Columbia.edu (adam levin) writes: > >I wrote the following routine, and I'd like to know >if this is a reasonable way to avoid the unnecessary copy [to CHIP ram]. It is reasonable to check if the memory is already in chip, and not copy if it is. Your method is unreasonable. >/* MemType - Given a starting address and a length, returns > either MEMF_CHIP, MEMF_FAST, or both. > 25-Mar-1988 aklevin */ >... >#define FAST_STARTS 0x80000L That is not the start of fast memory. Remember 1 Megabyte chip memory rummors? Two megabyte rummors? 2 Gigabyte chip memory rummors? Face it, you just don't know. The system already has a call all set up for this use. TypeOfMem(). It is in exec library. It takes the base of your memory block, and tells you what type of memory it is in. Blocks of memory never span types of memory. Since you may be one of the thousands that does not have proper V1.2 Kickstart documentation, here is the "autodoc" for TypeOfMem(), duplicated here without permission of the Copyright holder, Commodore-Amiga, Inc.: exec.library/TypeOfMem NAME TypeOfMem -- determine attributes of a given memory address SYNOPSIS attributes = TypeOfMem(address) D0 A1 [Available with V1.2 Kickstart and beyond] FUNCTION Given a RAM memory address, return its known memory attributes. These known memory attributes are similar to those specified when the memory was allocated: MEMF_CHIP and MEMF_FAST. If the address is not in known RAM-space, a zero will be returned. This is typical for all control spaces, ROM, RAM-ROM, and the hardware expansion interface. INPUT address - a memory address RESULT attributes - a long word of memory attribute flags. If the address is not in known RAM, zero is returned. SEE ALSO AllocMem() |\_/| . ACK!, NAK!, EOT!, SOH! {O_o} . Bryce Nesbitt (") BIX: mleeds (temporarily) U USENET: bryce@eris.berkeley.EDU -or- ucbvax!eris!bryce