Add mouse support to the demo so we can test having two sources of interrupts firing at the same time - speech interrupts and mouse interrupts.

This commit is contained in:
Jeremy Rand 2016-12-17 23:32:03 -05:00
parent 787e743e0e
commit ee5b55de46
4 changed files with 450 additions and 1 deletions

View File

@ -8,6 +8,7 @@
/* Begin PBXFileReference section */
9D16BCE21D9E070B005EE214 /* mockingboard_speech.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = mockingboard_speech.s; sourceTree = "<group>"; };
9D2D42431E064633005EEBDD /* a2e.stdmou.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = a2e.stdmou.s; sourceTree = "<group>"; };
9D49929C1DB5C5F700606789 /* mockingboard_speech.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mockingboard_speech.h; sourceTree = "<group>"; };
9DB3C98C1D84A11600395532 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
9DB3C98D1D84A11600395532 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
@ -39,6 +40,7 @@
9DB3C99D1D84A21E00395532 /* mockingboard.h */,
9D16BCE21D9E070B005EE214 /* mockingboard_speech.s */,
9D49929C1DB5C5F700606789 /* mockingboard_speech.h */,
9D2D42431E064633005EEBDD /* a2e.stdmou.s */,
9DB3C98D1D84A11600395532 /* Makefile */,
9DB3C98E1D84A11600395532 /* make */,
);

427
mocktest/a2e.stdmou.s Normal file
View File

@ -0,0 +1,427 @@
;
; File generated by co65 v 2.13.3 using model `cc65-module'
;
.fopt compiler,"co65 v 2.13.3"
.case on
.debuginfo off
.export _a2e_stdmou_mou
;
; CODE SEGMENT
;
.segment "CODE"
_a2e_stdmou_mou:
.byte $6D
.byte $6F
.byte $75
.byte $02
.word _a2e_stdmou_mou+41
.word _a2e_stdmou_mou+170
.word _a2e_stdmou_mou+286
.word _a2e_stdmou_mou+295
.word _a2e_stdmou_mou+180
.word _a2e_stdmou_mou+238
.word _a2e_stdmou_mou+253
.word _a2e_stdmou_mou+299
.word _a2e_stdmou_mou+305
.word _a2e_stdmou_mou+309
.word _a2e_stdmou_mou+322
.word _a2e_stdmou_mou+327
.byte $40
.byte $4C
.byte $00
.byte $00
.byte $4C
.byte $00
.byte $00
.byte $4C
.byte $00
.byte $00
.byte $4C
.byte $00
.byte $00
.byte $A9
.byte $00
.byte $85
.byte <(ZEROPAGE+8)
.byte $A9
.byte $C0
.byte $85
.byte <(ZEROPAGE+9)
.byte $E6
.byte <(ZEROPAGE+9)
.byte $A5
.byte <(ZEROPAGE+9)
.byte $C9
.byte $C8
.byte $90
.byte $05
.byte $A9
.byte $04
.byte $A2
.byte $00
.byte $60
.byte $A2
.byte $03
.byte $BC
.word _a2e_stdmou_mou+421
.byte $BD
.word _a2e_stdmou_mou+425
.byte $D1
.byte <(ZEROPAGE+8)
.byte $D0
.byte $E7
.byte $CA
.byte $10
.byte $F3
.byte $A5
.byte <(ZEROPAGE+9)
.byte $8D
.word DATA+2
.byte $8D
.word DATA+7
.byte $8D
.word DATA+12
.byte $78
.byte $29
.byte $0F
.byte $8D
.word BSS+13
.byte $0A
.byte $0A
.byte $0A
.byte $0A
.byte $8D
.word DATA+9
.byte $2C
.byte $82
.byte $C0
.byte $A2
.byte $19
.byte $20
.word DATA+0
.byte $2C
.byte $80
.byte $C0
.byte $A9
.byte $01
.byte $A2
.byte $12
.byte $20
.word DATA+0
.byte $A9
.byte <(_a2e_stdmou_mou+173)
.byte $A2
.byte >(_a2e_stdmou_mou+429)
.byte $20
.word _a2e_stdmou_mou+180
.byte $AE
.word BSS+13
.byte $A9
.byte $8B
.byte $9D
.byte $78
.byte $04
.byte $A9
.byte $00
.byte $9D
.byte $78
.byte $05
.byte $A9
.byte $5F
.byte $9D
.byte $F8
.byte $04
.byte $A9
.byte $00
.byte $9D
.byte $F8
.byte $05
.byte $A2
.byte $16
.byte $20
.word DATA+0
.byte $20
.word _a2e_stdmou_mou+372
.byte $A9
.byte $09
.byte $A2
.byte $12
.byte $20
.word DATA+0
.byte $58
.byte $A9
.byte $00
.byte $A2
.byte $00
.byte $60
.byte $78
.byte $20
.word _a2e_stdmou_mou+29
.byte $A9
.byte $00
.byte $A2
.byte $12
.byte $D0
.byte $ED
.byte $85
.byte <(ZEROPAGE+8)
.byte $86
.byte <(ZEROPAGE+9)
.byte $A2
.byte $00
.byte $A0
.byte $00
.byte $20
.word _a2e_stdmou_mou+195
.byte $A2
.byte $01
.byte $A0
.byte $02
.byte $78
.byte $B1
.byte <(ZEROPAGE+8)
.byte $99
.word BSS+0
.byte $8D
.byte $78
.byte $04
.byte $C8
.byte $B1
.byte <(ZEROPAGE+8)
.byte $99
.word BSS+0
.byte $8D
.byte $78
.byte $05
.byte $C8
.byte $C8
.byte $C8
.byte $B1
.byte <(ZEROPAGE+8)
.byte $99
.word BSS+0
.byte $8D
.byte $F8
.byte $04
.byte $C8
.byte $B1
.byte <(ZEROPAGE+8)
.byte $99
.word BSS+0
.byte $8D
.byte $F8
.byte $05
.byte $8A
.byte $A2
.byte $17
.byte $D0
.byte $B3
.byte $85
.byte <(ZEROPAGE+8)
.byte $86
.byte <(ZEROPAGE+9)
.byte $A0
.byte $07
.byte $B9
.word BSS+0
.byte $91
.byte <(ZEROPAGE+8)
.byte $88
.byte $10
.byte $F8
.byte $60
.byte $AC
.word BSS+13
.byte $78
.byte $99
.byte $F8
.byte $04
.byte $8A
.byte $99
.byte $F8
.byte $05
.byte $98
.byte $AA
.byte $A0
.byte $00
.byte $B1
.byte <(ZEROPAGE+0)
.byte $C8
.byte $9D
.byte $78
.byte $04
.byte $B1
.byte <(ZEROPAGE+0)
.byte $9D
.byte $78
.byte $05
.byte $20
.word _a2e_stdmou_mou+372
.byte $A2
.byte $16
.byte $D0
.byte $83
.byte $CE
.word BSS+14
.byte $78
.byte $20
.word _a2e_stdmou_mou+29
.byte $58
.byte $60
.byte $EE
.word BSS+14
.byte $60
.byte $AD
.word BSS+12
.byte $A2
.byte $00
.byte $60
.byte $A0
.byte $03
.byte $D0
.byte $02
.byte $A0
.byte $04
.byte $78
.byte $B9
.word BSS+8
.byte $91
.byte <(ZEROPAGE+8)
.byte $88
.byte $10
.byte $F8
.byte $58
.byte $60
.byte $A9
.byte $05
.byte $A2
.byte $00
.byte $60
.byte $AD
.word BSS+13
.byte $F0
.byte $08
.byte $A2
.byte $13
.byte $20
.word DATA+0
.byte $90
.byte $02
.byte $18
.byte $60
.byte $A2
.byte $14
.byte $20
.word DATA+0
.byte $AC
.word BSS+13
.byte $B9
.byte $78
.byte $07
.byte $AA
.byte $0A
.byte $29
.byte $20
.byte $F0
.byte $02
.byte $A9
.byte $01
.byte $90
.byte $02
.byte $09
.byte $10
.byte $8D
.word BSS+12
.byte $8A
.byte $29
.byte $20
.byte $F0
.byte $27
.byte $20
.word _a2e_stdmou_mou+29
.byte $AC
.word BSS+13
.byte $B9
.byte $78
.byte $04
.byte $BE
.byte $78
.byte $05
.byte $8D
.word BSS+8
.byte $8E
.word BSS+9
.byte $20
.word _a2e_stdmou_mou+35
.byte $AC
.word BSS+13
.byte $B9
.byte $F8
.byte $04
.byte $BE
.byte $F8
.byte $05
.byte $8D
.word BSS+10
.byte $8E
.word BSS+11
.byte $20
.word _a2e_stdmou_mou+38
.byte $AD
.word BSS+14
.byte $F0
.byte $03
.byte $20
.word _a2e_stdmou_mou+32
.byte $38
.byte $60
.byte $05
.byte $07
.byte $0B
.byte $0C
.byte $38
.byte $18
.byte $01
.byte $20
.byte $00
.byte $00
.byte $00
.byte $00
.byte $17
.byte $01
.byte $BF
.byte $00
;
; DATA SEGMENT
;
.segment "DATA"
DATA:
.byte $BC
.byte $00
.byte $FF
.byte $8C
.word DATA+11
.byte $A2
.byte $FF
.byte $A0
.byte $FF
.byte $4C
.byte $FF
.byte $FF
;
; BSS SEGMENT
;
.segment "BSS"
BSS:
.res 15
;
; ZEROPAGE SEGMENT
;
.import __ZP_START__ ; Linker generated symbol
ZEROPAGE = __ZP_START__
.end

View File

@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdint.h>
#include <conio.h>
#include <mouse.h>
#include "mockingboard.h"
@ -70,6 +71,9 @@ uint8_t mySpeechData[] = {
};
extern char a2e_stdmou_mou;
void delay(void)
{
int i;
@ -96,15 +100,32 @@ int main(void)
cgetc();
printf("RUN SPEECH TEST (Y/N) ");
if (cgetc() == 'Y') {
bool mouseInstalled = false;
printf("\n");
mockingBoardInit(4, true);
if (mouse_install(&mouse_def_callbacks, &a2e_stdmou_mou) == 0) {
mouseInstalled = true;
}
mockingBoardSpeak(mySpeechData, sizeof(mySpeechData));
while (mockingBoardSpeechIsBusy()) {
if (mouseInstalled) {
struct mouse_info mouseInfo;
mouse_info(&mouseInfo);
printf("X:%3d Y:%3d %s\n", mouseInfo.pos.x, mouseInfo.pos.y,
((mouseInfo.buttons != 0) ? "PRESSED" : ""));
}
}
printf("\nDone speaking\n");
cgetc();
if (mouseInstalled)
mouse_uninstall();
}
mockingBoardShutdown();

View File

@ -147,7 +147,6 @@ readChip:
.endproc
.proc _mockInterrupt
; If we have a 6522 interrupt, jump to L4.
ldx #IFR