home *** CD-ROM | disk | FTP | other *** search
-
- ;---------------
- ;-- Sortering --
- ;---------------
- org $20000
- load $20000
-
- AntVarden: = 40
-
- S: lea.l $dff000,a6
- move.w $1c(a6),d0
- bset #15,d0
- move.w d0,OldIrq
- move.w $2(a6),d0
- bset #15,d0
- move.w d0,OldDma
- move.w #$7fff,$96(a6)
- move.w #$87c0,$96(a6)
- move.w #$4000,$9a(a6)
- bsr Slumpa
- bsr MainLoop
- move.w OldIrq(pc),$9a(a6)
- move.w OldDma(pc),$96(a6)
- moveq #0,d0
- rts
-
- OldIrq: dc.w 0
- OldDma: dc.w 0
-
- Slumpa: lea.l Posses(pc),a0
- move.w #8392,d1
- move.w #14,d2
- move.w #2,d3
- move.w #AntVarden-1,d7
- SlumpLoop: move.w $6(a6),d0
- ext d0
- muls d1,d0
- ; muls d2,d1
- add.w d3,d1
- and.w #$ff,d0
- move.w d0,(a0)+
- dbra d7,SlumpLoop
- rts
-
- MainLoop: cmp.b #$50,$6(a6)
- bne.S MainLoop
- move.w #$f00,$180(a6)
- bsr Sortera
- move.w #$a,$180(a6)
- btst #6,$bfe001
- bne.S MainLoop
- rts
-
- Sortera: lea.l Posses(pc),a0
- lea.l Posses2(pc),a1
- move.w #AntVarden-1,d7
- SL: move.w (a0)+,(a1)+
- dbra d7,SL
-
- bsr BlitWait
- move.l #-1,$44(a6)
- move.l #$09f00002,$40(a6)
- clr.l $64(a6)
-
- lea.l Posses2(pc),a0
- lea.l Sorterade(pc),a1
- moveq #0,d6
- moveq #0,d2
- move.w #AntVarden-1,d7
- SortLoop: move.w (a0)+,d0
- move.w d6,d5
- lsr.w #1,d5
- move.l a1,a2
- cmp.w d0,d2
- bhi.S NoLow
- move.w d0,(a1,d6.W)
- addq.w #2,d6
- move.w d0,d2
- bra.S Next
- NoLow: cmp.w (a2)+,d0
- bls.S NoLika
- dbra d5,NoLow
- NoLika: move.l a2,a4
- addq.w #1,d5
- add.w d5,a2
- add.w d5,a2
- move.l a2,a3
- subq.l #2,a2
- subq.w #1,d5
- lsl.w #6,d5
- addq.w #1,d5
- bsr BlitWait
- move.l a2,$50(a6)
- move.l a3,$54(a6)
- move.w d5,$58(a6)
- move.w d0,(a4)
- addq.w #2,d6
- Next: dbra d7,SortLoop
- rts
-
- BlitWait: btst #14,$2(a6)
- bne.S BlitWait
- rts
-
- Posses: blk.w 100,0
- Posses2: blk.w 100,0
- Sorterade: blk.w 100,0
-
-