FAQ - Video memory access
Created by: valen, Last modification: Wed 30 of Jun, 2010 (18:39 UTC)
When can the CPU access (read/write) the video memory ?
Always. But, if the CPU tries to access video RAM at the same time as the display hardware, the CPU just waits until the video fetch has finished. The wider the scanline (in pixels) the longer the CPU has to wait.Some examples ?
- With a window size of 320x200x8 (in bitmap video mode, 256 colors), there's 200 lines where CPU runs at about half the speed on average (when accessing video RAM). Thus, half of scanline is used by display hardware for datafetch and half is left free for video memory access. (See Note 1)
- With a window size of 368x232 (in tilemap video mode, 256 colors), there's 232 lines where the CPU runs at about 25% of normal speed on average (when accessing video RAM). Thus, 75% of the scanline time is used by display hardware for datafetch and the other 25% is left free for video memory access. (See Note 1)
- For a chunky mode 320 pixel per line, CPU waiting time is one cycle per pixel. So the CPU could spend about 320 cycles waiting (out of a total of 1024 per line). Thus, 30% of the scanline time is used by display hardware for datafetch and the other 70% is left free for video memory access. (See Note 1)
Note 1: If the blitter is running then it will steal all the available cycles on a scan line from the CPU (except around 16 cycles at the end of each line). IE: It has priority over CPU regarding access to video memory, as does the linedraw system)
Are there any scanlines where display hardware datafetch does not happen at all ?
Yes. During full border scanlines. In such lines, the CPU / blitter can read/write video memory with no wait cycles.What is the priority, when accessing video memory ?
1. Display hardware – scanline datafetch (highest priority)2. Processing hardware – blitter / line draw.
3. CPU access - read/writes