Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!bellcore!tness7!tness1!uhnix1!uhnix2!uace0 From: uace0@uhnix2.uh.edu (Michael B. Vederman) Newsgroups: comp.sys.atari.st Subject: Re: Questions about ST Video Ram Message-ID: <657@uhnix2.uh.edu> Date: 28 Aug 88 00:50:58 GMT References: <535@skywest.UUCP> <2884@bath63.ux63.bath.ac.uk> <12@usl-pc.usl.edu> Reply-To: uace0@uhnix2.UUCP Organization: University of Houston Lines: 51 In article <12@usl-pc.usl.edu> jpdres13@usl-pc.UUCP (John Joubert) writes: >In article <535@skywest.UUCP> brenes@skywest.UUCP (Erasmo Brenes) writes: >>... If the Shifter expects the video ram to start at 32K boundaries, >>then how do I get MWC, or any C program to allocate a 32Kb buffer starting in >>a 32Kb boundary in an efficient manner? An initial thought was to use Malloc() >>to allocate 64Kb and then only use the 32Kb which start in a 32Kb boundary, >>but this method is too wasteful. There's got to be a better way, isn't there? > >-------------------------- [deleted lines of text] > >Here is how I find a 256 byte boundary to put in a screen. > [ deleted lines of 'C' code ] > /* On a 256 byte boundary. */ > work_scr=(char *)( (long)(blk=malloc(32768L)) & 0xffffff00 )+0x0100; > [ More deleted stuff ] >Hope this helps, >---------------------------------------------------------------------------- >John Joubert | /\ | /\ | _ >jpdres13@usl-pc.USL or ... | \|<>|>|> \|<>|>|><`|`| >ut-sally!usl!usl-pc!jpdres13 |-----/|-------/|---------------------- >GEnie: J.JOUBERT | \/ \/ >----------------------------------------------------------------------------- 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 :-). - Mike -- for (;;) : Use ATARINET, send an interactive do_it(c_programmers); : message such as: : Tell UH-INFO at UHUPVM1 ATARINET HELP University Atari Computer Enthusiasts : University of Houston UACE