2010-07-08 22:26:58 +00:00
|
|
|
//
|
|
|
|
// VT52.mm
|
|
|
|
// 2Term
|
|
|
|
//
|
|
|
|
// Created by Kelvin Sherlock on 7/7/2010.
|
|
|
|
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <sys/ttydefaults.h>
|
|
|
|
#include <cctype>
|
2011-10-15 23:17:48 +00:00
|
|
|
#include <cstdio>
|
2017-02-25 18:29:14 +00:00
|
|
|
#include <numeric>
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
#import "VT52.h"
|
|
|
|
#include "OutputChannel.h"
|
|
|
|
#include "Screen.h"
|
|
|
|
|
|
|
|
enum {
|
|
|
|
StateText,
|
|
|
|
StateDCAY,
|
|
|
|
StateDCAX
|
|
|
|
};
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-17 18:21:26 +00:00
|
|
|
/*
|
|
|
|
* TODO -- the VT50x are 12 rows but double spaced.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
// VT52 is 24 x 80 upper/lowercase.
|
|
|
|
// 50/50H is 12 * 80, uppercase only. H has a keypad.
|
|
|
|
// The 50s only display/transmit uppercase characters and lack `~ {} characters on the keypad.
|
|
|
|
// VT55 is a VT52 with extra graphic display capabilites.
|
|
|
|
enum {
|
|
|
|
ModelVT50,
|
2017-02-25 18:29:14 +00:00
|
|
|
ModelVT50H,
|
|
|
|
ModelVT52,
|
2010-07-08 22:26:58 +00:00
|
|
|
ModelVT55
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-03 15:23:57 +00:00
|
|
|
#if 0
|
2017-02-25 18:29:14 +00:00
|
|
|
@implementation VT50
|
|
|
|
|
|
|
|
+(void)load {
|
|
|
|
[EmulatorManager registerClass: self];
|
|
|
|
}
|
|
|
|
|
|
|
|
+(NSString *)name {
|
|
|
|
return @"VT50";
|
|
|
|
}
|
|
|
|
-(NSString *)name {
|
|
|
|
return @"VT50";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(const char *)termName {
|
|
|
|
return "vt50";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(struct winsize)displaySize
|
2010-10-06 00:39:09 +00:00
|
|
|
{
|
2017-02-25 18:29:14 +00:00
|
|
|
struct winsize ws = { 24, 80, 0, 0 };
|
|
|
|
|
|
|
|
return ws;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-(id)init {
|
|
|
|
if ((self = [super init])) {
|
|
|
|
_model = ModelVT50;
|
2018-03-01 02:06:06 +00:00
|
|
|
[self reset: YES];
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@implementation VT50H
|
|
|
|
|
|
|
|
+(void)load {
|
2010-10-06 00:39:09 +00:00
|
|
|
[EmulatorManager registerClass: self];
|
|
|
|
}
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
+(NSString *)name {
|
|
|
|
return @"VT50H";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(NSString *)name {
|
|
|
|
return @"VT50H";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(const char *)termName {
|
|
|
|
return "vt50h";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-(id)init {
|
|
|
|
if ((self = [super init])) {
|
|
|
|
_model = ModelVT50H;
|
2018-03-01 02:06:06 +00:00
|
|
|
[self reset: YES];
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(struct winsize)displaySize
|
2010-10-05 18:56:45 +00:00
|
|
|
{
|
2017-02-25 18:29:14 +00:00
|
|
|
struct winsize ws = { 24, 80, 0, 0 };
|
|
|
|
|
|
|
|
return ws;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2018-03-03 15:23:57 +00:00
|
|
|
#endif
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
@implementation VT52
|
|
|
|
|
|
|
|
+(void)load {
|
|
|
|
[EmulatorManager registerClass: self];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+(NSString *)name {
|
2010-10-05 18:56:45 +00:00
|
|
|
return @"VT52";
|
|
|
|
}
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
-(NSString *)name {
|
|
|
|
return @"VT52";
|
2010-07-09 01:18:30 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
-(const char *)termName {
|
|
|
|
return "vt52";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(id)init {
|
|
|
|
if ((self = [super init])) {
|
|
|
|
_model = ModelVT52;
|
2018-03-01 02:06:06 +00:00
|
|
|
[self reset: YES];
|
2017-02-25 18:29:14 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation VT55
|
|
|
|
|
|
|
|
+(void)load {
|
|
|
|
//[EmulatorManager registerClass: self];
|
|
|
|
}
|
|
|
|
|
|
|
|
+(NSString *)name {
|
|
|
|
return @"VT55";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(NSString *)name {
|
|
|
|
return @"VT55";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(const char *)termName {
|
|
|
|
return "vt55";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(id)init {
|
|
|
|
if ((self = [super init])) {
|
|
|
|
_model = ModelVT55;
|
2018-03-01 02:06:06 +00:00
|
|
|
[self reset: YES];
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define ESC "\x1b"
|
|
|
|
|
|
|
|
@implementation VT5x
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+(NSString *)name {
|
|
|
|
return @"";
|
|
|
|
}
|
|
|
|
|
|
|
|
-(NSString *)name {
|
|
|
|
return @"";
|
2010-07-09 01:18:30 +00:00
|
|
|
}
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
-(const char *)termName {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2010-07-09 01:18:30 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
-(void)keyDown: (NSEvent *)event screen: (Screen *)screen output: (OutputChannel *)output
|
|
|
|
{
|
2016-07-05 21:22:50 +00:00
|
|
|
NSEventModifierFlags flags = [event modifierFlags];
|
2010-07-08 22:26:58 +00:00
|
|
|
NSString *chars = [event charactersIgnoringModifiers];
|
2016-07-05 21:22:50 +00:00
|
|
|
NSUInteger length = [chars length];
|
2010-07-17 18:21:26 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
for (unsigned i = 0; i < length; ++i)
|
|
|
|
{
|
|
|
|
unichar uc = [chars characterAtIndex: i];
|
|
|
|
uint8_t c;
|
|
|
|
|
|
|
|
|
|
|
|
if (flags & NSNumericPadKeyMask)
|
|
|
|
{
|
|
|
|
if (_altKeyPad)
|
|
|
|
{
|
|
|
|
const char *str = NULL;
|
|
|
|
switch (uc)
|
|
|
|
{
|
|
|
|
case '0':
|
|
|
|
str = ESC "?p";
|
|
|
|
break;
|
|
|
|
case '1':
|
|
|
|
str = ESC "?q";
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
str = ESC "?r";
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
str = ESC "?s";
|
|
|
|
break;
|
|
|
|
case '4':
|
|
|
|
str = ESC "?t";
|
|
|
|
break;
|
|
|
|
case '5':
|
|
|
|
str = ESC "?u";
|
|
|
|
break;
|
|
|
|
case '6':
|
|
|
|
str = ESC "?v";
|
|
|
|
break;
|
|
|
|
case '7':
|
|
|
|
str = ESC "?w";
|
|
|
|
break;
|
|
|
|
case '8':
|
|
|
|
str = ESC "?x";
|
|
|
|
break;
|
|
|
|
case '9':
|
|
|
|
str = ESC "?y";
|
|
|
|
break;
|
|
|
|
case '.':
|
|
|
|
str = ESC "?n";
|
|
|
|
break;
|
|
|
|
case NSNewlineCharacter: //?
|
|
|
|
case NSEnterCharacter:
|
|
|
|
str = ESC "?M";
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (str)
|
|
|
|
{
|
|
|
|
output->write(str);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (uc)
|
|
|
|
{
|
|
|
|
case NSEnterCharacter:
|
|
|
|
output->write('\r');
|
|
|
|
break;
|
|
|
|
case NSDeleteCharacter:
|
|
|
|
output->write(0x7f);
|
|
|
|
break;
|
|
|
|
case NSUpArrowFunctionKey:
|
|
|
|
output->write(ESC "A");
|
|
|
|
break;
|
|
|
|
case NSDownArrowFunctionKey:
|
|
|
|
output->write(ESC "B");
|
|
|
|
break;
|
|
|
|
case NSRightArrowFunctionKey:
|
|
|
|
output->write(ESC "C");
|
|
|
|
break;
|
|
|
|
case NSLeftArrowFunctionKey:
|
|
|
|
output->write(ESC "D");
|
|
|
|
break;
|
|
|
|
|
2010-07-17 18:21:26 +00:00
|
|
|
// 3 function keys. (VT50H / VT52)
|
|
|
|
case NSF1FunctionKey:
|
|
|
|
output->write(ESC "P");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSF2FunctionKey:
|
|
|
|
output->write(ESC "Q");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSF3FunctionKey:
|
|
|
|
output->write(ESC "R");
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
default:
|
|
|
|
if (uc > 0x7f) break;
|
|
|
|
c = uc;
|
|
|
|
|
2011-02-03 02:39:06 +00:00
|
|
|
if (flags & (NSShiftKeyMask | NSAlphaShiftKeyMask))
|
|
|
|
{
|
|
|
|
c = toupper(c);
|
|
|
|
}
|
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
if (flags & NSControlKeyMask)
|
|
|
|
{
|
|
|
|
c = CTRL(c);
|
|
|
|
}
|
|
|
|
output->write(c);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-01 02:06:06 +00:00
|
|
|
-(void)reset: (BOOL)hard
|
2010-07-08 22:26:58 +00:00
|
|
|
{
|
2017-02-25 18:29:14 +00:00
|
|
|
cs = StateText;
|
|
|
|
_escape = false;
|
|
|
|
_altKeyPad = false;
|
|
|
|
_graphics = false;
|
2018-03-01 02:06:06 +00:00
|
|
|
|
|
|
|
if (hard) {
|
|
|
|
_context.cursor = iPoint(0,0);
|
|
|
|
_context.window = iRect(0, 0, 80, 24);
|
|
|
|
if (_model <= ModelVT50H) _context.window = iRect(0, 0, 80, 12);
|
|
|
|
}
|
2017-02-25 18:29:14 +00:00
|
|
|
_context.flags = 0;
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void advance(context &ctx, Screen *screen) {
|
|
|
|
if (ctx.cursor.x < ctx.window.maxX()-1) ctx.cursor.x++;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)processData: (uint8_t *)data length: (size_t)length screen: (Screen *)screen output: (OutputChannel *)output
|
2010-07-08 22:26:58 +00:00
|
|
|
{
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
cs = std::accumulate(data, data + length, cs, [&](unsigned state, uint8_t c) -> unsigned {
|
|
|
|
|
|
|
|
auto &cursor = _context.cursor;
|
|
|
|
auto &window = _context.window;
|
|
|
|
|
|
|
|
c &= 0x7f;
|
|
|
|
if (c == 0x7f) return state; // pad character
|
|
|
|
if (c < 32) {
|
|
|
|
// control characters are always control characters
|
|
|
|
switch(c) {
|
|
|
|
// bell
|
|
|
|
case 007: NSBeep(); break;
|
|
|
|
// backspace
|
|
|
|
case 010: if (cursor.x) cursor.x--; break;
|
|
|
|
//tab
|
|
|
|
case 011:
|
|
|
|
if (cursor.x < 72) cursor.x = (cursor.x + 8) & ~7;
|
|
|
|
else if (cursor.x < window.maxX() -1) cursor.x++;
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
// linefeed
|
|
|
|
case 012:
|
|
|
|
if (cursor.y < window.maxY() -1) cursor.y++;
|
|
|
|
else {
|
|
|
|
if (_model <= ModelVT50H) screen->scrollUp();
|
|
|
|
screen->scrollUp();
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
// cr
|
|
|
|
case 015: cursor.x = 0; break;
|
|
|
|
// vt05-compatible dca
|
|
|
|
case 016:
|
|
|
|
if (_model == ModelVT50) return StateDCAY;
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
case 0x1b: // escape.
|
|
|
|
if (_model >= ModelVT52) _escape = true;
|
|
|
|
else _escape = !_escape;
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
}
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
if (state == StateDCAY) {
|
|
|
|
c -= 32;
|
|
|
|
//if (_model <= ModelVT50H) c *= 2; // double it up.
|
|
|
|
|
|
|
|
if (c >= window.maxY()) {
|
|
|
|
if (_model <= ModelVT50H) cursor.y = window.maxY() -1;
|
|
|
|
else c = cursor.y;
|
|
|
|
}
|
|
|
|
cursor.y = c;
|
|
|
|
return StateDCAX;
|
|
|
|
}
|
|
|
|
if (state == StateDCAX) {
|
|
|
|
c -= 32;
|
|
|
|
if (c >= window.maxX()) c = window.maxX() -1;
|
|
|
|
cursor.x = c;
|
|
|
|
return StateText;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_escape) {
|
|
|
|
_escape = false;
|
|
|
|
switch(c) {
|
|
|
|
case 'A': if (cursor.y) cursor.y--; break;
|
2010-07-08 22:26:58 +00:00
|
|
|
case 'B':
|
2017-02-25 18:29:14 +00:00
|
|
|
if (_model >= ModelVT50H && cursor.y < window.maxY() -1)
|
|
|
|
cursor.y++;
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
if (cursor.x < window.maxX() -1) cursor.x++;
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
|
|
|
case 'D':
|
2017-02-25 18:29:14 +00:00
|
|
|
if (_model >= ModelVT50H && cursor.x) cursor.x--;
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
// alt graphics
|
|
|
|
case 'F':
|
|
|
|
if (_model >= ModelVT52) _graphics = true;
|
2010-07-09 01:18:30 +00:00
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
case 'G':
|
|
|
|
if (_model >= ModelVT52) _graphics = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
// cursor home
|
|
|
|
case 'H': cursor = iPoint(0,0); break;
|
|
|
|
|
|
|
|
// reverse line feed
|
|
|
|
case 'I':
|
|
|
|
// this is documented as being vt52++
|
|
|
|
// however the 2BSD termcap entry (dating to 1980)
|
|
|
|
// and every termcap since claims 50h supports it...
|
|
|
|
if (_model >= ModelVT50H) {
|
|
|
|
if (cursor.y) cursor.y--;
|
|
|
|
else {
|
|
|
|
screen->scrollDown();
|
|
|
|
if (_model <= ModelVT50H) screen->scrollDown();
|
|
|
|
}
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
case 'J': {
|
|
|
|
// erase to end-of screen
|
|
|
|
|
|
|
|
iRect tmp;
|
|
|
|
|
|
|
|
if (_model <= ModelVT50H) {
|
|
|
|
cursor.y *= 2;
|
|
|
|
window.size.height *= 2;
|
|
|
|
}
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
tmp.origin = cursor;
|
|
|
|
tmp.size = iSize( window.maxX() - cursor.x, 1);
|
|
|
|
screen->eraseRect(tmp);
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
tmp.origin = iPoint(0, cursor.y+1);
|
|
|
|
tmp.size = iSize(window.maxX(), window.maxY() - cursor.y - 1);
|
|
|
|
screen->eraseRect(tmp);
|
|
|
|
|
|
|
|
if (_model <= ModelVT50H) {
|
|
|
|
cursor.y /= 2;
|
|
|
|
window.size.height /= 2;
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
}
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
// erase to eol
|
|
|
|
case 'K': {
|
|
|
|
iRect tmp;
|
|
|
|
|
|
|
|
if (_model <= ModelVT50H) {
|
|
|
|
cursor.y *= 2;
|
|
|
|
window.size.height *= 2;
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
tmp.origin = cursor;
|
|
|
|
tmp.size = iSize( window.maxX() - cursor.x, 1);
|
|
|
|
screen->eraseRect(tmp);
|
|
|
|
|
|
|
|
if (_model <= ModelVT50H) {
|
|
|
|
cursor.y /= 2;
|
|
|
|
window.size.height /= 2;
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
// direct cursor addressing
|
|
|
|
case 'Y':
|
|
|
|
if (_model >= ModelVT50H) {
|
|
|
|
_escape = false;
|
|
|
|
return StateDCAY;
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
case 'Z':
|
|
|
|
// identify terminal.
|
|
|
|
// NB -- these indicate no copier.
|
|
|
|
switch(_model) {
|
|
|
|
case ModelVT50:
|
|
|
|
output->write(ESC "/A");
|
|
|
|
break;
|
|
|
|
case ModelVT50H:
|
|
|
|
output->write(ESC "/H");
|
|
|
|
break;
|
|
|
|
case ModelVT52:
|
|
|
|
output->write(ESC "/K");
|
|
|
|
break;
|
|
|
|
case ModelVT55:
|
2017-02-25 18:29:14 +00:00
|
|
|
output->write(ESC "/C");
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
// alternate keypad
|
|
|
|
case '=':
|
|
|
|
if (_model >= ModelVT52) _altKeyPad = true;
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
case '>':
|
|
|
|
if (_model >= ModelVT52) _altKeyPad = false;
|
2010-07-08 22:26:58 +00:00
|
|
|
break;
|
2017-02-25 18:29:14 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
}
|
2017-02-25 18:29:14 +00:00
|
|
|
return state;
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
2017-02-25 18:29:14 +00:00
|
|
|
// normal text!
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
|
|
|
|
if (c >= 0140 && (_model <= ModelVT50H))
|
|
|
|
c -= 040;
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
if (_model <= ModelVT50H) {
|
|
|
|
auto tmp = cursor; tmp.y *= 2;
|
|
|
|
screen->putc(c, tmp, _context.flags);
|
|
|
|
} else screen->putc(c, cursor, _context.flags);
|
|
|
|
|
|
|
|
advance(_context, screen);
|
|
|
|
return state;
|
|
|
|
|
|
|
|
|
|
|
|
});
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-02-25 18:29:14 +00:00
|
|
|
if (_model <= ModelVT50H) {
|
|
|
|
auto tmp = _context.cursor; tmp.y *= 2;
|
|
|
|
screen->setCursor(tmp);
|
|
|
|
} else screen->setCursor(_context.cursor);
|
|
|
|
|
|
|
|
}
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2010-07-17 18:21:26 +00:00
|
|
|
-(BOOL)resizable
|
|
|
|
{
|
2017-02-25 18:29:14 +00:00
|
|
|
return NO;
|
|
|
|
|
2010-07-17 18:21:26 +00:00
|
|
|
switch (_model)
|
|
|
|
{
|
|
|
|
case ModelVT52:
|
|
|
|
case ModelVT55:
|
|
|
|
return YES;
|
|
|
|
default:
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-(struct winsize)defaultSize
|
|
|
|
{
|
|
|
|
struct winsize ws = { 0, 0, 0, 0};
|
|
|
|
|
|
|
|
// TODO -- although VT50x have 12 rows, they are double spaced.
|
|
|
|
|
|
|
|
switch (_model)
|
|
|
|
{
|
|
|
|
case ModelVT52:
|
|
|
|
case ModelVT55:
|
|
|
|
ws.ws_row = 24;
|
|
|
|
ws.ws_col = 80;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ws.ws_row = 12;
|
|
|
|
ws.ws_col = 80;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ws;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
@end
|