rk86 2.0.23 → 2.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rk86.js +33 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rk86",
3
- "version": "2.0.23",
3
+ "version": "2.0.24",
4
4
  "description": "Эмулятор Радио-86РК (Intel 8080) для терминала",
5
5
  "bin": {
6
6
  "rk86": "rk86.js"
package/rk86.js CHANGED
@@ -4083,7 +4083,7 @@ import { basename } from "path";
4083
4083
  // packages/rk86/package.json
4084
4084
  var package_default = {
4085
4085
  name: "rk86",
4086
- version: "2.0.22",
4086
+ version: "2.0.23",
4087
4087
  description: "\u042D\u043C\u0443\u043B\u044F\u0442\u043E\u0440 \u0420\u0430\u0434\u0438\u043E-86\u0420\u041A (Intel 8080) \u0434\u043B\u044F \u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B\u0430",
4088
4088
  bin: {
4089
4089
  rk86: "rk86.js"
@@ -5319,9 +5319,11 @@ class Memory {
5319
5319
  const addr = address & 65535;
5320
5320
  this.last_access_address = addr;
5321
5321
  this.last_access_operation = "read";
5322
- if (addr === 32770)
5322
+ const ppi_reg = addr & 57347;
5323
+ const vg75_reg = addr & 57345;
5324
+ if (ppi_reg === 32770)
5323
5325
  return this.machine.keyboard.modifiers;
5324
- if (addr === 32769) {
5326
+ if (ppi_reg === 32769) {
5325
5327
  const keyboard_state = this.machine.keyboard.state;
5326
5328
  let ch = 255;
5327
5329
  const kbd_scanline = ~this.buf[32768];
@@ -5330,14 +5332,14 @@ class Memory {
5330
5332
  ch &= keyboard_state[i];
5331
5333
  return ch;
5332
5334
  }
5333
- if (addr === 49153) {
5335
+ if (vg75_reg === 49153) {
5334
5336
  const ticks = this.machine.runner.total_ticks;
5335
5337
  const FRAME = 35600;
5336
5338
  const VRTC_ON = 3560;
5337
5339
  const vrtc = ticks % FRAME >= FRAME - VRTC_ON ? 32 : 0;
5338
5340
  return vrtc | (this.machine.screen.light_pen_active ? 16 : 0);
5339
5341
  }
5340
- if (addr === 49152) {
5342
+ if (vg75_reg === 49152) {
5341
5343
  if (this.vg75_c001_60_cmd === 1) {
5342
5344
  this.vg75_c001_60_cmd = 2;
5343
5345
  return this.machine.screen.light_pen_x;
@@ -5360,11 +5362,12 @@ class Memory {
5360
5362
  const byte = value8 & 255;
5361
5363
  this.last_access_address = addr;
5362
5364
  this.last_access_operation = "write";
5363
- if (addr >= 63488)
5364
- return;
5365
- this.buf[addr] = byte;
5366
- const peripheral_reg = addr & 61439;
5367
- if (peripheral_reg === 32771) {
5365
+ if (addr < 63488)
5366
+ this.buf[addr] = byte;
5367
+ const ppi_reg = addr & 57347;
5368
+ const vg75_reg = addr & 57345;
5369
+ const vt57_reg = addr & 57359;
5370
+ if (ppi_reg === 32771) {
5368
5371
  if (byte & 128) {} else {
5369
5372
  const bit = byte >> 1 & 3;
5370
5373
  const value = byte & 1;
@@ -5373,20 +5376,20 @@ class Memory {
5373
5376
  }
5374
5377
  return;
5375
5378
  }
5376
- if (peripheral_reg === 49153 && byte === 39)
5379
+ if (vg75_reg === 49153 && byte === 39)
5377
5380
  return;
5378
- if (peripheral_reg === 49153 && byte === 224)
5381
+ if (vg75_reg === 49153 && byte === 224)
5379
5382
  return;
5380
- if (peripheral_reg === 49153 && byte === 128) {
5383
+ if (vg75_reg === 49153 && byte === 128) {
5381
5384
  this.vg75_c001_80_cmd = 1;
5382
5385
  return;
5383
5386
  }
5384
- if (peripheral_reg === 49152 && this.vg75_c001_80_cmd === 1) {
5387
+ if (vg75_reg === 49152 && this.vg75_c001_80_cmd === 1) {
5385
5388
  this.vg75_c001_80_cmd += 1;
5386
5389
  this.cursor_x_buf = byte + 1;
5387
5390
  return;
5388
5391
  }
5389
- if (peripheral_reg === 49152 && this.vg75_c001_80_cmd === 2) {
5392
+ if (vg75_reg === 49152 && this.vg75_c001_80_cmd === 2) {
5390
5393
  this.cursor_y_buf = byte + 1;
5391
5394
  this.machine.screen.set_cursor(this.cursor_x_buf - 1, this.cursor_y_buf - 1);
5392
5395
  this.video_screen_cursor_x = this.cursor_x_buf;
@@ -5394,30 +5397,30 @@ class Memory {
5394
5397
  this.vg75_c001_80_cmd = 0;
5395
5398
  return;
5396
5399
  }
5397
- if (peripheral_reg === 49153 && byte === 96) {
5400
+ if (vg75_reg === 49153 && byte === 96) {
5398
5401
  if (this.machine.screen.light_pen_active)
5399
5402
  this.vg75_c001_60_cmd = 1;
5400
5403
  return;
5401
5404
  }
5402
- if (peripheral_reg === 49153 && byte === 0) {
5405
+ if (vg75_reg === 49153 && byte === 0) {
5403
5406
  this.vg75_c001_00_cmd = 1;
5404
5407
  return;
5405
5408
  }
5406
- if (peripheral_reg === 49152 && this.vg75_c001_00_cmd === 1) {
5409
+ if (vg75_reg === 49152 && this.vg75_c001_00_cmd === 1) {
5407
5410
  this.video_screen_size_x_buf = (byte & 127) + 1;
5408
5411
  this.vg75_c001_00_cmd += 1;
5409
5412
  return;
5410
5413
  }
5411
- if (peripheral_reg === 49152 && this.vg75_c001_00_cmd === 2) {
5414
+ if (vg75_reg === 49152 && this.vg75_c001_00_cmd === 2) {
5412
5415
  this.video_screen_size_y_buf = (byte & 63) + 1;
5413
5416
  this.vg75_c001_00_cmd += 1;
5414
5417
  return;
5415
5418
  }
5416
- if (peripheral_reg === 49152 && this.vg75_c001_00_cmd === 3) {
5419
+ if (vg75_reg === 49152 && this.vg75_c001_00_cmd === 3) {
5417
5420
  this.vg75_c001_00_cmd += 1;
5418
5421
  return;
5419
5422
  }
5420
- if (peripheral_reg === 49152 && this.vg75_c001_00_cmd === 4) {
5423
+ if (vg75_reg === 49152 && this.vg75_c001_00_cmd === 4) {
5421
5424
  this.vg75_c001_00_cmd = 0;
5422
5425
  if (this.video_screen_size_x_buf && this.video_screen_size_y_buf) {
5423
5426
  this.video_screen_size_x = this.video_screen_size_x_buf;
@@ -5426,28 +5429,28 @@ class Memory {
5426
5429
  }
5427
5430
  return;
5428
5431
  }
5429
- if (peripheral_reg === 57352 && byte === 128) {
5432
+ if (vt57_reg === 57352 && byte === 128) {
5430
5433
  this.ik57_e008_80_cmd = 1;
5431
5434
  this.ik57_ff = 0;
5432
5435
  this.tape_8002_as_output = 1;
5433
5436
  return;
5434
5437
  }
5435
- if (peripheral_reg === 57348 && this.ik57_e008_80_cmd === 1) {
5438
+ if (vt57_reg === 57348 && this.ik57_e008_80_cmd === 1) {
5436
5439
  this.video_memory_base_buf = byte;
5437
5440
  this.ik57_e008_80_cmd += 1;
5438
5441
  return;
5439
5442
  }
5440
- if (peripheral_reg === 57348 && this.ik57_e008_80_cmd === 2) {
5443
+ if (vt57_reg === 57348 && this.ik57_e008_80_cmd === 2) {
5441
5444
  this.video_memory_base_buf |= byte << 8;
5442
5445
  this.ik57_e008_80_cmd += 1;
5443
5446
  return;
5444
5447
  }
5445
- if (peripheral_reg === 57349 && this.ik57_e008_80_cmd === 3) {
5448
+ if (vt57_reg === 57349 && this.ik57_e008_80_cmd === 3) {
5446
5449
  this.video_memory_size_buf = byte;
5447
5450
  this.ik57_e008_80_cmd += 1;
5448
5451
  return;
5449
5452
  }
5450
- if (peripheral_reg === 57349 && this.ik57_e008_80_cmd === 4) {
5453
+ if (vt57_reg === 57349 && this.ik57_e008_80_cmd === 4) {
5451
5454
  this.video_memory_size_buf = ((this.video_memory_size_buf | byte << 8) & 16383) + 1;
5452
5455
  this.ik57_e008_80_cmd = 0;
5453
5456
  this.video_memory_base = this.video_memory_base_buf;
@@ -5455,11 +5458,11 @@ class Memory {
5455
5458
  this.machine.screen.set_video_memory(this.video_memory_base);
5456
5459
  return;
5457
5460
  }
5458
- if (peripheral_reg === 57352 && byte === 164) {
5461
+ if (vt57_reg === 57352 && byte === 164) {
5459
5462
  this.tape_8002_as_output = 0;
5460
5463
  return;
5461
5464
  }
5462
- if (peripheral_reg === 57348 && this.ik57_e008_80_cmd === 0) {
5465
+ if (vt57_reg === 57348 && this.ik57_e008_80_cmd === 0) {
5463
5466
  if (this.ik57_ff === 0) {
5464
5467
  this.video_memory_base_buf = this.video_memory_base & 65280 | byte;
5465
5468
  this.ik57_ff = 1;
@@ -5471,7 +5474,7 @@ class Memory {
5471
5474
  }
5472
5475
  return;
5473
5476
  }
5474
- if (peripheral_reg === 57349 && this.ik57_e008_80_cmd === 0) {
5477
+ if (vt57_reg === 57349 && this.ik57_e008_80_cmd === 0) {
5475
5478
  if (this.ik57_ff === 0) {
5476
5479
  this.video_memory_size_buf = byte;
5477
5480
  this.ik57_ff = 1;
@@ -5482,7 +5485,7 @@ class Memory {
5482
5485
  }
5483
5486
  return;
5484
5487
  }
5485
- if (addr === 32770) {
5488
+ if (ppi_reg === 32770) {
5486
5489
  if (this.tape_8002_as_output) {
5487
5490
  this.tape_write_bit(byte & 1);
5488
5491
  }