home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Set of Apple II Hard Drive Images
/
eric.hdv
/
SOURCE
/
DANCNOTE.SC0.txt
< prev
next >
Wrap
Text File
|
2020-08-13
|
6KB
|
264 lines
; DANCNOTE.SC0 - NON-INTERRUPT DRIVEN
;
ORG $6000
;
JMP START
;
GRPHMODE DFB $01 ; 01=USE GRAPHICS MODE,$00=USE TEXT MODE,$02=DOUBLE HIRES
DISPMODE DFB $01
MASKDRUM DFB $01
USEINVRS DFB $00
INBYTE DFB $00
PHASE DFB $00
LASTSTAT DFB $00
XMITSTS DFB $00
XMITBYT1 DFB $00
XMITBYT2 DFB $00
XMITBYT3 DFB $00
DBYTES DFB $00
MIDISLOT DFB $20
;
JMP INITDHR
JMP DONEDHR
;
GETINST EQU $00
DATA1 EQU $01
DATA2 EQU $02
DATA3 EQU $03
SYSX0 EQU $04
DATA2B EQU $05
;
START LDA #$13
LDX MIDISLOT
STA $C088,X
LDA #$11
STA $C088,X
WAITMIDI LDA $C000
BMI ADIOS
LDX MIDISLOT
LDA $C088,X
AND #$01
BEQ WAITMIDI
LDX MIDISLOT
LDA $C089,X
CMP #$F0
BEQ SKIPSYSX
BCS WAITMIDI
SYSXRET STA INBYTE
JSR PRCSBYTE
LDA $C000
BPL WAITMIDI
ADIOS LDA $C010
RTS
;
SKIPSYSX LDX MIDISLOT
LDA $C088,X
AND #$01
BEQ SKIPSYSX
LDA $C089,X
BPL SKIPSYSX
BMI SYSXRET
;
PRCSBYTE LDA PHASE
PHINST CMP #GETINST
BEQ PHINST0
JMP PHDATA3
PHINST0 LDA INBYTE
BPL RUNNING
;
; CMP #$F0
; BCS CHKF0
;
STA LASTSTAT
STA XMITSTS
CMP #$E0
BCS TWOBYTES
CMP #$C0
BCC TWOBYTES
;
LDA #1
STA DBYTES
LDA #DATA1
STA PHASE
RTS
;
TWOBYTES LDA #2
STA DBYTES
LDA #DATA2
STA PHASE
RTS
;
;CHKF0 BNE CHKF7
; LDA #SYSX0
; STA PHASE
; RTS
;
;CHKF7 CMP #$F7
; BNE INVAL
; LDA #GETINST
; STA PHASE
; RTS
;
;INVAL RTS
;
RUNNING LDA LASTSTAT
STA XMITSTS
LDA INBYTE
STA XMITBYT1
LDA #$FF
STA XMITBYT2
LDA DBYTES
CMP #1
BEQ SENDMSG
LDA #DATA3
STA PHASE
RTS
;
PHDATA3 CMP #DATA3
BNE PHDATA2
LDA INBYTE
STA XMITBYT2
LDA #$FF
STA XMITBYT3
JMP SENDMSG
;
PHDATA2 CMP #DATA2
BNE PHDATA1
LDA INBYTE
STA XMITBYT1
LDA #DATA2B
STA PHASE
RTS
;
PHDATA1 CMP #DATA1
BNE PHDATA2B
LDA INBYTE
STA XMITBYT1
LDA #$FF
STA XMITBYT2
JMP SENDMSG
;
PHDATA2B CMP #DATA2B
BNE PHSYSX
LDA INBYTE
STA XMITBYT2
LDA #$FF
STA XMITBYT3
JMP SENDMSG
;
SENDMSG LDA GRPHMODE
BNE DRAWGRPH
LDA XMITSTS
LDX XMITBYT1
LDY XMITBYT2
JSR MIDIPOKE
SENDEXIT LDA #GETINST
STA PHASE
RTS
;
PHSYSX RTS
;
DRAWGRPH CMP #$01
BNE DOUBLEHI
LDA XMITSTS
LDX XMITBYT1
LDY XMITBYT2
JSR MIDIGRPH
JMP SENDEXIT
DOUBLEHI LDA XMITSTS
LDX XMITBYT1
LDY XMITBYT2
JSR DBLGRPH
JMP SENDEXIT
;
;--------
;MIDIPOKE - DISPLAYS NOTE ON/OFFS USING 1ST 16 LINES OF SCREEN
;--------
; A = STATUS BYTE (9X OR 8X)
; X = 1ST DATA BYTE (NOTE NUMBER 00-7F)
; Y = 2ND DATA BYTE (VELOCITY 00-7F)
;--------
MIDIPOKE STA STSBYTE ;SAVE INPUT DATA
AND #$0F
STA MIDICHNL ;EXTRACT CHANNEL
STX NOTENUM
STY VELOCITY
TXA ;CHECK IF NOTE IS IN RANGE OF DISPLAY
CMP #24
BCC MIDIEXIT
CMP #102
BCS MIDIEXIT
SEC ;SUBTRACT 24 TO GET OFFSET IN CHARACTER TABLE
SBC #24
STA XCOORD
LDA STSBYTE
AND #$F0
CMP #$80
BEQ NOTEOFF ;CHECK IF NOTE OFF
CMP #$90
BEQ NOTEON
MIDIEXIT RTS
NOTEON LDA VELOCITY
BEQ NOTEOFF ;IF 90 WITH VEL 0 IT IS A NOTEOFF
LDX XCOORD ;NEED TO PRESERVE X UNTIL POKENOTE
LDA MASKDRUM
BMI NOTDRUM ;MASKDRUM FF=DISPLAY AS NORMAL NOTES
LDA MIDICHNL
CMP #$09 ;CHECK IF THIS IS A DRUM NOTE
BNE NOTDRUM
LDA MASKDRUM
BEQ NOTEOFF ;MASKDRUM 00=DON'T DISPLAY DRUM PART
LDA #'*'
STA DISPNOTE ;MASKDRUM 01=PRINT * FOR DRUM PART
CLV
BVC POKENOTE
NOTDRUM LDA DISPMODE ;CHECK IF UPPER CASE SHARP/LOWER CASE FLAT
BNE LCFMODE
LDA UCSNOTES,X
STA DISPNOTE
CLV
BVC POKENOTE
LCFMODE LDA LCFNOTES,X
STA DISPNOTE
POKENOTE LDY MIDICHNL ;VERTICAL COORD
LDA USEINVRS ;PARM-WHETHER USER WANTS INVERSE DISPLAY
BNE INVERT
LDA DISPNOTE
JMP POKE80
INVERT LDA DISPNOTE
AND #$7F ;INVERT ALL KEYS
JMP POKE80
NOTEOFF LDA #' '
STA DISPNOTE
LDX XCOORD
JMP POKENOTE
;
DISPNOTE DFB $00
STSBYTE DFB $00
MIDICHNL DFB $00
NOTENUM DFB $00
VELOCITY DFB $00
XCOORD DFB $00
;
; UPPER CASE SHARPS: cCdDefFgGaAb
;
UCSNOTES DFB $E3,$83,$E4,$84,$E5,$E6,$86,$E7,$87,$E1,$81,$E2
DFB $E3,$83,$E4,$84,$E5,$E6,$86,$E7,$87,$E1,$81,$E2
DFB $E3,$83,$E4,$84,$E5,$E6,$86,$E7,$87,$E1,$81,$E2
DFB $E3,$83,$E4,$84,$E5,$E6,$86,$E7,$87,$E1,$81,$E2
DFB $E3,$83,$E4,$84,$E5,$E6,$86,$E7,$87,$E1,$81,$E2
DFB $E3,$83,$E4,$84,$E5,$E6,$86,$E7,$87,$E1,$81,$E2
DFB $E3,$83,$E4,$84,$E5,$E6,$86,$E7,$87,$E1,$81,$E2
;
; LOWER CASE FLATS: CdDeEFgGaAbB
;
LCFNOTES DFB $83,$E4,$84,$E5,$85,$86,$E7,$87,$E1,$81,$E2,$82
DFB $83,$E4,$84,$E5,$85,$86,$E7,$87,$E1,$81,$E2,$82
DFB $83,$E4,$84,$E5,$85,$86,$E7,$87,$E1,$81,$E2,$82
DFB $83,$E4,$84,$E5,$85,$86,$E7,$87,$E1,$81,$E2,$82
DFB $83,$E4,$84,$E5,$85,$86,$E7,$87,$E1,$81,$E2,$82
DFB $83,$E4,$84,$E5,$85,$86,$E7,$87,$E1,$81,$E2,$82
DFB $83,$E4,$84,$E5,$85,$86,$E7,$87,$E1,$81,$E2,$82
;
CHN DANCNOTE.SC1