Anyone a idea? Here is the code:
Code: Select all
;==========================================================
; Shuffle Routine
; ---------------
; Shuffles hl. Use 255 as end marker.
;==========================================================
lblShuffle:
ld hl,CardsPlayer
lblShuffleLoop:
;-- Copy current card position to de --
push hl
pop de
;------------------------------------------
;--Search random position to shuffle with--
ld b,5
call ionrandom
ld b,$00
ld c,a
add hl,bc
;------------------------------------------
;-- Shuffle values of both positions --
ld b,(hl)
ld a,(de)
ld c,a
ld a,b
ld (de),a
ld (hl),c
;------------------------------------------
;-- Go to next position --
push de
pop hl
inc hl
ld a,(hl)
cp 255
ret z
jr lblShuffleLoop