git-svn-id: svn://qnap.local/TwoTerm/branches/fix-gno-scrolling-region@3168 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
Kelvin Sherlock 2017-02-16 19:24:01 +00:00
parent baf2c36e03
commit 8a5373f906
4 changed files with 35 additions and 21 deletions

View File

@ -35,8 +35,8 @@
B638188214A179D60027D007 /* ColorView.m in Sources */ = {isa = PBXBuildFile; fileRef = B638188114A179D60027D007 /* ColorView.m */; };
B66412391480A070003BC8D3 /* EmulatorWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = B66412381480A070003BC8D3 /* EmulatorWindow.m */; };
B675F4A81E540394004B0D9C /* Screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B612F44D12DD5DAD005D1B77 /* Screen.cpp */; };
B675F4A91E561D20004B0D9C /* Apple80.mm.ragel in Resources */ = {isa = PBXBuildFile; fileRef = B612F45712DD5DF1005D1B77 /* Apple80.mm.ragel */; };
B675F4AA1E562159004B0D9C /* GNOConsole.mm.ragel in Resources */ = {isa = PBXBuildFile; fileRef = B612F45B12DD5DF1005D1B77 /* GNOConsole.mm.ragel */; };
B675F4A91E561D20004B0D9C /* Apple80.mm.ragel in Sources */ = {isa = PBXBuildFile; fileRef = B612F45712DD5DF1005D1B77 /* Apple80.mm.ragel */; };
B675F4AA1E562159004B0D9C /* GNOConsole.mm.ragel in Sources */ = {isa = PBXBuildFile; fileRef = B612F45B12DD5DF1005D1B77 /* GNOConsole.mm.ragel */; };
B676063B11DEAD3500D6B66C /* TermWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = B676063A11DEAD3500D6B66C /* TermWindowController.mm */; };
B676065111DEBAE900D6B66C /* TermWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B676065011DEBAE900D6B66C /* TermWindow.xib */; };
B67B3CE512B6FA040033AE07 /* a2-charset-40.png in Resources */ = {isa = PBXBuildFile; fileRef = B67B3CE312B6FA040033AE07 /* a2-charset-40.png */; };
@ -412,10 +412,8 @@
B60EBE2B11E918D500C1974F /* ScanLineFilter.cikernel in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
B675F4A91E561D20004B0D9C /* Apple80.mm.ragel in Resources */,
B676065111DEBAE900D6B66C /* TermWindow.xib in Resources */,
B67B3CE512B6FA040033AE07 /* a2-charset-40.png in Resources */,
B675F4AA1E562159004B0D9C /* GNOConsole.mm.ragel in Resources */,
B67B3CE612B6FA040033AE07 /* a2-charset-80.png in Resources */,
B6801BD912EB549300B22E9E /* vt100-charset.png in Resources */,
B61EF7C51481561E008C1891 /* titlebar-corner.png in Resources */,
@ -438,6 +436,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B675F4A91E561D20004B0D9C /* Apple80.mm.ragel in Sources */,
B675F4AA1E562159004B0D9C /* GNOConsole.mm.ragel in Sources */,
8D11072D0486CEB800E47090 /* main.m in Sources */,
256AC3DA0F4B6AC300CF3369 /* TwoTermAppDelegate.mm in Sources */,
B676063B11DEAD3500D6B66C /* TermWindowController.mm in Sources */,

View File

@ -10,10 +10,14 @@
#import "Emulator.h"
#include "iGeometry.h"
#include "Screen.h"
@interface Apple80 : NSObject <Emulator> {
_context ctx;
unsigned cs;
int _scratch[4];
context _context;
}
@end

View File

@ -19,6 +19,7 @@
#include "OutputChannel.h"
#include "Screen.h"
#include "algorithm.h"
%%{
@ -82,7 +83,7 @@
| 0x09 ${
// control-I
// tab -- todo, verify.
cursor.x = (cursor.x + 7) & ~7;
cursor.x = (cursor.x + 8) & ~7;
cursor.x = std::min(cursor.x, 79);
}
@ -104,7 +105,7 @@
screen->eraseRect(tmp);
tmp = _iRect(0, 0, 80, 24);
tmp = iRect(0, 0, 80, 24);
tmp.origin.y = cursor.y+1;
tmp.size.height -= cursor.y+1;
screen->eraseRect(tmp);
@ -114,7 +115,7 @@
| 0x0c ${
// control-L
/* clear text port and home */
screen->erase();
screen->eraseScreen();
cursor = iPoint(0,0);
}
@ -128,13 +129,13 @@
| 0x0e ${
// control-N
/* set normal display */
_context->clearFlagBit(Screen::FlagInverse);
_context.clearFlagBit(Screen::FlagInverse);
}
| 0x0f ${
// control-O
/* set inverse display */
_context->setFlagBit(Screen::FlagInverse);
_context.setFlagBit(Screen::FlagInverse);
}
| 0x10 $nop
@ -157,7 +158,7 @@
| 0x18 ${
// CTRL('X'):
/* disable mouse text */
_context->clearFlagBit(Screen::FlagMouseText);
_context.clearFlagBit(Screen::FlagMouseText);
}
| 0x19 ${
@ -170,7 +171,7 @@
// CTRL('Z'):
/* clear line */
iRect tmp;
tmp.origin = iPoint(0 cursor.y);
tmp.origin = iPoint(0, cursor.y);
tmp.size = iSize(80, 1);
screen->eraseRect(tmp);
}
@ -178,7 +179,7 @@
| 0x1b ${
// CTRL('['):
/* ^[ enable mouse text mapping */
_context->setFlagBit(Screen::FlagMouseText);
_context.setFlagBit(Screen::FlagMouseText);
}
| 0x1c ${
@ -186,7 +187,7 @@
/* Moves cursor right one column; if at end of line, does Control-M */
// n.b. - BASIC ^M also moves to next line.
cursor.x++;
if (cursor.x == 24) cursor.x = 0;
if (cursor.x == 80) cursor.x = 0;
}
| 0x1d ${
@ -226,20 +227,20 @@
| 0xa0 .. 0xbf ${
/* special inverse/normal */
uint8_t flag = ~(_context.flags & Screen::FlagInverse);
screen->putc(fc - 0x80, _context.cursor(), flag);
screen->putc(fc - 0x80, _context.cursor, flag);
} $advance
| 0xc0 .. 0xdf ${
/* uppercase normal / mouse text. */
uint8_t flag = ~(_context.flags & Screen::FlagInverse);
if (flag) flag |= Screen::FlagMouseText;
screen->putc(fc - 0x80, _context.cursor(), flag);
screen->putc(fc - 0x80, _context.cursor, flag);
} $advance
| 0xe0 .. 0xff ${
/* special inverse/normal */
uint8_t flag = ~(_context.flags & Screen::FlagInverse);
screen->putc(fc - 0x80, _context.cursor(), flag);
screen->putc(fc - 0x80, _context.cursor, flag);
} $advance
)* $err{ fgoto main; };
@ -278,7 +279,6 @@
_context.window = iRect(0, 0, 80, 24);
_context.cursor = iPoint(0,0);
_context.flags = 0;
_cursorType = Screen::CursorTypeUnderscore;
}
-(BOOL)resizable
@ -299,6 +299,15 @@
term->c_cc[VKILL] = CTRL('X');
}
-(id)init
{
if ((self = [super init]))
{
[self reset];
}
return self;
}
-(void)processData:(const uint8_t *)data length: (size_t)length screen:(Screen *)screen output:(OutputChannel *)output
{
@ -309,7 +318,7 @@
auto &cursor = _context.cursor;
%%write exec;
_screen->setCursor(cursor);
screen->setCursor(cursor);
}

View File

@ -157,14 +157,15 @@
| 0x03 '[' arg1 arg2 arg3 arg4 ${
// CTRL('C'):
// '[' left right top bottom
// n.b. - 0, 79, 0, 23 is full screen.
_scratch[0] = std::max(0, _scratch[0]);
_scratch[2] = std::max(0, _scratch[2]);
_scratch[1] = std::min(80, _scratch[1]);
_scratch[3] = std::min(24, _scratch[3]);
_scratch[1] = std::min(80, _scratch[1]+1);
_scratch[3] = std::min(24, _scratch[3]+1);
if (_scratch[1] <= _scratch[0]) _scratch[1] = 80;