mirror of
https://github.com/irmen/ksim65.git
synced 2025-02-02 16:33:08 +00:00
keyboard input
This commit is contained in:
parent
448d74baac
commit
ba8946c29c
@ -59,7 +59,7 @@ tasks.named<Test>("test") {
|
|||||||
maxParallelForks = max(1, Runtime.getRuntime().availableProcessors() / 2)
|
maxParallelForks = max(1, Runtime.getRuntime().availableProcessors() / 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile>() {
|
tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = "1.8"
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,13 +3,14 @@ package razorvine.examplemachine
|
|||||||
import razorvine.ksim65.Cpu6502
|
import razorvine.ksim65.Cpu6502
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
import java.awt.image.BufferedImage
|
import java.awt.image.BufferedImage
|
||||||
import java.util.ArrayDeque
|
|
||||||
import javax.imageio.ImageIO
|
import javax.imageio.ImageIO
|
||||||
import javax.swing.event.MouseInputListener
|
import javax.swing.event.MouseInputListener
|
||||||
import razorvine.ksim65.IHostInterface
|
import razorvine.ksim65.IHostInterface
|
||||||
import razorvine.ksim65.components.MemoryComponent
|
import razorvine.ksim65.components.MemoryComponent
|
||||||
import java.awt.event.*
|
import java.awt.event.*
|
||||||
|
import java.util.*
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
|
import javax.swing.Timer
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -324,6 +325,7 @@ class MainWindow(title: String) : JFrame(title), KeyListener, MouseInputListener
|
|||||||
pack()
|
pack()
|
||||||
requestFocusInWindow()
|
requestFocusInWindow()
|
||||||
setLocationRelativeTo(null)
|
setLocationRelativeTo(null)
|
||||||
|
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, mutableSetOf())
|
||||||
isVisible = true
|
isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,8 +345,6 @@ class MainWindow(title: String) : JFrame(title), KeyListener, MouseInputListener
|
|||||||
|
|
||||||
// keyboard events:
|
// keyboard events:
|
||||||
override fun keyTyped(event: KeyEvent) {
|
override fun keyTyped(event: KeyEvent) {
|
||||||
println(event)
|
|
||||||
println("[${event.keyChar}]")
|
|
||||||
keyboardBuffer.add(event.keyChar)
|
keyboardBuffer.add(event.keyChar)
|
||||||
while (keyboardBuffer.size > 8)
|
while (keyboardBuffer.size > 8)
|
||||||
keyboardBuffer.pop()
|
keyboardBuffer.pop()
|
||||||
|
@ -41,7 +41,7 @@ start
|
|||||||
jmp +
|
jmp +
|
||||||
|
|
||||||
_title1 .text "**** COMMODORE 64 BASIC V2 ****", 10, 10, " 64K RAM SYSTEM 38911 BASIC BYTES FREE", 10, 10, "READY.",10,0
|
_title1 .text "**** COMMODORE 64 BASIC V2 ****", 10, 10, " 64K RAM SYSTEM 38911 BASIC BYTES FREE", 10, 10, "READY.",10,0
|
||||||
_text2 .text 10,"Nah, only joking, this is not a weird C-64.",10,"This is a working fantasy virtual 8-bit 6502 machine though!",10
|
_text2 .text 10,"Nah, only joking, this is not a weird C-64.",10,"This is a working fantasy 8-bit 6502 machine though!",10
|
||||||
.text "Type some stuff on the keyboard, use the mouse (with Left button/Right button)", 10, "to draw/erase pixels.",10,10,0
|
.text "Type some stuff on the keyboard, use the mouse (with Left button/Right button)", 10, "to draw/erase pixels.",10,10,0
|
||||||
_text3 .text "Mouse drawing and keyboard scanning: done in main program loop.",10
|
_text3 .text "Mouse drawing and keyboard scanning: done in main program loop.",10
|
||||||
.text "Time displayed at the bottom of the screen: done in timer IRQ.",10,10,0
|
.text "Time displayed at the bottom of the screen: done in timer IRQ.",10,10,0
|
||||||
@ -56,7 +56,11 @@ _text3 .text "Mouse drawing and keyboard scanning: done in main program loop.",1
|
|||||||
|
|
||||||
;--------- draw with mouse
|
;--------- draw with mouse
|
||||||
mousedraw
|
mousedraw
|
||||||
sta MOUSE+5 ; sample position and buttons
|
lda KEYBOARD
|
||||||
|
beq + ; no key
|
||||||
|
sta DISPLAY+$a
|
||||||
|
|
||||||
|
+ sta MOUSE+5 ; sample position and buttons
|
||||||
lda MOUSE+0
|
lda MOUSE+0
|
||||||
sta DISPLAY+3
|
sta DISPLAY+3
|
||||||
lda MOUSE+1
|
lda MOUSE+1
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user