mirror of
https://github.com/lowobservable/oec.git
synced 2026-05-02 14:20:58 +00:00
IBM 3179 EAB support
This commit is contained in:
@@ -81,3 +81,75 @@ class Terminal(Device):
|
||||
def load_control_register(self):
|
||||
"""Execute a LOAD_CONTROL_REGISTER command."""
|
||||
self.execute(LoadControlRegister(self.control))
|
||||
|
||||
def get_model(terminal_id, extended_id):
|
||||
if extended_id is None:
|
||||
return None
|
||||
|
||||
model = extended_id[2:6]
|
||||
|
||||
# The 3179 does return an extended ID, but it does not include the model
|
||||
# like later terminals.
|
||||
if model == '0000':
|
||||
model = '3179'
|
||||
|
||||
return model
|
||||
|
||||
def get_keyboard_description(terminal_id, extended_id):
|
||||
is_3278 = extended_id is None or not int(extended_id[0:2], 16) & 0x80
|
||||
|
||||
if is_3278:
|
||||
description = '3278'
|
||||
|
||||
id_map = {
|
||||
0b0001: 'APL',
|
||||
0b0010: 'TEXT',
|
||||
0b0100: 'TYPEWRITER-PSHICO',
|
||||
0b0101: 'APL',
|
||||
0b0110: 'TEXT',
|
||||
0b0111: 'APL-PSHICO',
|
||||
0b1000: 'DATAENTRY-2',
|
||||
0b1001: 'DATAENTRY-1',
|
||||
0b1010: 'TYPEWRITER',
|
||||
0b1100: 'DATAENTRY-2',
|
||||
0b1101: 'DATAENTRY-1',
|
||||
0b1110: 'TYPEWRITER'
|
||||
}
|
||||
|
||||
if terminal_id.keyboard in id_map:
|
||||
description += '-' + id_map[terminal_id.keyboard]
|
||||
|
||||
return description
|
||||
|
||||
id_ = int(extended_id[0:2], 16) & 0x1f
|
||||
|
||||
is_user = int(extended_id[0:2], 16) & 0x20
|
||||
|
||||
if is_user:
|
||||
description = 'USER'
|
||||
|
||||
if id_ in [1, 2, 3, 4]:
|
||||
description += f'-{id_}'
|
||||
|
||||
return description
|
||||
|
||||
is_ibm = not int(extended_id[6:8], 16) & 0x80
|
||||
|
||||
description = 'IBM' if is_ibm else 'UNKNOWN'
|
||||
|
||||
is_enhanced = int(extended_id[6:8], 16) & 0x01
|
||||
|
||||
if is_enhanced:
|
||||
if id_ == 1:
|
||||
return description + '-ENHANCED'
|
||||
|
||||
return None
|
||||
|
||||
if id_ == 1:
|
||||
return description + '-TYPEWRITER'
|
||||
elif id_ == 2:
|
||||
return description + '-DATAENTRY'
|
||||
elif id_ == 3:
|
||||
return description + '-APL'
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user