From 436886a7db5dd081c32ae33c19a51203359b6aa6 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Thu, 22 Nov 2018 15:40:41 +0100 Subject: [PATCH] fix raw2crtc() CPC function. It was unproperly fetching the pixels on the left of the picture... --- src/libraw2crtc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libraw2crtc.c b/src/libraw2crtc.c index f45159a0..968e6ae8 100644 --- a/src/libraw2crtc.c +++ b/src/libraw2crtc.c @@ -14,6 +14,7 @@ #include "global.h" #include "struct.h" #include "loadsave.h" +#include "gfx2log.h" /* 6845 registers : * R1 : Horizontal Displayed : number of character displayed per line (4, 8 or 16 pixels depending on mode) @@ -41,20 +42,24 @@ unsigned char mode0interlace(T_IO_Context * context, unsigned char x, unsigned c // bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 // p0b0 p1b0 p0b2 p1b2 p0b1 p1b1 p0b3 p1b3 unsigned char mode0pixel[] = {0, 64, 4, 68, 16, 80, 20, 84, 1, 65, 5, 69, 17, 81, 21, 85}; - return mode0pixel[Get_pixel(context,x,y) & 0xf] << 1 | mode0pixel[Get_pixel(context,x+1,y) & 0xf]; + return mode0pixel[Get_pixel(context,x*2,y) & 0xf] << 1 + | mode0pixel[Get_pixel(context,x*2+1,y) & 0xf]; } unsigned char mode1interlace(T_IO_Context * context, unsigned char x, unsigned char y) { unsigned char mode1pixel[] = {0, 16, 1, 17}; - return mode1pixel[Get_pixel(context,x,y) & 3] << 3 | mode1pixel[Get_pixel(context,x+1,y) & 3] << 2 | mode1pixel[Get_pixel(context,x+2,y) & 3] << 1 | mode1pixel[Get_pixel(context,x+3,y) & 3]; + return mode1pixel[Get_pixel(context,x*4,y) & 3] << 3 + | mode1pixel[Get_pixel(context,x*4+1,y) & 3] << 2 + | mode1pixel[Get_pixel(context,x*4+2,y) & 3] << 1 + | mode1pixel[Get_pixel(context,x*4+3,y) & 3]; } unsigned char mode2interlace(T_IO_Context * context, unsigned char x, unsigned char y) { unsigned char out = 0; int i; - for(i = 0; i < 8; i++) out += ((Get_pixel(context,x+7-i,y)&1) << i); + for(i = 0; i < 8; i++) out += ((Get_pixel(context,x*8+7-i,y)&1) << i); return out; } @@ -136,6 +141,8 @@ unsigned char *raw2crtc(T_IO_Context *context, unsigned char mode, unsigned char r6 = height/(r9+1); + GFX2_Log(GFX2_DEBUG, "raw2crtc() r1=%u r6=%u\n", *r1, r6); + for(vcc = 0; vcc < r6; vcc++) { for(rcc = 0; rcc <= r9; rcc++)