Path: utzoo!utgpu!attcan!uunet!mcvax!ukc!etive!hwcs!neil From: neil@cs.hw.ac.uk (Neil Forsyth) Newsgroups: comp.sys.atari.st Subject: Re: Questions about ST Video Ram Message-ID: <1931@brahma.cs.hw.ac.uk> Date: 4 Aug 88 08:25:55 GMT References: <535@skywest.UUCP> Reply-To: neil@cs.hw.ac.uk (Neil Forsyth) Organization: Computer Science, Heriot-Watt U., Scotland Lines: 43 In article <535@skywest.UUCP> brenes@skywest.UUCP (Erasmo Brenes) writes: >The problem that I have is that every time I call the XBIOS routine >SetScreen(logadr,phyadr,rez), where phyadr = &NextScreen[0], the screen jumps >horizontally left to right. The information displayed on the screen is >correct but is skewed to the right 3/4 of the screen (BTW, the program >is written using MWC 2.x). What I've noticed is that the video buffer that >the ST starts with is located in a 32K boundary, 0xf8000, while the starting >location of NextScreen[] is not. It also seems that if a take &NextScreen[0] >mod 32K, the remainder is the offset that I see on the screen. So, the >question is: 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? The video RAM address must start on a 256 byte boundary. To be sure that your buffer is on this boundary try this: (Forgive any lack of style) if ( (buffer=malloc(32256)) == NULL) /* Get memory */ { fprintf(stderr, "Not enough memory\n"); /* Or bust */ exit(-1); } screen=(buffer+256) & 0xFFFFFF00L; /* align on boundary by */ /* by leaping 256 bytes */ /* into buffer then */ /* clearing lowest bits */ If you want loads of screens you just malloc that many times 32000 and add 256 for allignment. _____________________________________________________________________________ / "I think all right thinking people in this country are sick and tired of \ ! being told that ordinary decent people are fed up in this country with ! ! being sick and tired. I'm certainly not and I'm sick and tired of being ! ! told that I am!" - Monty Python ! ! ! ! Neil Forsyth JANET: neil@uk.ac.hw.cs ! ! Dept. of Computer Science ARPA: neil@cs.hw.ac.uk ! ! Heriot-Watt University UUCP: ..!ukc!cs.hw.ac.uk!neil ! ! Edinburgh ! ! Scotland ! \_____________________________________________________________________________/