home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio 4.94 - Over 11,000 Files
/
audio-11000.iso
/
amiga
/
midi
/
med210.lhw
/
in.adf
/
Source
/
med210src.lzh
/
med-newscr.a
< prev
next >
Wrap
Text File
|
1990-06-17
|
11KB
|
482 lines
; MED - musiikkieditori ⌐ 1989, 1990 by Teijo Kinnunen
; V2.00 nΣyt÷npΣivityksen assembler-rutiinit
xref _samplenum
xref _PaivitaSoittimennimi
xref _piirtorp
xref _wrp
xref _tmpA
xref _drawbm
xref _GfxBase
xref _cwid
xref _nykyinenosio
xref _screen
xref _pline
xref _pblock
xref _TulostaLohkoJaSoitin
xref _TulostaSoittoLohkot
xref _cursorx
xref _lohko
xref _topaz8 ;fontti
xref _plane0ptr ;bittikartta
xref _firstdisptrk
xref _specialupd
xref _SpecialUpdate
xref _currtrk
xref _currpos
xref _editline
xdef _SeurSoitin
xdef _EdSoitin
xdef _Korosta
xdef _Toggle
xdef _PaivitaNaytto
xdef _NaytaKursori
xdef @namet
code
_SeurSoitin:
move.b _samplenum,d0
cmp.b #62,d0
beq.s poisss
addq.b #1,_samplenum
paivss: jsr _PaivitaSoittimennimi(pc)
poisss: rts
_EdSoitin:
move.b _samplenum,d0
beq.s poisss
subq.b #1,_samplenum
bra.s paivss
_NaytaKursori:
movem.l d3-d4/a3/a6,-(sp)
clr.l d3
move.b _cursorx,d3 ;d3 = kx
clr.l d4
lea _cwid,a0
move.b 0(a0,d3.w),d4 ;d4 = klevx[kx]
lsl.w #3,d3 ;d3 = kx * 8
addq.w #4,d3 ;d3 = absx = kx * 8 + 4
add.w d3,d4 ;d4 = klevx[kx]+absx
movea.l _wrp,a1 ;a1 = wrp
movea.l a1,a3 ;a3 = wrp
move.b #4,24(a3) ;wrp->Mask = 4
movea.l _GfxBase,a6
moveq.l #2,d0
jsr -$162(a6) ; SetDrMd(wrp,COMPLEMENT);
move.l d3,d0
movea.l a3,a1
move.l #141,d1
jsr -$f0(a6) ; Move()
movea.l a3,a1
move.l d4,d0
move.l #141,d1
jsr -$f6(a6) ; Draw()
movea.l a3,a1
move.l d4,d0
move.l #131,d1
jsr -$f6(a6) ; Draw()
movea.l a3,a1
move.l d3,d0
move.l #131,d1
jsr -$f6(a6) ; Draw()
movea.l a3,a1
move.l d3,d0
move.l #140,d1 ; yksi pixeli ylemmΣs, koska COMPLEMENT
jsr -$f6(a6) ; Draw()
movea.l a3,a1
moveq.l #1,d0
jsr -$162(a6) ; SetDrMd(wrp,JAM2);
move.b #$ff,24(a3) ; wrp->Mask = 0xff
movem.l (sp)+,d3-d4/a3/a6
rts
_Toggle: ; a0 = ptr to gadget
moveq.l #0,d0
btst #4,$26(a0) ;test bit 12 of GadgetID (bit 4 of upper byte)
seq d0 ; if it's clear, we must highlight it
_Korosta: ; a0 = gadgptr, d0 = tila
movem.l d2-d4/a2/a6,-(sp)
movea.l a0,a2 ;Gadgptr talteen
move.w d0,d4 ;tila talteen
move.w $26(a2),d1 ;gg_GadgetID
andi.w #$0f00,d1
lsr.w #8,d1
cmp.w _nykyinenosio,d1
bne.s kloppu
clr.b d3
btst #4,$26(a2) ;already highlighted??
beq.s tstv2 ;no..
tst.w d0 ;is highlighted, should we highlight
bne.s kloppu ;it is already highlighted -> exit
bra.s rev ;remove highlighting!!
tstv2: tst.w d0 ;not highlighted, should we do it??
beq.s kloppu ;no, just exit
rev: movea.l _wrp,a1
move.b #3,24(a1) ;wrp->Mask = 3 (no red!!!!!)
movea.l _GfxBase,a6
moveq.l #2,d0
jsr -$162(a6) ;SetDrMd(wrp,COMPLEMENT)
move.w 4(a2),d0 ;LeftEdge
ext.l d0
move.w 6(a2),d1 ;TopEdge
ext.l d1
move.l d0,d2
move.l d1,d3
add.w 8(a2),d2 ;Width
subq.w #1,d2
add.w 10(a2),d3 ;Height
subq.w #1,d3
movea.l _wrp,a1
jsr -$132(a6) ;RectFill()
movea.l _wrp,a1
move.b #$ff,24(a1) ;normal mask again
moveq.l #1,d0
jsr -$162(a6) ;SetDrMd(wrp,JAM2)
kloppu:
tst.w d4
beq.s gfalse
bset #4,$26(a2) ;set bit in GadgetID
bra.s exitk
gfalse:
bclr #4,$26(a2)
exitk: movem.l (sp)+,d2-d4/a2/a6
rts
_PaivitaNaytto:
movem.l d2-d7/a2/a6,-(sp)
move.w _pline,d7
bpl.s nound0
clr.w d7
nound0: move.w _pblock,d4
movea.l _GfxBase,a6
move.w d7,d3
subq.w #7,d3 ;nykylin = srivi - 7
move.w d3,d5 ;mennytylospain = nykylin - entylin
sub.w entylin(pc),d5
move.w d3,entylin
cmp.w entsolo(pc),d4
bne.s pruus
cmp.w #1,d0 ;piirrauusi = TRUE
beq.s pruus
cmp.w #6,d5
bgt.s pruus
cmp.w #-6,d5
bge.s eipruus
pruus:
lea _lohko,a0
move.w d4,d0
lsl.w #2,d0
movea.l 0(a0,d0.w),a0
clr.w d0
move.b _firstdisptrk,d0
addq.b #4,d0
cmp.b (a0),d0 ;firstdisptrk+4 > lohko[xx].numtracks
ble.s no0fdt
clr.b _firstdisptrk
move.b _currpos,_currtrk
no0fdt: moveq.l #14,d6 ;for(rivilaskin=0...
prl1: move.l d6,d0
move.w d7,d1
move.w d4,d2
bsr _PaivitaRivi
dbf d6,prl1
jsr _TulostaLohkoJaSoitin(pc)
jsr _TulostaSoittoLohkot(pc)
bra endpfl
eipruus:
cmp.w #1234,d0
bne.s eipk0
move.b #1,updedit
eipk0: movem.l a2/d2-d7,-(sp)
lea _drawbm,a0
moveq.l #0,d0
movea.l a0,a1
moveq.l #0,d2
move.l #312,d4
move.l #$c0,d6
moveq.l #1,d7
lea _tmpA,a2
tst.w d5 ;if(mennytylospain > 0)...
ble.s oktst2
clr.l d1
move.w d5,d1
lsl.w #3,d1
moveq.l #0,d3
moveq.l #120,d5 ;siirretΣΣn 120 - 8 * mennytyl÷spΣin pix.
sub.w d1,d5
jsr -$1e(a6) ;BltBitMap()
bra.s rf2
oktst2: tst.w d5 ;if(mennytylospain < 0)...
bge.s rf2
moveq.l #0,d1
neg.w d5
lsl.w #3,d5
move.w d5,d3
ext.l d3
moveq.l #120,d5 ;siirretΣΣn 120 - 8 * (-mennytyl÷spΣin) pix
sub.w d3,d5
jsr -$1e(a6)
rf2: movem.l (sp)+,a2/d2-d7
tst.b updedit
beq.s eipk
clr.b updedit
move.w d4,d2
move.w d7,d1
move.w _editline,d0
sub.w d7,d0
addq.w #7,d0
bmi.s eipk
cmp.b #14,d0
bgt.s eipk
bsr.s _PaivitaRivi
eipk: tst.w d5
ble.s alle0 ;if(mennytylospain > 0):
move.w d5,d6
subq.w #1,d6
move.w d4,d2
loop2: moveq.l #14,d0
sub.w d6,d0
move.w d7,d1
bsr.s _PaivitaRivi
dbf d6,loop2
bra.s endpfl
alle0: tst.w d5
bge.s endpfl
clr.l d0
move.w d5,d6
not.w d6 ;sama kuin neg.w d6, subq.w #1,d6
move.w d4,d2
loop3: move.w d6,d0
move.w d7,d1
bsr.s _PaivitaRivi
dbf d6,loop3
endpfl: move.w d4,entsolo
lea _drawbm,a0
clr.l d0
clr.l d1
movea.l _screen,a1
lea $b8(a1),a1
moveq.l #4,d2
moveq.l #77,d3
move.l #312,d4
moveq.l #120,d5
move.l #$c0,d6
moveq.l #1,d7
movea.l #0,a2
jsr -$1e(a6) ;BltBitMap()
tst.b _specialupd
beq.s noupd
jsr _SpecialUpdate(pc)
noupd: movem.l (sp)+,d2-d7/a2/a6
rts
entylin: dc.w 0
entsolo: dc.w 0
updedit: dc.w 0
;YllΣoleva _PaivitaNaytto() viimein korjatuksi 23.10.1989
; samana pΣivΣnΣ aloitin allaolevan _PaivitaRivi():n tekemisen
; seuraavana pΣivΣnΣ (24.10.1989) sain C-kΣΣntΣjΣstΣ version 5.04!!!!!
; korjailin my÷s hiukan tΣtΣ rutiinia.
; TΣhΣn kuntoon rutiini on saatu 5.11.1989 jKr...ei vaan 31.1.1990
; Fasttext... 13.11.1989 jKr, nopeutettu hiukan 7.3.1990
_PaivitaRivi: ;d0 = rivin numero (0-14), d1 = soit. rivi ja d2 = lohko
movem.l d2-d7/a2-a3,-(sp)
moveq.l #0,d7
move.w d0,d7
subq.w #7,d7
add.w d1,d7 ;relsr(d7) = srivi + (num - 7)
tst.w d7
blt.s blnk
lea _lohko,a2 ;a2 = 1. lohkon osoite
lsl.w #2,d2
movea.l 0(a2,d2.w),a2 ;lohkon osoite taulukosta
clr.w d5
move.b 1(a2),d5
cmp.w d5,d7
bls.s noblnk
blnk: move.w d0,d6
jsr -$e4(a6) ;WaitBlit() tehdΣΣn vasta nyt
movea.l _plane0ptr,a0
mulu.w #320,d6 ;alkuosoite
adda.l d6,a0
moveq.l #79,d0 ;80 pitkΣΣ sanaa = 320 tavua
clrlp: clr.l (a0)+
dbf d0,clrlp
movem.l (sp)+,d2-d7/a2-a3 ;ja pois....
rts
noblnk: move.l d7,d5
moveq #'0',d2
lea txt40(pc),a3 ;get ptr to printed text
divu #100,d5
add.b d2,d5 ;add '0'
move.b d5,(a3)+
swap d5
ext.l d5
divu #10,d5
add.b d2,d5 ;add '0'
move.b d5,(a3)+ ;kokoa numero
swap d5
add.b d2,d5 ;add '0'
move.b d5,(a3)+
move.b d7,d6
lea 4(a2),a1
moveq #32,d4
bra.s tsthi
lowmp: sub.b d4,d6
addq.l #4,a1
tsthi: cmp.b #31,d6
bhi.s lowmp
move.l (a1),d4
clr.b d2
btst d6,d4
sne d2
clr.w d4
move.b (a2),d4 ;otetaan raitojen mΣΣrΣ
lea 36(a2),a2 ;ohitetaan roskat....a2 = nyk. lohkon nuotit
mulu #3,d4 ;yhden rivin pituus
mulu d4,d7 ;kerrottuna nykyisellΣ rivinumerolla
adda.l d7,a2 ;a2 = nyk. rivin alkuosoite
clr.w d4
move.b _firstdisptrk,d4
mulu #3,d4
adda.l d4,a2 ;vihdoin a2 = nyk. nuotin alkuosoite
clr.b d6 ;raitacnt
addq.l #1,a3 ;advance text ptr
rloop: clr.b d1 ;ei ylempi soitin (vielΣ)
move.b (a2)+,d4 ;d4 = numero
move.b (a2)+,d3 ;d3 = extra (1. tavu)
lsl.w #8,d3
move.b (a2)+,d3 ;(2. tavu)
bclr #6,d4
beq.s ey1
move.b #'1',3(a3)
bra.s yy2
ey1: move.b #' ',3(a3)
yy2: bclr #7,d4
beq.s eiyls ;ei soitin G-V
moveq #16,d1 ;ylempi soitin
eiyls: tst.b d4 ;jos nuottia ei jΣΣkΣΣn jΣljelle
beq.s noper
clr.w d5
move.b d4,d5
subq.b #1,d5
lsl.b #2,d5
lea namet(pc),a1 ;nimen osoite
adda.w d5,a1
move.b (a1),(a3)
move.b 1(a1),1(a3)
move.b 2(a1),2(a3) ;kopsataan nimi
bra.s dspxtr
noper: move.b #'-',(a3) ;ei nimeΣ
move.b #'-',1(a3)
move.b #'-',2(a3) ;3 viivaa
dspxtr: lea hexat(pc),a1
move.w d3,d5 ;d5:een kΣsiteltΣvΣksi
lsr.w #8,d5
lsr.w #4,d5
add.b d1,d5
move.b 0(a1,d5.w),4(a3) ;1. luku - lisΣtΣΣn koska ylsoitin on jo.
move.w d3,d5
lsr.w #8,d5
andi.w #$000f,d5
move.b 0(a1,d5.w),5(a3) ;2. luku
move.w d3,d5
lsr.w #4,d5
andi.w #$000f,d5
move.b 0(a1,d5.w),6(a3) ;3. luku
andi.w #$000f,d3 ;extraa ei enΣΣ tartte
move.b 0(a1,d3.w),7(a3)
adda.w #9,a3
addq.b #1,d6
cmp.b #4,d6 ;joka raita!!!
blt rloop
lea txt40(pc),a2 ;a2 = tekstin alku
move.w d0,d6 ;rivin numero dkuuteen
jsr -$e4(a6) ;WaitBlit() tehdΣΣn vasta nyt
dsptxt: ;****************************************************************
;**** TΣstΣ alkaa huippunopea tekstintulostus (13.11.1989) ****
;****************************************************************
mulu #320,d6 ;alkuosoite
movea.l _plane0ptr,a0 ;bitmapin alku
adda.w d6,a0
movea.l _topaz8,a1
move.w 38(a1),d7 ;Modulo -> d7
move.b 32(a1),d0 ;tf_LoChar -> d0
movea.l 34(a1),a1 ;tf_CharData
moveq.l #38,d1
tst.b d2
bne.s txtr2 ;highlight, use different routine
clr.w d2 ;for speed!!!
charloop: move.b (a2)+,d2
sub.b d0,d2 ;tf_LoChar pois
movea.l a1,a3
moveq.l #7,d5
adda.w d2,a3
move.b (a3),(a0)
adda.w d7,a3 ;tf_Modulo lisΣtΣΣn
move.b (a3),40(a0)
adda.w d7,a3
move.b (a3),80(a0)
adda.w d7,a3
move.b (a3),120(a0)
adda.w d7,a3
move.b (a3),160(a0)
adda.w d7,a3
move.b (a3),200(a0)
adda.w d7,a3
move.b (a3),240(a0)
adda.w d7,a3
move.b (a3),280(a0)
addq.l #1,a0
dbf d1,charloop
;**** Ja tΣhΣn loppuu....eik÷ ollutkin lyhyt!!! ****************
expr: movem.l (sp)+,d2-d7/a2-a3
rts ; huh huh !!!
txtr2: clr.w d2 ;display highlighted
charloop2: move.b (a2)+,d2
sub.b d0,d2 ;tf_LoChar pois
movea.l a1,a3
moveq.l #7,d5
adda.w d2,a3
move.b (a3),d6
not.b d6
move.b d6,(a0)
adda.w d7,a3 ;tf_Modulo lisΣtΣΣn
move.b (a3),d6
not.b d6
move.b d6,40(a0)
adda.w d7,a3
move.b (a3),d6
not.b d6
move.b d6,80(a0)
adda.w d7,a3
move.b (a3),d6
not.b d6
move.b d6,120(a0)
adda.w d7,a3
move.b (a3),d6
not.b d6
move.b d6,160(a0)
adda.w d7,a3
move.b (a3),d6
not.b d6
move.b d6,200(a0)
adda.w d7,a3
move.b (a3),d6
not.b d6
move.b d6,240(a0)
adda.w d7,a3
move.b (a3),d6
not.b d6
move.b d6,280(a0)
addq.l #1,a0
dbf d1,charloop2
bra.s expr
txt40: dc.b ' '
spc40: dc.b ' '
hexat: dc.b '0123456789ABCDEFGHIJKLMNOPQRSTUV'
namet:
@namet: dc.b 'C-1 C#1 D-1 D#1 E-1 F-1 F#1 G-1 G#1 A-1 A#1 H-1 '
dc.b 'C-2 C#2 D-2 D#2 E-2 F-2 F#2 G-2 G#2 A-2 A#2 H-2 '
dc.b 'C-3 C#3 D-3 D#3 E-3 F-3 F#3 G-3 G#3 A-3 A#3 H-3 '
dc.b 'C-4 C#4 D-4 D#4 E-4 F-4 F#4 G-4 G#4 A-4 A#4 H-4 '
dc.b 'C-5 C#5 D-5 D#5 E-5 F-5 F#5 G-5 G#5 A-5 A#5 H-5 '
dc.b 'C-6 C#6 D-6 '
end