libc: BGI Фаза 2d-1 — getimage/putimage/imagesize (спрайты)
Растровые образы: imagesize (4 байта заголовка w,h + w*h пикселей), getimage (захват прямоугольника), putimage с COPY/XOR/OR/AND/NOT_PUT. Блит идёт raw в одной W3-скобке — добавлен _gfx_getpixel256_raw в gfx + leaf _bgi_read_raw в drv256. Проверено в MAME (tests/bgitest): захват спрайта, 3 COPY-копии, XOR/OR/COPY поверх фона. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* _gfx_getpixel256_raw — прочитать пиксель (x,y) БЕЗ своей W3-скобки
|
||||
* (вызывающий уже сделал _gfx_w3_video_begin). Для блиттинга image:
|
||||
* getimage/putimage читают тысячи пикселей в одной скобке.
|
||||
* За пределами экрана возвращает 0.
|
||||
*/
|
||||
|
||||
#include "_gfx.h"
|
||||
|
||||
static uint8_t _gfx_gpr_y;
|
||||
static uint16_t _gfx_gpr_addr;
|
||||
static uint8_t _gfx_gpr_color;
|
||||
|
||||
uint8_t _gfx_getpixel256_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;
|
||||
}
|
||||
Reference in New Issue
Block a user