aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Murphy <alec@checksum.fail>2017-06-11 14:27:22 -0400
committerAlec Murphy <alec@checksum.fail>2017-06-11 14:27:22 -0400
commitaf4fd815d988ae403b5d4632e4d91feaa94c5b09 (patch)
treed870edab61b8da99a2b527d538d3287886baac1e
parentc7e71c57e014b4c816b65445d17f33398d029dcb (diff)
Add 2x/3x video scaling.
-rw-r--r--LCD.HC46
-rw-r--r--Load.HC35
-rw-r--r--README.md19
-rw-r--r--Run.HC6
4 files changed, 89 insertions, 17 deletions
diff --git a/LCD.HC b/LCD.HC
index d6a26c8..56d1c63 100644
--- a/LCD.HC
+++ b/LCD.HC
@@ -1,6 +1,9 @@
// Device contexts
CDC *fb=DCNew(160,144);
CDC *lcd=DCNew(160,144);
+CDC *lcd2=DCNew(160*2,144*2);
+CDC *lcd3=DCNew(160*3,144*3);
+
CDC *bgr=DCNew(160,144);
CDC *bg_s=DCNew(256,1);
CDC *sp0_s=DCNew(256,1);
@@ -52,17 +55,56 @@ U0 FreeLCD()
{
DCDel(fb);
DCDel(lcd);
+ DCDel(lcd2);
+ DCDel(lcd3);
DCDel(bgr);
DCDel(bg_s);
DCDel(sp0_s);
+ DCDel(win_s);
DCDel(win);
DCDel(sp0);
DCDel(sp1);
+ odc=NULL;
}
U0 DrawIt(CTask *,CDC *dc)
{
- GrBlot(dc,0,0,lcd);
+ I64 xpos=0;
+ I64 ypos=0;
+ I64 xctr=0;
+ I64 yctr=0;
+
+ if(LCDScale>1)
+ {
+ while(yctr<144)
+ {
+ xctr=0;
+ xpos=0;
+ while(xctr<160)
+ {
+ if(LCDScale==2){
+ lcd2->color=GrPeek(lcd,xctr,yctr);
+ GrRect(lcd2,xpos,ypos,LCDScale,LCDScale);
+ };
+ if(LCDScale==3){
+ lcd3->color=GrPeek(lcd,xctr,yctr);
+ GrRect(lcd3,xpos,ypos,LCDScale,LCDScale);
+ };
+ xctr++;
+ xpos+=LCDScale;
+ };
+ yctr++;
+ ypos+=LCDScale;
+ };
+ if(LCDScale==2){
+ GrBlot(dc,0,0,lcd2);
+ };
+ if(LCDScale==3){
+ GrBlot(dc,0,0,lcd3);
+ };
+ } else{
+ GrBlot(dc,0,0,lcd);
+ };
}
U0 renderBG_ScanLine()
@@ -297,7 +339,7 @@ U0 renderWIN()
if((tp0>>win_px)&1){win->color=bgp3;}else{win->color=bgp2;};
} else {
if((tp0>>win_px)&1){win->color=bgp1;}else{win->color=bgp0;};
- };
+ };
GrPlot(win,win_bx+(7-win_px),win_by+win_py);
win_px++;
};
diff --git a/Load.HC b/Load.HC
index fe93ca0..edaca71 100644
--- a/Load.HC
+++ b/Load.HC
@@ -10,6 +10,8 @@ I64 obp03,obp02,obp01,obp00;
I64 obp13,obp12,obp11,obp10;
I64 jp_state[8];
+I64 LCDScale=1;
+
U0 SetPal(U8 p, I64 *c0, I64 *c1, I64 *c2, I64 *c3)
{
I64 col[4];
@@ -565,7 +567,7 @@ U0 memoryWrite(I64 address, I64 data)
} else {
//MBC1WriteType
//MBC1 mode setting:
- MBC1Mode = ((data & 0x1) == 0x1);
+ MBC1Mode = ((data & 0x1) == 0x1);
}
} else if (cMBC2) {
if (address < 0x1000) {
@@ -984,6 +986,27 @@ U0 executeIteration()
//Keyboard
switch(sc) {
+ case 0x02 + 0x80:
+ LCDScale=1;
+ Fs->win_left =0x1F;
+ Fs->win_right =0x32;
+ Fs->win_top =0x15;
+ Fs->win_bottom =0x26;
+ break;
+ case 0x03 + 0x80:
+ LCDScale=2;
+ Fs->win_left =0x15;
+ Fs->win_right =0x3C;
+ Fs->win_top =0x0D;
+ Fs->win_bottom =0x30;
+ break;
+ case 0x04 + 0x80:
+ LCDScale=3;
+ Fs->win_left =0x0A;
+ Fs->win_right =0x45;
+ Fs->win_top =0x03;
+ Fs->win_bottom =0x38;
+ break;
case 0x4D:
joyPadState(0,TRUE);
joyPadState(1,FALSE);
@@ -1115,7 +1138,7 @@ U0 setupRAMBanks()
numRAMBanks = 1;
}
};
-
+
U0 start()
{
for (keyCtr=0;keyCtr<8;keyCtr++) {
@@ -1124,10 +1147,10 @@ U0 start()
SettingsPush;
DocClear;
DCFill(lcd,15);
- Fs->win_left =0x24;
- Fs->win_right =0x37;
- Fs->win_top =0x10;
- Fs->win_bottom =0x21;
+ Fs->win_left =0x1F;
+ Fs->win_right =0x32;
+ Fs->win_top =0x15;
+ Fs->win_bottom =0x26;
stopEmulator=1;
initEmulator;
frameskipAmount = 0; //Reset the frame skip setting.
diff --git a/README.md b/README.md
index c2de462..70548b7 100644
--- a/README.md
+++ b/README.md
@@ -11,9 +11,16 @@ Put ROM files in `Roms` folder, and `#include "Run";`
# Controls
-D-PAD: Arrow Keys
-B: a
-A: s
-Select: Shift
-Start: Enter
-Exit: Esc
+D-PAD: `ARROW KEYS`
+
+B: `A`
+
+A: `S`
+
+Select: `SHIFT`
+
+Start: `ENTER`
+
+Exit: `ESC`
+
+Keys `1-3` toggle 1x/2x/3x video scaling.
diff --git a/Run.HC b/Run.HC
index 6e0e6e0..f7029de 100644
--- a/Run.HC
+++ b/Run.HC
@@ -1,6 +1,6 @@
CTask *cherub;
U8 RunCmd[1024];
-U8 RomList[8192];
+U8 RomList[65536];
I64 pos=0;
CDirEntry *rom_f;
@@ -32,9 +32,9 @@ if (rom_i>-1)
};
StrPrint(RunCmd,"Cd(\"%s\");\n#include \"Load\";\nRun(\"%s\");\n",DirCur,rom_f->full_name);
cherub=User(RunCmd);
- Sleep(100);
+ Sleep(300);
WinFocus(Fs);
- Sleep(100);
+ Sleep(300);
WinFocus(cherub);
};