Implemented flexible screen size (work in progress)

This commit is contained in:
claudiol 2020-02-11 18:56:06 -05:00
parent d1811b3e9b
commit 08c0eda2db
9 changed files with 33 additions and 40 deletions

View file

@ -220,13 +220,6 @@ void ggl_monohbltoper(int *dest, int destoff, unsigned char *src, int srcoff,
dstart = dest + (destoff >> 3);
dend = dest + ((destoff + npixels - 1) >> 3);
#ifndef NDEBUG
if((dstart < dest) || (dend > dest + 2048)) {
return;
}
#endif
if(dstart == dend) {
// single word operation
ml |= mr;

View file

@ -22,13 +22,7 @@ void ggl_hline(gglsurface * srf, int y, int xl, int xr, int color)
register int *right = (int *)srf->addr + (roff >> 3);
int ml = ggl_leftmask(loff), mr = ggl_rightmask(roff);
#ifndef NDEBUG
if((left < srf->addr) || (right > srf->addr + 2048)) {
// BAD EXCEPTION
return;
}
#endif
if(left == right) {
// single word operation

View file

@ -896,15 +896,15 @@ void halRedrawMenu1(DRAWSURFACE * scr)
scr->clipy2 = ytop + MENU1_HEIGHT - 2;
for(k = 0; k < 5; ++k) {
scr->clipx = 22 * k;
scr->clipx2 = 22 * k + 20;
scr->clipx = MENU_TAB_WIDTH * k;
scr->clipx2 = MENU_TAB_WIDTH * k + (MENU_TAB_WIDTH-2);
item = uiGetMenuItem(m1code, MenuObj, k + MENUPAGE(m1code));
uiDrawMenuItem(item, mcolor, scr);
}
// NOW DO THE NXT KEY
scr->clipx = 22 * k;
scr->clipx2 = 22 * k + 20;
scr->clipx = MENU_TAB_WIDTH * k;
scr->clipx2 = MENU_TAB_WIDTH * k + (MENU_TAB_WIDTH-2);
if(nitems == 6) {
item = uiGetMenuItem(m1code, MenuObj, 5);

View file

@ -8,8 +8,8 @@
#ifndef _GGL_H
#define _GGL_H
#define LCD_H 80
#define LCD_W 160
#define LCD_H SCREEN_H
#define LCD_W SCREEN_W
// internal buffer for hblt routines

View file

@ -206,6 +206,7 @@
#define SCREEN_WIDTH 131
#define SCREEN_HEIGHT 80
#define STATUSAREA_X 66
#define MENU_TAB_WIDTH (((SCREEN_WIDTH-5)/6)+1)
// DEFAULT COLOR MODE OF THE SYSTEM
#define DEFAULTBITSPERPIXEL 4

View file

@ -8,8 +8,6 @@
#ifndef TARGET_PC_H
#define TARGET_PC_H
extern char PhysicalScreen[8192];
extern char ExceptionScreen[8192];
#undef MEM_PHYS_SCREEN
#define MEM_PHYS_SCREEN PhysicalScreen
@ -58,13 +56,15 @@ extern int __usb_timeout;
// Target PC uses 50g screen and other capabilities for now
// USABLE SCREEN SIZE
#define SCREEN_WIDTH 131
#define SCREEN_HEIGHT 80
#define STATUSAREA_X 66
#define SCREEN_WIDTH 256
#define SCREEN_HEIGHT 160
#define STATUSAREA_X (66*SCREEN_WIDTH)/131
#define MENU_TAB_WIDTH (((SCREEN_WIDTH-5)/6)+1)
#define PIXELS_PER_WORD 8
// PHYSICAL SCREEN SIZE
#define SCREEN_W 160
#define SCREEN_H 80
#define SCREEN_W 288
#define SCREEN_H 160
// DEFAULT COLOR MODE OF THE SYSTEM
#define DEFAULTBITSPERPIXEL 4
@ -75,4 +75,9 @@ extern int __usb_timeout;
#define HAL_USBCLOCK 48000000
#define HAL_FASTCLOCK 192000000
extern char PhysicalScreen[(SCREEN_W*SCREEN_H)/(PIXELS_PER_WORD/4)];
extern char ExceptionScreen[(SCREEN_W*SCREEN_H)/(PIXELS_PER_WORD/4)];
#endif // TARGET_PC_H

View file

@ -8,7 +8,7 @@
#include <ui.h>
#define LCD_TARGET_FREQ 500000
#define LCD_W 160
#define LCD_W SCREEN_W
#define HOZVAL ((LCD_W>>2)-1)
// SIMULATED SYSTEM REGISTERS
@ -16,8 +16,8 @@ int __lcd_mode = -1;
int __lcd_needsupdate = 0;
unsigned int *__lcd_buffer;
// SIMULATED SCREEN MEMORY
char PhysicalScreen[8192];
char ExceptionScreen[8192];
char PhysicalScreen[(SCREEN_W*SCREEN_H)/(PIXELS_PER_WORD/4)];
char ExceptionScreen[(SCREEN_W*SCREEN_H)/(PIXELS_PER_WORD/4)];
int __lcd_contrast __SYSTEM_GLOBAL__;

View file

@ -149,9 +149,9 @@ void MainWindow::resizeEvent(QResizeEvent * event)
w = ui->EmuScreen->screen_width;
h = ui->EmuScreen->screen_height + 5;
if(!h)
h = 85;
h = SCREEN_HEIGHT+5;
if(!w)
w = 131;
w = SCREEN_WIDTH;
qreal dpwidth = event->size().width();
qreal realwidth = dpwidth * dpratio;
scale = realwidth / w;

View file

@ -31,8 +31,8 @@ annRShift(QString(":/bitmap/bitmap/ann_right.xbm"))
screentmr = nullptr;
screen_height = 80;
screen_width = 131;
screen_height = SCREEN_HEIGHT;
screen_width = SCREEN_WIDTH;
BkgndColor = QColor(172, 222, 157);
MainColor = QColor(0, 0, 0);
BkgndPen.setColor(BkgndColor);
@ -89,32 +89,32 @@ annRShift(QString(":/bitmap/bitmap/ann_right.xbm"))
Annunciators[0] = scr.addPixmap(annComms);
Annunciators[0]->setScale(0.25);
Annunciators[0]->setOffset(120 * 4 - 0 * 80, -20);
Annunciators[0]->setOffset(((SCREEN_WIDTH-10) - 0 * ((SCREEN_WIDTH-30)/5))*4, -20);
Annunciators[0]->setOpacity(1.0);
Annunciators[1] = scr.addPixmap(annLShift);
Annunciators[1]->setScale(0.25);
Annunciators[1]->setOffset(120 * 4 - 5 * 80, -20);
Annunciators[1]->setOffset(((SCREEN_WIDTH-10) - 5 * ((SCREEN_WIDTH-30)/5))*4, -20);
Annunciators[1]->setOpacity(1.0);
Annunciators[2] = scr.addPixmap(annRShift);
Annunciators[2]->setScale(0.25);
Annunciators[2]->setOffset(120 * 4 - 4 * 80, -20);
Annunciators[2]->setOffset(((SCREEN_WIDTH-10) - 4 * ((SCREEN_WIDTH-30)/5))*4, -20);
Annunciators[2]->setOpacity(1.0);
Annunciators[3] = scr.addPixmap(annAlpha);
Annunciators[3]->setScale(0.25);
Annunciators[3]->setOffset(120 * 4 - 3 * 80, -20);
Annunciators[3]->setOffset(((SCREEN_WIDTH-10) - 3 * ((SCREEN_WIDTH-30)/5))*4, -20);
Annunciators[3]->setOpacity(1.0);
Annunciators[4] = scr.addPixmap(annBattery);
Annunciators[4]->setScale(0.25);
Annunciators[4]->setOffset(120 * 4 - 2 * 80, -20);
Annunciators[4]->setOffset(((SCREEN_WIDTH-10) - 2 * ((SCREEN_WIDTH-30)/5))*4, -20);
Annunciators[4]->setOpacity(1.0);
Annunciators[5] = scr.addPixmap(annHourglass);
Annunciators[5]->setScale(0.25);
Annunciators[5]->setOffset(120 * 4 - 1 * 80, -20);
Annunciators[5]->setOffset(((SCREEN_WIDTH-10) - 1 * ((SCREEN_WIDTH-30)/5))*4, -20);
Annunciators[5]->setOpacity(1.0);
setScene(&scr);
@ -220,7 +220,7 @@ void QEmuScreen::update()
int mask;
for(i = 0; i < screen_height; ++i) {
mask = 0xf;
ptr = __lcd_buffer + (LCD_W >> 3) * i;
ptr = __lcd_buffer + (LCD_W / PIXELS_PER_WORD) * i;
for(j = 0; j < screen_width; ++j) {
color = (*ptr & mask) >> ((j & 7) * 4);
Pixels[i * screen_width + j]->setBrush(GrayBrush[color]);