Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _quicksort:
- .FUNC_15:
- push ix
- ld ix, 0
- add ix, sp
- ld hl, -10
- add hl, sp
- ld sp, hl
- ld l, (ix + 8) ; load value from parameter r
- ld h, (ix + 9)
- ld e, (ix + 6) ; load value from parameter l
- ld d, (ix + 7)
- or a
- sbc hl, de
- inc hl
- ld (ix-2), l ; store value to local count(uint16)
- ld (ix-1), h
- ; IfAst @8,5
- .IF_16:
- ; condition
- ld l, (ix-2) ; load value from local count
- ld h, (ix-1)
- ld de, 2
- or a
- sbc hl, de
- ld a, 0
- rla
- or a
- jp z, .ENDIF_16
- ; ReturnAst @9,9
- jp .ENDFUNC_15
- .ENDIF_16:
- ; CastAst @12,19 uint16(int16)
- ; CastAst @12,18 uint16(int16[])
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- inc hl
- inc hl
- push hl
- ld l, (ix + 6) ; load value from parameter l
- ld h, (ix + 7)
- push hl
- ld l, (ix-2) ; load value from local count
- ld h, (ix-1)
- ld de, 2
- call lib.udiv16
- ex de, hl
- pop hl
- add hl, de
- add hl, hl
- ex de, hl
- pop hl
- add hl, de
- ld e, (hl) ; Dereference int16
- inc hl
- ld d, (hl)
- ex de, hl ; Get value into HL
- ld (ix-4), l ; store value to local pivot(uint16)
- ld (ix-3), h
- ld l, (ix + 6) ; load value from parameter l
- ld h, (ix + 7)
- ld (ix-6), l ; store value to local i(uint16)
- ld (ix-5), h
- ld l, (ix + 8) ; load value from parameter r
- ld h, (ix + 9)
- ld (ix-8), l ; store value to local j(uint16)
- ld (ix-7), h
- ; WhileAst @15,5
- .LOOP_17:
- ; Loop body start
- ; WhileAst @16,9
- .LOOP_18:
- ; condition
- ; CastAst @16,16 uint16(int16)
- ; CastAst @16,15 uint16(int16[])
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- inc hl
- inc hl
- push hl
- ld l, (ix-6) ; load value from local i
- ld h, (ix-5)
- add hl, hl
- ex de, hl
- pop hl
- add hl, de
- ld e, (hl) ; Dereference int16
- inc hl
- ld d, (hl)
- ex de, hl ; Get value into HL
- ld e, (ix-4) ; load value from local pivot
- ld d, (ix-3)
- or a
- sbc hl, de
- ld a, 0
- rla
- or a
- jp z, .ENDLOOP_18
- ; Loop body start
- ld l, (ix-6) ; load value from local i
- ld h, (ix-5)
- inc hl
- ld (ix-6), l ; store value to local i(uint16)
- ld (ix-5), h
- ; Loop body end
- jp .LOOP_18
- .ENDLOOP_18:
- ; WhileAst @19,9
- .LOOP_19:
- ; condition
- ld l, (ix-4) ; load value from local pivot
- ld h, (ix-3)
- push hl
- ; CastAst @19,16 uint16(int16)
- ; CastAst @19,15 uint16(int16[])
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- inc hl
- inc hl
- push hl
- ld l, (ix-8) ; load value from local j
- ld h, (ix-7)
- add hl, hl
- ex de, hl
- pop hl
- add hl, de
- ld e, (hl) ; Dereference int16
- inc hl
- ld d, (hl)
- ex de, hl ; Get value into HL
- ex de, hl
- pop hl
- or a
- sbc hl, de
- ld a, 0
- rla
- or a
- jp z, .ENDLOOP_19
- ; Loop body start
- ld l, (ix-8) ; load value from local j
- ld h, (ix-7)
- dec hl
- ld (ix-8), l ; store value to local j(uint16)
- ld (ix-7), h
- ; Loop body end
- jp .LOOP_19
- .ENDLOOP_19:
- ; IfAst @22,9
- .IF_20:
- ; condition
- ld l, (ix-8) ; load value from local j
- ld h, (ix-7)
- ld e, (ix-6) ; load value from local i
- ld d, (ix-5)
- xor a
- ex de, hl
- sbc hl, de
- rla
- xor a, 1
- or a
- jp z, .ENDIF_20
- ; BreakAst @23,13
- jp .ENDLOOP_17
- .ENDIF_20:
- ; CastAst @26,20 uint16(int16[])
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- inc hl
- inc hl
- push hl
- ld l, (ix-6) ; load value from local i
- ld h, (ix-5)
- add hl, hl
- ex de, hl
- pop hl
- add hl, de
- ld e, (hl) ; Dereference int16
- inc hl
- ld d, (hl)
- ex de, hl ; Get value into HL
- ld (ix-10), l ; store value to local temp(int16)
- ld (ix-9), h
- ; Get value to assign
- ; CastAst @27,16 uint16(int16[])
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- inc hl
- inc hl
- push hl
- ld l, (ix-8) ; load value from local j
- ld h, (ix-7)
- add hl, hl
- ex de, hl
- pop hl
- add hl, de
- ld e, (hl) ; Dereference int16
- inc hl
- ld d, (hl)
- ex de, hl ; Get value into HL
- push hl ; save value int16
- ; CastAst @27,9 uint16(int16[])
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- inc hl
- inc hl
- push hl
- ld l, (ix-6) ; load value from local i
- ld h, (ix-5)
- add hl, hl
- ex de, hl
- pop hl
- add hl, de
- pop de ; pop value int16
- ld (hl), e
- inc hl
- ld (hl), d
- ; Get value to assign
- ld l, (ix-10) ; load value from local temp
- ld h, (ix-9)
- push hl ; save value int16
- ; CastAst @28,9 uint16(int16[])
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- inc hl
- inc hl
- push hl
- ld l, (ix-8) ; load value from local j
- ld h, (ix-7)
- add hl, hl
- ex de, hl
- pop hl
- add hl, de
- pop de ; pop value int16
- ld (hl), e
- inc hl
- ld (hl), d
- ld l, (ix-6) ; load value from local i
- ld h, (ix-5)
- inc hl
- ld (ix-6), l ; store value to local i(uint16)
- ld (ix-5), h
- ld l, (ix-8) ; load value from local j
- ld h, (ix-7)
- dec hl
- ld (ix-8), l ; store value to local j(uint16)
- ld (ix-7), h
- ; Loop body end
- jp .LOOP_17
- .ENDLOOP_17:
- ; FuncCallAst @34,5 : quicksort
- ld l, (ix-6) ; load value from local i
- ld h, (ix-5)
- dec hl
- push hl
- ld l, (ix + 6) ; load value from parameter l
- ld h, (ix + 7)
- push hl
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- push hl
- call _quicksort
- ld hl, 6
- add hl, sp
- ld sp, hl
- ; FuncCallAst @35,5 : quicksort
- ld l, (ix + 8) ; load value from parameter r
- ld h, (ix + 9)
- push hl
- ld l, (ix-6) ; load value from local i
- ld h, (ix-5)
- push hl
- ld l, (ix + 4) ; load value from parameter a
- ld h, (ix + 5)
- push hl
- call _quicksort
- ld hl, 6
- add hl, sp
- ld sp, hl
- .ENDFUNC_15:
- ld sp, ix
- pop ix
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement