home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Serious Magazine 7
/
Serious_Magazine_07_2000_Dial_pl_Side_B.atr
/
sstuff07.lzh
/
SORT.LZH
/
SORT.ASM
Wrap
Assembly Source File
|
1988-09-01
|
2KB
|
1 lines
æÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆà¢ⁿáצσ≥Θ∩⌡≤áלβτβ·Θ∈σáⁿ¢ⁿáááááááúÃáááááááááⁿ¢ⁿááááááááááááááááááⁿ¢ⁿááááע⌡Θπδ≤∩≥⌠áááááⁿ¢ⁿáπ∩Σσááי≥ãτσ≥»עלגáⁿ¢ⁿááááááááááááááááááⁿ¢ⁿפרמ´áñ¨ãããááááááááⁿ¢ÜÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆ⢢ opt 21 |do pamieci¢¢rand equ $d20a¢¢i0 equ $80¢i equ $81¢j equ $82¢j0 equ $83¢pp equ $84¢¢lsb equ $a000 Procedura sortuje¢msb equ $a100 liczby dwubajtowe!¢kolej equ $a200¢wynik equ $b000¢¢ org $9000¢¢ ldx #0¢rnd equ *¢ lda rand Losowanie¢ sta lsb,x elementow¢ lda rand tablicy¢ sta msb,x¢ txa¢ sta kolej,x¢ inx¢ bne rnd¢¢ jsr quicksort¢¢ ldx #0¢dupa equ *¢ ldy kolej,x W WYNIK i¢ lda lsb,y WYNIK+$100¢ sta wynik,x znajdziesz¢ lda msb,y posortowane¢ sta wynik+$100,x liczby.¢ inx¢ bne dupa¢¢ rts¢¢* -¢¢quicksort equ *¢ lda #$ff¢ pha¢ pha¢¢ lda #0 Rozmiar¢ pha tablicy¢ lda #70¢ pha¢¢pi0 equ *¢ pla¢ sta j¢ sta j0¢ pla¢ sta i0¢ clc¢ adc #1¢ sta i¢¢ lda i0¢ cmp j¢ bne pi1¢ cmp #$ff¢ bne pi1¢ rts¢¢pi1 equ *¢ sec¢ lda j0¢ sbc i0¢ cmp #2¢ bcc pi0¢¢ jmp partitional¢return equ *¢¢ lda i¢ cmp j0¢ bcs pi2¢¢ lda j¢ adc #1¢ pha¢ lda j0¢ pha¢¢ lda i0¢ clc¢ adc #1¢ sta i¢ lda j¢ sta j0¢ jmp pi1¢¢pi2 equ *¢ lda j¢ sbc #1¢ sta j¢ sta j0¢ clc¢ lda i0¢ adc #1¢ sta i¢ jmp pi1¢¢* -¢¢partitional equ *¢ ldx i0¢ ldy kolej,x¢ lda lsb,y¢ sta pti0+1¢ sta pti2+1¢ lda msb,y¢ sta pti1+1¢ sta pti3+1¢¢pt0_ equ *¢ ldx i¢pt0 equ *¢ ldy kolej,x¢ sec¢pti0 lda #0¢ sbc lsb,y¢pti1 lda #0¢ sbc msb,y¢ bcc pt1¢ inx¢ cpx j0¢ bcc pt0¢ beq pt0¢¢pt1 equ *¢ stx i¢¢ ldx j¢pt2 equ *¢ ldy kolej,x¢ sec¢ lda lsb,y¢pti2 sbc #0¢ sta pp¢ lda msb,y¢pti3 sbc #0¢ bcc pt3¢ beq pt3_¢pt_3 equ *¢ dex¢ jmp pt2¢¢pt3_ equ *¢ lda pp¢ bne pt_3¢¢pt3 equ *¢ stx j¢¢ ldy i¢ cpy j¢ bcs pt4¢¢ lda kolej,y¢ sta pp¢ lda kolej,x¢ sta kolej,y¢ lda pp¢ sta kolej,x¢ jmp pt0_¢¢pt4 equ *¢ ldy i0¢ lda kolej,y¢ sta pp¢ lda kolej,x¢ sta kolej,y¢ lda pp¢ sta kolej,x¢¢ jmp return¢¢ end of file¢¢