From aa9a0a900ddeaa79a05f1b93458a8b19ae170d69 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 20:00:14 +0100 Subject: No more mobile EQUS ret (replace with Stubbed_ + ret) --- macros/code.asm | 3 --- 1 file changed, 3 deletions(-) (limited to 'macros/code.asm') diff --git a/macros/code.asm b/macros/code.asm index 5ec214d50..423017b2d 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -35,9 +35,6 @@ jumptable: MACRO jp hl ENDM -; Many mobile functions were dummied out in localization. -mobile EQUS "ret" - maskbits: MACRO ; example usage in rejection sampling: ; .loop -- cgit v1.2.3 From cc95d1208d4a6b8291a5430a8d652a9337074788 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 11:57:28 -0500 Subject: Use maskbits more, and clarify its usage --- macros/code.asm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'macros/code.asm') diff --git a/macros/code.asm b/macros/code.asm index 5ec214d50..5a0b82a24 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -39,15 +39,17 @@ ENDM mobile EQUS "ret" maskbits: MACRO +; masks just enough bits to cover the argument +; e.g. "maskbits %00010100" becomes "and %00011111" ; example usage in rejection sampling: ; .loop ; call Random -; maskbits 30 +; maskbits 30 +- 1 ; cp 30 ; jr nc, .loop x = 1 rept 8 -if \1 > x +if x < (\1) x = (x + 1) * 2 +- 1 endc endr -- cgit v1.2.3 From 7b3de85a06e81d14ac0c73e8f9e1ab8e4a474beb Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 17:27:50 -0500 Subject: Avoid "+- 1" at every maskbits --- macros/code.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'macros/code.asm') diff --git a/macros/code.asm b/macros/code.asm index 6e9c378e3..799c27d45 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -37,17 +37,17 @@ ENDM maskbits: MACRO ; masks just enough bits to cover the argument -; e.g. "maskbits %00010100" becomes "and %00011111" +; e.g. "maskbits 26" becomes "and %00011111" (since 26 - 1 = %00011001) ; example usage in rejection sampling: ; .loop ; call Random -; maskbits 30 +- 1 +; maskbits 30 ; cp 30 ; jr nc, .loop x = 1 rept 8 -if x < (\1) -x = (x + 1) * 2 +- 1 +if x + 1 < (\1) +x = x << 1 | 1 endc endr and x -- cgit v1.2.3