mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-24 20:31:12 +00:00
Functional mouse API
This commit is contained in:
parent
78a068e6d2
commit
3d44c8533b
@ -14,11 +14,12 @@ import mouse
|
||||
const VBL_INT_ENABLE = $08
|
||||
const BUTTON_INT_ENABLE= $04
|
||||
const MOVE_INT_ENABLE = $02
|
||||
const MOUSE_ENABLE = $01
|
||||
//
|
||||
// Mouse API
|
||||
//
|
||||
struc t_mouse
|
||||
word chkVbl
|
||||
word chkVBL
|
||||
word chkMouse
|
||||
word readMouse // readMouse()#3
|
||||
word setMouse // setMouse(mode)
|
||||
|
@ -47,13 +47,12 @@ end
|
||||
asm chkEvt(addr)
|
||||
LDA ESTKL,X
|
||||
STA ESTKH-1,X
|
||||
PHP
|
||||
SEI
|
||||
LDA (ESTKH-1,X) ; READ INT COUNT
|
||||
TAY
|
||||
LDA #$00
|
||||
STA (ESTKH-1,X) ; CLEAR INT COUNT
|
||||
PLP
|
||||
CLI
|
||||
STY ESTKL,X ; RETURN INT COUNT
|
||||
STA ESTKH,X
|
||||
RTS
|
||||
@ -159,7 +158,6 @@ end
|
||||
for rom = $C100 to $C700 step $0100
|
||||
if rom->5 == $38 and rom->7 == $18 and rom->11 == $01 and rom->12 == $20
|
||||
puts("Found Mouse in slot #"); putc('0' + ((rom >> 8) & $07)); putln
|
||||
puts("Service IRQ: $"); puth(@serviceMouse); putln
|
||||
//
|
||||
// Hook mouse IRQ handler into ProDOS IRQ chain
|
||||
//
|
||||
|
@ -1,11 +1,23 @@
|
||||
include "inc/cmdsys.plh"
|
||||
include "inc/conio.plh"
|
||||
include "inc/mouse.plh"
|
||||
|
||||
var count
|
||||
var xPos, yPos, bttn
|
||||
|
||||
Mouse:setMouse(VBL_INT_ENABLE)
|
||||
while count < 100 and ^$C000 < 128
|
||||
count = count + Mouse:chkVBL()
|
||||
puti(count); putln
|
||||
Mouse:clampMouse(0, 39, 0, 23)
|
||||
//Mouse:setMouse(VBL_INT_ENABLE|MOVE_INT_ENABLE|BUTTON_INT_ENABLE|MOUSE_ENABLE)
|
||||
Mouse:setMouse(MOVE_INT_ENABLE|BUTTON_INT_ENABLE|MOUSE_ENABLE)
|
||||
while ^$C000 < 128
|
||||
if Mouse:chkMouse()
|
||||
conio:gotoxy(xPos, yPos); putc(' ')
|
||||
xPos, yPos, bttn = Mouse:readMouse()#3
|
||||
conio:gotoxy(xPos, yPos); putc(bttn & BUTTON_DOWN ?? '+' :: '^')
|
||||
fin
|
||||
if Mouse:chkVBL()
|
||||
^$400++
|
||||
fin
|
||||
loop
|
||||
getc
|
||||
Mouse:detachMouse()
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user