Advertisement
Guest User

Untitled

a guest
Apr 8th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. quickSort MACRO arregloOrden, arraysize, direction
  2. LOCAL WHILE1, FINWHILE1, FN0, FN1
  3.         PUSH SI
  4.         PUSH DI
  5.         PUSH AX
  6.         PUSH BX
  7.         PUSH CX
  8.         PUSH DX
  9.         MOV SI, SP
  10.         MOV quickL, 0
  11.         MOV AX, arraysize
  12.         SUB AX, 1
  13.         SAL AX, 1
  14.         MOV quickH, AX
  15.         PUSH quickL
  16.         PUSH quickH
  17.         WHILE1:
  18.             CMP SP, SI
  19.             JE FINWHILE1
  20.             POP quickH
  21.             POP quickL
  22.             partition arregloOrden, quickL, quickH, inNumero, direction
  23.             MOV BX, inNumero
  24.             SUB BX, 2
  25.             CMP BX, quickL
  26.             JLE FN0
  27.             PUSH quickL
  28.             PUSH BX
  29.             FN0:
  30.             MOV BX, inNumero
  31.             ADD BX, 2
  32.             CMP BX, quickH
  33.             JGE FN1
  34.             PUSH BX
  35.             PUSH quickH
  36.             FN1:
  37.             JMP WHILE1
  38.         FINWHILE1:
  39.         POP DX
  40.         POP CX
  41.         POP BX
  42.         POP AX
  43.         POP DI
  44.         POP SI
  45. ENDM
  46.  
  47. partition MACRO arregloOrden, varL, varH, pivote, direction
  48. LOCAL FOR1, FINFOR1, FIN1, DESC, REORG
  49.         PUSH DI
  50.         PUSH SI
  51.         PUSH AX
  52.         PUSH BX
  53.         PUSH CX
  54.         PUSH DX
  55.  
  56.         MOV DI, varH
  57.         MOV DX, arregloOrden[DI]
  58.         MOV SI, varL
  59.         SUB SI, 2
  60.         MOV BX, varL
  61.         FOR1:
  62.             MOV CX, varH
  63.             SUB CX, 2
  64.             CMP BX, CX
  65.             JG FINFOR1
  66.             CMP direction, 1
  67.             JNE DESC
  68.             MOV CX, arregloOrden[BX]
  69.             CMP CX, DX
  70.             JG FIN1
  71.             JMP REORG
  72.             DESC:
  73.             MOV CX, arregloOrden[BX]
  74.             CMP CX, DX
  75.             JL FIN1
  76.             REORG:
  77.             ADD SI, 2
  78.             MOV CX, arregloOrden[SI]
  79.             MOV AX, arregloOrden[BX]
  80.             MOV arregloOrden[SI], AX
  81.             MOV arregloOrden[BX], CX
  82.             MOV valoractual, CX
  83.             call graficar
  84.             FIN1:
  85.             ADD BX, 2
  86.             JMP FOR1
  87.         FINFOR1:
  88.         MOV CX, arregloOrden[SI + 2]
  89.         MOV DI, varH
  90.         MOV DX, arregloOrden[DI]
  91.         MOV arregloOrden[SI + 2], DX
  92.         MOV arregloOrden[DI], CX
  93.         MOV valoractual, CX
  94.         call graficar
  95.         ADD SI, 2
  96.         MOV pivote, SI
  97.         POP DX
  98.         POP CX
  99.         POP BX
  100.         POP AX
  101.         POP SI
  102.         POP DI
  103. ENDM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement