Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- quickSort MACRO arregloOrden, arraysize, direction
- LOCAL WHILE1, FINWHILE1, FN0, FN1
- PUSH SI
- PUSH DI
- PUSH AX
- PUSH BX
- PUSH CX
- PUSH DX
- MOV SI, SP
- MOV quickL, 0
- MOV AX, arraysize
- SUB AX, 1
- SAL AX, 1
- MOV quickH, AX
- PUSH quickL
- PUSH quickH
- WHILE1:
- CMP SP, SI
- JE FINWHILE1
- POP quickH
- POP quickL
- partition arregloOrden, quickL, quickH, inNumero, direction
- MOV BX, inNumero
- SUB BX, 2
- CMP BX, quickL
- JLE FN0
- PUSH quickL
- PUSH BX
- FN0:
- MOV BX, inNumero
- ADD BX, 2
- CMP BX, quickH
- JGE FN1
- PUSH BX
- PUSH quickH
- FN1:
- JMP WHILE1
- FINWHILE1:
- POP DX
- POP CX
- POP BX
- POP AX
- POP DI
- POP SI
- ENDM
- partition MACRO arregloOrden, varL, varH, pivote, direction
- LOCAL FOR1, FINFOR1, FIN1, DESC, REORG
- PUSH DI
- PUSH SI
- PUSH AX
- PUSH BX
- PUSH CX
- PUSH DX
- MOV DI, varH
- MOV DX, arregloOrden[DI]
- MOV SI, varL
- SUB SI, 2
- MOV BX, varL
- FOR1:
- MOV CX, varH
- SUB CX, 2
- CMP BX, CX
- JG FINFOR1
- CMP direction, 1
- JNE DESC
- MOV CX, arregloOrden[BX]
- CMP CX, DX
- JG FIN1
- JMP REORG
- DESC:
- MOV CX, arregloOrden[BX]
- CMP CX, DX
- JL FIN1
- REORG:
- ADD SI, 2
- MOV CX, arregloOrden[SI]
- MOV AX, arregloOrden[BX]
- MOV arregloOrden[SI], AX
- MOV arregloOrden[BX], CX
- MOV valoractual, CX
- call graficar
- FIN1:
- ADD BX, 2
- JMP FOR1
- FINFOR1:
- MOV CX, arregloOrden[SI + 2]
- MOV DI, varH
- MOV DX, arregloOrden[DI]
- MOV arregloOrden[SI + 2], DX
- MOV arregloOrden[DI], CX
- MOV valoractual, CX
- call graficar
- ADD SI, 2
- MOV pivote, SI
- POP DX
- POP CX
- POP BX
- POP AX
- POP SI
- POP DI
- ENDM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement