Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91bed21747 | |||
| b402df8e1b |
@@ -11,6 +11,7 @@
|
|||||||
* Switched to Gradle build system with Kotlin support
|
* Switched to Gradle build system with Kotlin support
|
||||||
* Added `--open` command-line option to open a file on start
|
* Added `--open` command-line option to open a file on start
|
||||||
* Added **Keyboard++**: Enhanced keyboard events
|
* Added **Keyboard++**: Enhanced keyboard events
|
||||||
|
* **Keyboard++** is still compatible with old keyboard's ASM code, even though it only repeats the last key down until the key is released.
|
||||||
* Refactored many classes in Kotlin
|
* Refactored many classes in Kotlin
|
||||||
* A LOT of [optimizations](https://github.com/hykilpikonna/EMARS#optimizations)
|
* A LOT of [optimizations](https://github.com/hykilpikonna/EMARS#optimizations)
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
|
|
||||||
## Modifications needed
|
## Modifications needed
|
||||||
|
|
||||||
1. To use **Bitmap Display++**, please add the following code at the end of each render loop:
|
1. To use **Bitmap Display++**, please add the following code at the end of each loop, after render but before sleep:
|
||||||
|
|
||||||
```asm
|
```asm
|
||||||
# Tell the display to update
|
# Tell the display to update
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ plugins {
|
|||||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
version="4.7rc2"
|
version="4.7rc3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Use Maven Central for resolving dependencies.
|
// Use Maven Central for resolving dependencies.
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ class BitmapDisplay : AbstractMarsToolAndApplication
|
|||||||
|
|
||||||
// Keyboard++
|
// Keyboard++
|
||||||
private var keyboardAddr: UInt = 0xFFFF0010u
|
private var keyboardAddr: UInt = 0xFFFF0010u
|
||||||
private var displayUpdateAddr: UInt = 0xFFFF0008u
|
private var oldKeyboardAddr: UInt = 0xFFFF0000u
|
||||||
|
private var oldKeyboardLastPressed: Char = ' '
|
||||||
private var keyboardAttached = false
|
private var keyboardAttached = false
|
||||||
private lateinit var uiKeyboard: JTextField
|
private lateinit var uiKeyboard: JTextField
|
||||||
|
|
||||||
@@ -149,7 +150,7 @@ class BitmapDisplay : AbstractMarsToolAndApplication
|
|||||||
if (ac !is MemoryAccessNotice || ac.accessType != AccessNotice.WRITE) return
|
if (ac !is MemoryAccessNotice || ac.accessType != AccessNotice.WRITE) return
|
||||||
val addr = ac.address.toUInt()
|
val addr = ac.address.toUInt()
|
||||||
|
|
||||||
// For the keyboard
|
// For the keyboard++
|
||||||
if (addr in keyboardAddr..keyboardAddr + 0x30u)
|
if (addr in keyboardAddr..keyboardAddr + 0x30u)
|
||||||
{
|
{
|
||||||
// Offset 0x01 or 0x11 or 0x21 bytes are for telling the keyboard that the events are received
|
// Offset 0x01 or 0x11 or 0x21 bytes are for telling the keyboard that the events are received
|
||||||
@@ -201,6 +202,24 @@ class BitmapDisplay : AbstractMarsToolAndApplication
|
|||||||
println("[Keyboard++] ${e.id} '${e.keyChar}' ${e.keyCode}")
|
println("[Keyboard++] ${e.id} '${e.keyChar}' ${e.keyCode}")
|
||||||
val queue = pooledKeyEvents[offset]!!
|
val queue = pooledKeyEvents[offset]!!
|
||||||
|
|
||||||
|
// Old keyboard compatibility
|
||||||
|
synchronized(Globals.memoryAndRegistersLock)
|
||||||
|
{
|
||||||
|
if (e.id == KeyEvent.KEY_PRESSED)
|
||||||
|
{
|
||||||
|
oldKeyboardLastPressed = e.keyChar
|
||||||
|
Globals.memory.setWord(oldKeyboardAddr.toInt(), 1)
|
||||||
|
Globals.memory.setWord((oldKeyboardAddr + 4u).toInt(), e.keyChar.code)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.id == KeyEvent.KEY_RELEASED && e.keyChar == oldKeyboardLastPressed)
|
||||||
|
{
|
||||||
|
oldKeyboardLastPressed = 0.toChar()
|
||||||
|
Globals.memory.setWord(oldKeyboardAddr.toInt(), 0)
|
||||||
|
Globals.memory.setWord((oldKeyboardAddr + 4u).toInt(), 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for more than 7 key events queued
|
// Check for more than 7 key events queued
|
||||||
if (queue.size == 7) return
|
if (queue.size == 7) return
|
||||||
|
|
||||||
@@ -208,11 +227,11 @@ class BitmapDisplay : AbstractMarsToolAndApplication
|
|||||||
queue.add(e)
|
queue.add(e)
|
||||||
|
|
||||||
// Add to memory
|
// Add to memory
|
||||||
|
var addr = keyboardAddr + offset
|
||||||
|
println("[Keyboard++] Address ${addr.toHex(8)} set to ${queue.size} | ${addr.toHex(8)} set to ${e.keyCode} (${e.keyChar.toHex()})")
|
||||||
synchronized(Globals.memoryAndRegistersLock)
|
synchronized(Globals.memoryAndRegistersLock)
|
||||||
{
|
{
|
||||||
// Change 0x0: Number of events
|
// Change 0x0: Number of events
|
||||||
var addr = keyboardAddr + offset
|
|
||||||
println("[Keyboard++] Address ${addr.toHex(8)} set to ${queue.size} | ${addr.toHex(8)} set to ${e.keyCode} (${e.keyChar.toHex()})")
|
|
||||||
Globals.memory.setByte(addr.toInt(), queue.size)
|
Globals.memory.setByte(addr.toInt(), queue.size)
|
||||||
|
|
||||||
// Set the keycode
|
// Set the keycode
|
||||||
|
|||||||
Reference in New Issue
Block a user