Path: utzoo!utgpu!water!watmath!clyde!att!alberta!ubc-cs!uw-beaver!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!mailrus!uwmcsd1!marque!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.sys.atari.st Subject: Re: Questions about ST Video Ram Keywords: 256 byte alignment, video ram size Message-ID: <773@philmds.UUCP> Date: 28 Aug 88 16:42:45 GMT References: <535@skywest.UUCP> <2884@bath63.ux63.bath.ac.uk> <12@usl-pc.usl.edu> <657@uhnix2.uh.edu> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 30 In article <657@uhnix2.uh.edu> uace0@uhnix2.UUCP writes: >In article <12@usl-pc.usl.edu> jpdres13@usl-pc.UUCP (John Joubert) writes: [lines deleted]... >> /* On a 256 byte boundary. */ >> work_scr=(char *)( (long)(blk=malloc(32768L)) & 0xffffff00 )+0x0100; [lines deleted]... >Dear John, > > >There is really one little problem with the code you have written, that being if >the block you Malloc is just one byte past a 256 byte boundary, then you will >be wasting 255 bytes, therefore you will need to Malloc at least (32K+255) to >insure that you have at least enough memory to draw a full screen in. Other- >wise you will be overwriting memory which is not yours (a discussion of which >there has been an abundance of these days :-). I thought we had all this Video Ram discussion in various flavours a few months ago (maybe you lucky people have vacations that long 8-). Alignment on a 256 byte boundary automatically implies there is a worst-case waste of 255 bytes. You cannot avoid that. John's code is correct however (maybe not intentionally), since a screenful amounts to 32000 bytes, not 32K. So a Malloc of 32256 is in fact satisfactory, and hence certainly John's 32768. B.T.W. What I've seen from the initialization of the screen memory seems to imply that the start of the physical screen is always taken to be physical RAMtop minus 32K. So there's always a waste of 768 bytes at the top of RAM. To be used whatfor? A program? Some data? Any suggestions? Leo.