diff --git a/src/devices/ppu.c b/src/devices/ppu.c index 9061e0e..bb55e05 100644 --- a/src/devices/ppu.c +++ b/src/devices/ppu.c @@ -66,9 +66,7 @@ ppu_2bpp(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Ui int ppu_init(Ppu *p, Uint8 hor, Uint8 ver) { - p->hor = hor; - p->ver = ver; - p->width = 8 * p->hor; - p->height = 8 * p->ver; + p->width = 8 * hor; + p->height = 8 * ver; return 1; } diff --git a/src/devices/ppu.h b/src/devices/ppu.h index 7890276..2bcae6f 100644 --- a/src/devices/ppu.h +++ b/src/devices/ppu.h @@ -18,7 +18,7 @@ typedef unsigned short Uint16; typedef unsigned int Uint32; typedef struct Ppu { - Uint16 hor, ver, width, height; + Uint16 width, height; Uint8 *pixels; } Ppu; diff --git a/src/uxnemu.c b/src/uxnemu.c index ee67576..fc00cec 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -213,8 +213,8 @@ static void domouse(SDL_Event *event) { Uint8 flag = 0x00; - Uint16 x = clamp(event->motion.x - PAD, 0, ppu.hor * 8 - 1); - Uint16 y = clamp(event->motion.y - PAD, 0, ppu.ver * 8 - 1); + Uint16 x = clamp(event->motion.x - PAD, 0, ppu.width - 1); + Uint16 y = clamp(event->motion.y - PAD, 0, ppu.height - 1); mempoke16(devmouse->dat, 0x2, x); mempoke16(devmouse->dat, 0x4, y); switch(event->button.button) { @@ -500,8 +500,8 @@ main(int argc, char **argv) portuxn(&u, 0xf, "---", nil_talk); /* Write screen size to dev/screen */ - mempoke16(devscreen->dat, 2, ppu.hor * 8); - mempoke16(devscreen->dat, 4, ppu.ver * 8); + mempoke16(devscreen->dat, 2, ppu.width); + mempoke16(devscreen->dat, 4, ppu.height); run(&u); quit();