slu4coder / Minimal-64x4-Home-Computer

My DIY home computer with VGA and PS/2 and 4x(!) the processing power of a Commodore C64 or Apple II.
103 stars 12 forks source link

online emulator -> main.js -> ps2ScanCodes on US keyboard #24

Closed gabrielsroka closed 1 month ago

gabrielsroka commented 3 months ago

online emulator -> main.js -> ps2ScanCodes on US keyboard,

i had to make a few changes (i think i got most of it working).

how are you mapping keyCodes (from German) into ASCII?

i'm using https://techdocs.altium.com/display/FPGA/PS2+Keyboard+Scan+Codes but i'm not sure it's right.

i guess it's difference between https://github.com/slu4coder/Minimal-64x4-Home-Computer/blob/main/Programs/asm/keyboard_de.asm and https://github.com/slu4coder/Minimal-64x4-Home-Computer/blob/main/Programs/asm/keyboard_us.asm

  189 /*173*/: 0x4A, // MINUS
  191 /*63*/: 0x4E, // /

  // added
  187: 0x55, // =
  219: 0x54, // [
  220: 0x5D, // \
  221: 0x5B, // ]
  186: 0x4C, // ;
  222: 0x52, // '
gabrielsroka commented 3 months ago

using the p5.js console to edit FLASH to switch y and z and fix other ones worked :)

EDIT: needs Y and Z in additon to y and z :)

or you can add them to function setup()

  // added  
  FLASH[0x1a1a] = 'z'.charCodeAt()
  FLASH[0x1a35] = 'y'.charCodeAt()

  FLASH[0x1a1e + 0x80] = '@'.charCodeAt()
  FLASH[0x1a26 + 0x80] = '#'.charCodeAt()
  FLASH[0x1a36 + 0x80] = '^'.charCodeAt()
  FLASH[0x1a3d + 0x80] = '&'.charCodeAt()
  FLASH[0x1a3e + 0x80] = '*'.charCodeAt()
  FLASH[0x1a41 + 0x80] = '<'.charCodeAt()
  FLASH[0x1a45 + 0x80] = ')'.charCodeAt()
  FLASH[0x1a46 + 0x80] = '('.charCodeAt()
  FLASH[0x1a49 + 0x80] = '>'.charCodeAt()

  FLASH[0x1a4c] = ';'.charCodeAt()
  FLASH[0x1a4c + 0x80] = ':'.charCodeAt()

  FLASH[0x1a4e] = '/'.charCodeAt()
  FLASH[0x1a4e + 0x80] = '?'.charCodeAt()

  FLASH[0x1a52] = "'".charCodeAt()
  FLASH[0x1a52 + 0x80] = '"'.charCodeAt()

  FLASH[0x1a54] = '['.charCodeAt()
  FLASH[0x1a54 + 0x80] = '{'.charCodeAt()

  FLASH[0x1a55] = '='.charCodeAt()
  FLASH[0x1a55 + 0x80] = '+'.charCodeAt()

  FLASH[0x1a5b] = ']'.charCodeAt()
  FLASH[0x1a5b + 0x80] = '}'.charCodeAt()

  FLASH[0x1a5d] = '\\'.charCodeAt()
  FLASH[0x1a5d + 0x80] = '|'.charCodeAt()
gabrielsroka commented 3 months ago

i also modified keyPressed

  if (keyCode == 113) { // F2: uart.txt as serial input
    loadBytes("uart.txt?" + Math.random(), uartbin => {
      uartBuffer = Array.from(uartbin.bytes);
    });
  }

u can modify uart.txt, save it, then press F2 to send the latest version. random is for cache busting.