diff options
Diffstat (limited to 'macros.asm')
-rw-r--r-- | macros.asm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/macros.asm b/macros.asm index 6656ca038..4d67d5f5c 100644 --- a/macros.asm +++ b/macros.asm @@ -270,3 +270,22 @@ jumptable: MACRO ld l, a jp [hl] endm + +maskbits: macro +; returns to x +; usage in rejection sampling +; .loop +; call Random +; maskbits 30 +; and x +; cp 30 +; jr nc, .loop + +x = 1 +rept 8 +IF \1 > x +x = (x + 1) * 2 +- 1 +ENDC +endr +endm + |