From 5a50fc4b8903fdcb9296cc58c457e964823bd917 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Fri, 22 Mar 2019 20:14:58 -0400 Subject: [PATCH] Added modules sounds and vectors for Apple 2 --- include/apple2/sounds.a02 | 26 +++++++++ include/apple2/sounds.h02 | 22 ++++++++ include/apple2/vectors.a02 | 106 +++++++++++++++++++++++++++++++++++++ include/apple2/vectors.h02 | 71 +++++++++++++++++++++++++ 4 files changed, 225 insertions(+) create mode 100644 include/apple2/sounds.a02 create mode 100644 include/apple2/sounds.h02 create mode 100644 include/apple2/vectors.a02 create mode 100644 include/apple2/vectors.h02 diff --git a/include/apple2/sounds.a02 b/include/apple2/sounds.a02 new file mode 100644 index 0000000..5d13cc6 --- /dev/null +++ b/include/apple2/sounds.a02 @@ -0,0 +1,26 @@ +; C02 library sounds.h02 assembly language subroutines + +;beep() - Produce System Beep Sound +;Affects: A,Y +BEEP EQU $FBDD ;Sound Bell + +;bomb() - Produce System Explosion Sound +;Affects: None +BOMB: RTS ;Function Not Available + +;shoot() - Produce Shooting Sound +;Affects: None +SHOT: RTS ;Function Not Available + +;tick() - Produce System Tick Sound +;Affects: None +TICK: LDA $C030 ;Click Speaker Once + RTS + +;tock() - Produce System Tock Sound +;Affects: None +TOCK: RTS ;Function Not Available + +;zap() - Produce System Zap Sound +;Affects: None +ZAP: RTS ;Function Not Available diff --git a/include/apple2/sounds.h02 b/include/apple2/sounds.h02 new file mode 100644 index 0000000..a8852c6 --- /dev/null +++ b/include/apple2/sounds.h02 @@ -0,0 +1,22 @@ +/************************************************* + * sounds - Predefined Sounds Module for Apple 2 * + *************************************************/ + +/* Produce System Beep Sound */ +char beep(); + +/* Produce Explosion Sound */ +char bomb(); + +/* Produce Shooting Sound */ +char shot(); + +/* Produce High Click Sound */ +char tick(); + +/* Produce Low Click Sound */ +char tock(); + +/* Produce Zap Sound */ +char zap(); + diff --git a/include/apple2/vectors.a02 b/include/apple2/vectors.a02 new file mode 100644 index 0000000..8b108c8 --- /dev/null +++ b/include/apple2/vectors.a02 @@ -0,0 +1,106 @@ +;C02 Interrupt Vector Assembly Language Routines for Apple 2 + +;getbrk() - Return BRK Interrupt Address +;Returns: A = $00 - Software Definable Address +; Y = Address MSB +; X = Address LSB +GETBRK: LDA #$00 ;Return software definable + LDX $03F0 ;and Address in Soft Break Vector + LDY $03F1 + RTS + +;getrst() - Return RST Interrupt Address +;Returns: A = $00 - Autostart ROM (Vectored through RAM) +; $7F - Monitor ROM (Hard Coded) +; Y = Address MSB +; X = Address LSB +GETRST: JSR GETRSC ;Check ROM Version + BNE GETRSX ;If Autostart ROM + LDX $03F2 ; Return Address in Soft Reset Vector + LDY $03F3 + RTS +GETRSX: LDX $FFFC ;Else + LDY $FFFD ; Return Address in 6502 RESET Vector + RTS + +;Check 6502 RESET Vector +;Returns: A = $00 - Autostart ROM (Vectored through RAM) +; $7F - Monitor ROM (Hard Coded) +;Notes: $FFFC contains $FF59 on Apple ][ (Monitor ROM) +; $FA62 on all other machines (Autostart ROM) +GETRSC: LDA $FFFD ;Load MSB of Vector + CMP #$FF ; + BEQ GETRSF ;If Not Monitor ROM + LDA #$00 ; Return $00 + RTS +GETRSF: LDA #$7F ;Else Return $FF + RTS + +;getnmi() - Return NMI Interrupt Address +;Returns: A = $00 - Software Definable Address +; Y = Address MSB +; X = Address LSB +;Notes: $FFFA contains $03FB in all ROMs +GETNMI: LDA #$00 ;Return software definable + LDX $03FB ;and Address in NMI vector + LDY $03FC + RTS + +;getirq() - Return IRQ Interrupt Address +;Returns: A = $00 - Software Definable Address +; Y = Address MSB +; X = Address LSB +;Notes: $FFFE contains $FA86 on Apple ][ (Monitor ROM) +;   $FA40 on Apple ][+ and Pravets +; $C3FA on Apple //e, $FAC3 on TK3000//e +; $FF59 on Franklin 1000 and Laser 128 +GETIRQ: LDA #$00 ;Return software definable + LDX $03FE ;and Address in CINV + LDY $03FF + RTS + +;setbrk() - Set BRK Interrupt Address +;Args: Y = Address MSB +; X = Address LSB +;Returns: A = $00 - Successfully Set +SETBRK: SEI ;Disable Interrupts + STX $03F0 ;Store Address in Soft Rreak Vector + STY $03F1 + CLI ;Enable Interrupts + LDA #$00 ;Return Success + RTS + +;setrst() - Set RST Interrupt Address +;Args: Y = Address MSB +; X = Address LSB +;Returns: A = $00 If Autostart ROM (Success) +; $7F If Monitor ROM (Failure) +SETRST: JSR GETRSC ;Check ROM Version + BNE SETRSX ;If Autostart ROM + SEI ; Disable Interrupts + STX $03F2 ; Store Address in Soft Reset Vector + STY $03F3 + CLI ; Enable Interrupts +SETRSX: RTS + +;setnmi() - Set NMI Interrupt Address +;Args: Y = Address MSB +; X = Address LSB +;Returns: A = $00 - Successfully Set +SETNMI: SEI ;Disable Interrupts + STX $03FB ;Store Address in NMI vector + STY $03FC + CLI ;Enable Interrupts + LDA #$00 ;Return Success + RTS + +;setirq() - Set Maskable Interrupt Address +;Args: Y = Address MSB +; X = Address LSB +;Returns: A = $00 - Successfully Set +SETIRQ: SEI ;Disable Interrupts + STX $03FE ;Store Address in ???? + STY $03FF + CLI ;Enable Interrupts + LDA #$00 + RTS diff --git a/include/apple2/vectors.h02 b/include/apple2/vectors.h02 new file mode 100644 index 0000000..e237e92 --- /dev/null +++ b/include/apple2/vectors.h02 @@ -0,0 +1,71 @@ +/********************************************************* + * vector - 6502 Interrupt Vector Manipulation Functions * + *********************************************************/ + +/* Get BRK Handler Address * + * Returns: Status * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * + * Address MSB * + * Address LSB */ +char getbrk(); + +/* Get IRQ Handler Address * + * Returns: Status * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * + * Address MSB * + * Address LSB */ +char getirq(); + +/* Get NMI Handler Address * + * Returns: Status * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * + * Address MSB * + * Address LSB */ +char getnmi(); + +/* Get RESET Handler Address * + * Returns: Status * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * + * Address MSB * + * Address LSB */ +char getrst(); + +/* Set BRK Handler Address */ + * Args: &d - New Address * + * Returns: Result * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * +char setbrk(); + +/* Set IRQ Handler Address */ + * Args: &d - New Address * + * Returns: Result * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * +char setirq(); + +/* Set NMI Handler Address */ + * Args: &d - New Address * + * Returns: Result * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * +char setnmi(); + +/* Set RESET Handler Address */ + * Args: &d - New Address * + * Returns: Result * + * $00 = modifiable * + * $7F = hard coded * + * $FF = unavailable * +char setrst();