home *** CD-ROM | disk | FTP | other *** search
-
- ;---------------
- ;-- Sortering --
- ;---------------
-
-
- AntVarden: = 40
-
- S: lea.l $dff000,a6
- move.w $1c(a6),d0
- bset #15,d0
- move.w d0,OldIrq
- move.w #$4000,$9a(a6)
- bsr Slumpa
- bsr MainLoop
- move.w OldIrq(pc),$9a(a6)
- rts
-
- OldIrq: 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
- muls d2,d1
- add.w d3,d2
- 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
-
- lea.l Posses2(pc),a0
- lea.l Sorterade(pc),a1
- move.l a0,a2
- moveq #0,d0
- move.w #AntVarden-1,d7
- move.w d7,d5
- SortLoop: move.w d5,d6
- SortLoop2: cmp.w (a0),d0
- bhi.S NoC
- move.w (a0),d0
- move.l a0,a3
- NoC: addq.l #2,a0
- dbra d6,SortLoop2
- move.w d0,(a1)+
- move.l a2,a0
- clr.w (a3)
- move.l a2,a3
- moveq #0,d0
- dbra d7,SortLoop
- rts
-
- Posses: blk.w AntVarden,0
- Posses2: blk.w AntVarden,0
- Sorterade: blk.w AntVarden,0
-
-