mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
WIP
This commit is contained in:
parent
7ceacec28e
commit
f6b239913a
84
js/cards/serial.js
Normal file
84
js/cards/serial.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
/* Copyright 2010-2019 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation. No representations are made about the suitability of this
|
||||
* software for any purpose. It is provided "as is" without express or
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
import { debug, toHex } from '../util';
|
||||
import { P7, P8A } from '../roms/cards/serial';
|
||||
|
||||
export default function Serial(io, cbs) {
|
||||
|
||||
debug('Serial card');
|
||||
var SWITCHES = [
|
||||
0, // SW1 Baud bit 0
|
||||
0, // SW2 Baud bit 1
|
||||
0, // SW3 Baud bit 2 000 - 19200
|
||||
1, // SW4 CR Delay 1 - Disabled
|
||||
1, // SW5 Width bit 0
|
||||
1, // SW6 Width bit 1 11 - 40 Columns
|
||||
1, // SW7 Line feed 1 - Disabled
|
||||
];
|
||||
|
||||
var LOC = {
|
||||
STATUS: 0x80,
|
||||
DATA_1: 0x81,
|
||||
DATA_0: 0x82
|
||||
};
|
||||
|
||||
function init() {
|
||||
debug('Serial Card');
|
||||
}
|
||||
|
||||
function _access(off, val) {
|
||||
var nextBit = 1;
|
||||
var result = undefined;
|
||||
if (val === undefined) {
|
||||
result = 0;
|
||||
for (var idx = 0; idx < 7; idx++) {
|
||||
result >>= 1;
|
||||
result |= SWITCHES[idx] ? 0x80 : 0;
|
||||
}
|
||||
result >>= 1;
|
||||
result |= nextBit ? 0x80 : 0;
|
||||
|
||||
switch (off & 0x83) {
|
||||
case LOC.STATUS:
|
||||
break;
|
||||
case LOC.DATA_1:
|
||||
debug('xmit 1');
|
||||
break;
|
||||
case LOC.DATA_0:
|
||||
debug('xmit 0');
|
||||
break;
|
||||
default:
|
||||
debug('Serial card unknown soft switch', toHex(off));
|
||||
}
|
||||
} else {
|
||||
debug('Serial card write to', toHex(off), toHex(val));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
return {
|
||||
ioSwitch: function (off, val) {
|
||||
return _access(off, val);
|
||||
},
|
||||
read: function(page, off) {
|
||||
if (page < 0xC8) {
|
||||
return P7[off];
|
||||
} else {
|
||||
return P8A[((page % 2) << 8) | off];
|
||||
}
|
||||
},
|
||||
write: function() {}
|
||||
};
|
||||
}
|
101
js/roms/cards/serial.js
Normal file
101
js/roms/cards/serial.js
Normal file
|
@ -0,0 +1,101 @@
|
|||
export var P7 = [
|
||||
0x2c,0x58,0xff,0x70,0x04,0x38,0x90,0x18,
|
||||
0xb8,0x08,0x78,0x86,0x35,0x48,0x8a,0x48,
|
||||
0x98,0x48,0xad,0xff,0xcf,0x20,0x58,0xff,
|
||||
0xba,0xbd,0x00,0x01,0x8d,0xf8,0x07,0x0a,
|
||||
0x0a,0x0a,0x0a,0x8d,0xf8,0x06,0xa8,0x68,
|
||||
0x68,0x68,0x28,0x9a,0xae,0xf8,0x07,0x48,
|
||||
0x50,0x03,0x20,0x00,0xc8,0x90,0x43,0xad,
|
||||
0x78,0x06,0x48,0x08,0x30,0x0f,0xa4,0x35,
|
||||
0xf0,0x0b,0x88,0xd9,0x00,0x02,0xd0,0x05,
|
||||
0x09,0xe0,0x99,0x00,0x02,0x20,0x4d,0xc8,
|
||||
0x28,0x68,0x49,0x9b,0xd0,0x01,0x18,0xa9,
|
||||
0xdf,0x90,0x03,0x1d,0x38,0x07,0x85,0x35,
|
||||
0x68,0xa4,0x24,0x08,0x4c,0xdc,0xc8,0xa0,
|
||||
0x00,0xbd,0x38,0x05,0xfd,0x38,0x06,0xc9,
|
||||
0xf8,0x90,0x03,0x69,0x27,0xa8,0x38,0x4c,
|
||||
0x23,0xc9,0xbd,0xb8,0x04,0x10,0x1f,0x29,
|
||||
0x7f,0x9d,0xb8,0x04,0xbd,0x38,0x07,0x4a,
|
||||
0x68,0x49,0x8d,0xd0,0x09,0x9d,0x38,0x05,
|
||||
0x90,0x04,0xa9,0x8a,0xb0,0x34,0xbd,0x38,
|
||||
0x07,0x30,0xcc,0x4c,0xc9,0xc8,0xbd,0x38,
|
||||
0x07,0x10,0x14,0xa5,0x24,0xdd,0x38,0x05,
|
||||
0xb0,0x0d,0xc9,0x11,0xb0,0x09,0x09,0xf0,
|
||||
0x3d,0x38,0x05,0x65,0x24,0x85,0x24,0xbd,
|
||||
0x38,0x05,0xc5,0x24,0x68,0xb0,0x03,0x48,
|
||||
0xa9,0xa0,0x2c,0x58,0xff,0xf0,0x03,0xfe,
|
||||
0x38,0x05,0x08,0x48,0x9d,0xb8,0x05,0x20,
|
||||
0xaa,0xc9,0x68,0x49,0x8d,0xd0,0x16,0x9d,
|
||||
0x38,0x05,0x85,0x24,0xbd,0x38,0x07,0x48,
|
||||
0x29,0x40,0xd0,0x03,0x20,0xa8,0xfc,0x68,
|
||||
0x4a,0xa9,0x8a,0xb0,0xde,0xbd,0x38,0x06,
|
||||
0xf0,0x07,0xfd,0x38,0x05,0xa9,0x8d,0x90,
|
||||
0xd2,0x28,0x90,0xbb,0xb0,0x98,0x00,0x00
|
||||
];
|
||||
|
||||
export var P8A = [
|
||||
0xb9,0x80,0xc0,0x48,0x29,0x07,0xa8,0xb9,
|
||||
0x31,0xc9,0x9d,0xb8,0x03,0x68,0x4a,0x09,
|
||||
0x03,0x9d,0xb8,0x04,0x4a,0x4a,0x4a,0x48,
|
||||
0x29,0x03,0xa8,0xb9,0x39,0xc9,0x9d,0x38,
|
||||
0x04,0x68,0x4a,0xc0,0x01,0x6a,0x09,0x60,
|
||||
0x9d,0x38,0x07,0xa9,0x00,0x9d,0x38,0x06,
|
||||
0x9d,0xb8,0x06,0xe4,0x37,0xd0,0x0c,0xc5,
|
||||
0x36,0xd0,0x08,0xa9,0x07,0x85,0x36,0x18,
|
||||
0x60,0x18,0x60,0xe4,0x39,0xd0,0xfa,0xa9,
|
||||
0x05,0x85,0x38,0x38,0x60,0x78,0xbd,0xb8,
|
||||
0x04,0x29,0x03,0x4a,0x6e,0x78,0x07,0x48,
|
||||
0xa9,0x09,0xea,0x85,0x35,0xac,0xf8,0x06,
|
||||
0x38,0xb0,0x08,0xac,0xf8,0x06,0xc6,0x35,
|
||||
0xf0,0x40,0x18,0xb9,0x80,0xc0,0x90,0x1f,
|
||||
0x10,0x0d,0xad,0x00,0xc0,0x10,0xf4,0x9d,
|
||||
0xb8,0x05,0x2c,0x10,0xc0,0x68,0x60,0xbd,
|
||||
0xb8,0x03,0xa0,0x09,0x88,0xd0,0xfd,0xe9,
|
||||
0x01,0xf0,0xd8,0xa0,0x0e,0xd0,0xf5,0xa8,
|
||||
0x2a,0x7e,0xb8,0x05,0x98,0x4d,0x78,0x07,
|
||||
0x8d,0x78,0x07,0xbd,0xb8,0x03,0x38,0xe9,
|
||||
0x01,0xf0,0xc0,0xa0,0x09,0x88,0xd0,0xfd,
|
||||
0xf0,0xf5,0x68,0xd0,0x08,0xb9,0x80,0xc0,
|
||||
0x4d,0x78,0x07,0x30,0x96,0xb9,0x80,0xc0,
|
||||
0x10,0xfb,0xa9,0x0a,0xe9,0x09,0xea,0xa8,
|
||||
0x88,0xf0,0x89,0x7e,0xb8,0x05,0x38,0xb0,
|
||||
0xf7,0x20,0x48,0xc9,0x68,0xa8,0x68,0xaa,
|
||||
0x68,0x09,0x80,0x49,0xe0,0xc9,0x1f,0x90,
|
||||
0x6b,0xb0,0x67,0x00,0x91,0x28,0xbd,0xb8,
|
||||
0x05,0x09,0x80,0xc9,0x95,0xd0,0x02,0xb1,
|
||||
0x28,0xc9,0xe0,0x90,0x11,0x25,0x35,0xc9,
|
||||
0xe0,0x90,0x0b,0xa4,0x37,0xc0,0xfd,0xf0,
|
||||
0x03,0x29,0x7f,0xac,0x29,0x1f,0x8d,0x78,
|
||||
0x06,0x28,0x1e,0xb8,0x04,0x38,0x7e,0xb8,
|
||||
0x04,0x90,0x1a,0x20,0x48,0xc9,0xa0,0x00,
|
||||
0xbd,0x38,0x05,0x38,0xfd,0x38,0x04,0xc9,
|
||||
0xf8,0x90,0x03,0x69,0x27,0xa8,0x84,0x24,
|
||||
0x38,0xb0,0x02,0xb0,0xe6,0x68,0xa8,0x68,
|
||||
0xaa,0x68,0xb0,0x03,0xad,0x78,0x06,0x28,
|
||||
0x60,0xb0,0x90,0x40,0x10,0x08,0x04,0x02,
|
||||
0x01,0x29,0x48,0x50,0x84,0x60,0x00,0x00,
|
||||
0x00,0x60,0x49,0xe0,0x28,0x4c,0xf0,0xfd,
|
||||
0xa5,0x3c,0x49,0x08,0x0a,0xf0,0x04,0x49,
|
||||
0xee,0xd0,0x08,0xde,0x38,0x05,0x10,0x03,
|
||||
0x9d,0x38,0x05,0x60,0x00,0x00,0x00,0xbd,
|
||||
0xb8,0x05,0x85,0x3c,0xbd,0xb8,0x06,0xc9,
|
||||
0x67,0x90,0x10,0xc9,0x6c,0xb0,0x1f,0xc9,
|
||||
0x6b,0xa5,0x3c,0x49,0x9b,0x29,0x7f,0xd0,
|
||||
0x15,0xb0,0x16,0xa9,0x83,0x20,0x93,0xc9,
|
||||
0x20,0x4d,0xc8,0xbd,0xb8,0x05,0x49,0x86,
|
||||
0x0a,0xd0,0xf0,0x9d,0xb8,0x06,0xde,0xb8,
|
||||
0x06,0xa5,0x3c,0x9d,0xb8,0x05,0x49,0x8d,
|
||||
0x0a,0xd0,0x0a,0xbd,0xb8,0x04,0x29,0x04,
|
||||
0xd0,0x03,0x9d,0xb8,0x06,0x78,0x18,0x08,
|
||||
0x90,0x03,0x4c,0x5f,0xc9,0x38,0x08,0xa0,
|
||||
0x09,0xea,0x84,0x35,0xa9,0x01,0x3d,0xb8,
|
||||
0x04,0x0d,0xf8,0x06,0x8d,0x78,0x07,0xa9,
|
||||
0x00,0x1e,0xb8,0x05,0x7e,0xb8,0x05,0x2a,
|
||||
0x0d,0xf8,0x06,0xa8,0x29,0x01,0x4d,0x78,
|
||||
0x07,0x8d,0x78,0x07,0x38,0xb9,0x81,0xc0,
|
||||
0xbd,0xb8,0x03,0xe9,0x01,0xf0,0x07,0xa0,
|
||||
0x09,0x88,0xd0,0xfd,0xf0,0xf5,0xa0,0x02,
|
||||
0xea,0xc6,0x35,0xd0,0xd7,0x28,0x90,0x0e,
|
||||
0x84,0x35,0xbd,0xb8,0x04,0x29,0x02,0x4a,
|
||||
0x0d,0x78,0x07,0xa8,0xd0,0xd6,0xa8,0x60,
|
||||
];
|
Loading…
Reference in New Issue
Block a user