/* * _bgi_read_raw — прочитать пиксель (x,y) БЕЗ своей W3-скобки * (вызывающий уже сделал _gfx_w3_video_begin). Для блиттинга image: * getimage/putimage читают тысячи пикселей в одной скобке. * За пределами экрана возвращает 0. */ #include "../_bgi.h" static uint8_t _gfx_gpr_y; static uint16_t _gfx_gpr_addr; static uint8_t _gfx_gpr_color; uint8_t _bgi_read_raw(int x, int y) { if ((unsigned)x >= GFX_WIDTH || (unsigned)y >= GFX_HEIGHT) return 0; _gfx_gpr_y = (uint8_t)y; _gfx_gpr_addr = (uint16_t)(_gfx_addr_base + (unsigned)x); __asm ld a, (__gfx_gpr_y) out (#0x89), a ld hl, (__gfx_gpr_addr) ld a, (hl) ld (__gfx_gpr_color), a __endasm; return _gfx_gpr_color; }