Groups | Search | Server Info | Login | Register


Groups > comp.sys.amstrad.8bit > #401

Re: fast C (or other readable language) version of SCR DOT POSITION with screen_offset!=0?

From Jens Thiele <karme@karme.de>
Newsgroups comp.sys.amstrad.8bit
Subject Re: fast C (or other readable language) version of SCR DOT POSITION with screen_offset!=0?
Date 2025-10-02 12:56 +0200
Organization A noiseless patient Spider
Message-ID <10bllpj$uu7p$2@dont-email.me> (permalink)
References <10bllcs$uu7p$1@dont-email.me>

Show all headers | View raw


I also asked on the cpc wiki forum. And got a nice answer by
lightforce6128. [1]

Thanks to him I ended up with something like:

inline char* scr_dot_position(uint16_t scroff, uint16_t x, uint8_t y) {
       uint16_t x_offset    = x / 8;
       uint16_t y_offset    = (uint16_t)(y / 8) * 80;
       uint16_t y_scanline  = (uint16_t)(y % 8) * 2048;
       return (char*)0xC000
              + ((scroff + x_offset + y_offset) % 2048) + y_scanline;
}

Regarding the hardware scroll the result is at [2]

[1] https://www.cpcwiki.eu/forum/programming/fast-c-version-of-scr-dot-position-with-screen_offset!0/
[2] https://www.karme.de/cpc/#scrolling

Back to comp.sys.amstrad.8bit | Previous | NextPrevious in thread | Find similar


Thread

fast C (or other readable language) version of SCR DOT POSITION with screen_offset!=0? Jens Thiele <karme@karme.de> - 2025-10-02 12:50 +0200
  Re: fast C (or other readable language) version of SCR DOT POSITION with screen_offset!=0? Jens Thiele <karme@karme.de> - 2025-10-02 12:56 +0200

csiph-web