home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er Special 31
/
64er_Magazin_Sonderheft_31_19xx_Markt__Technik_de.d64
/
midi.src
< prev
next >
Wrap
Text File
|
2022-10-26
|
4KB
|
243 lines
;labeltabelle
chrout = $ffd2
reset = $fce2
chckom = $aefd
getbyte = $b79e
irqende = $ea81
auspuff = $cf00
einpuff = $ce00
;---------------------------------------
ctrlreg = $de04
outreg = $de05
statreg = $de06
inreg = $de07
* = $cb00
;=======================================
init lda #3 ; master reset
sta ctrlreg
lda #%10010110
sta ctrlreg ;teilerverh.1:64
;8 Datenbit
;1 Stopbit
;keine parity
;Sende-IRQ gesperrt
;Empfangs-IRQ frei
jmp start
vek .byte 0,0
einptr1 .byte 0
einptr2 .byte 0
ausptr1 .byte 0
ausptr2 .byte 0
;---------------------------------------
;basic einspruenge
byteput jsr chckom ;zu midi
jsr getbyte
txa
jmp obbein
;------
byteget php ;von midi
sei
jsr ibbaus
plp
rts
;=======================================
;midi byte out
byteout pha ; byte retten
lda statreg
and #2
beq byteout+1
pla
sta outreg
rts
;---------------------------------------
;midi byte in
ibbein lda statreg
lsr a
bcc keinsda
lda inreg
sei
ldy einptr2
sta einpuff,y
iny
sty einptr2
keinsda rts
;---------------------------------------
;byte aus einpuff in akku holen
ibbaus php
sei
ldy einptr1
cpy einptr2
bne ok
ldy #1
jmp nixda
ok lda einpuff,y
iny
sty einptr1
ldy #0
nixda plp
rts
;---------------------------------------
;byte aus akku in auspuff stecken
obbein php
sei
ldy ausptr2
sta auspuff,y
iny
sty ausptr2
jsr ggfaus ; Versuchen,
unmittelbar
auszugeben
plp
rts
;---------------------------------------
;byte aus auspuff uebertragen
obbaus php
sei
ldy ausptr1
lda auspuff,y
iny
sty ausptr1
jsr byteout
plp
rts
;---------------------------------------
;Senderegister frei ? Dann
;pruefen ob Byte im Ausgabe-
;puffer, ggf. ausgeben
ggfaus php
sei
lda statreg
and #2
beq ausgang
lda ausptr1
cmp ausptr2
beq ausgang
jsr obbaus
ausgang plp
rts
;---------------------------------------
; string out
strout pla
sta $f7
pla
sta $f8
hoch ldy #$00
inc $f7
bne nocarry
inc $f8
nocarry lda ($f7),y
beq exit
jsr chrout
jmp hoch
exit lda $f8
pha
lda $f7
pha
rts
;=======================================
irq lda statreg ;midi irq?
bmi midirq ;ja =>
jmp (vek) ;alte irq
midirq jsr ibbein ;byte von midi
jsr ggfaus ;byte zu midi
jmp irqende ;ROM-Routine
hflag .byte 0
start sei
ldx hflag
bne initret
inx
stx hflag
lda $314
sta vek
lda $315
sta vek+1
lda #<irq
sta $314
lda #>irq
sta $315
initret lda ausptr1
sta ausptr2
lda einptr1
sta einptr2
cli
rts
;===================================
.end