git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit b66676b6b758177581139b151bce34952c7ca74a
parent 39e22ef511057c825e046fe31d6e6075a8269802
Author: Toxa <56631470+untoxa@users.noreply.github.com>
Date:   Wed,  2 Nov 2022 13:27:58 +0400

Merge pull request #438 from michel-iwaniec/nes_fast_div_and_mod

NES: Add FAST_DIV8 / FAST_MOD8 macros
Diffstat:
Mgbdk-lib/libc/targets/mos6502/nes/global.s23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/gbdk-lib/libc/targets/mos6502/nes/global.s b/gbdk-lib/libc/targets/mos6502/nes/global.s @@ -119,3 +119,26 @@ ;; Main user routine .globl _main +.macro DIV_PART divident divisor ?lbl + rol divident + rol + sec + sbc divisor + bcs lbl + adc divisor +lbl: +.endm +.macro FAST_DIV8 divident divisor + ; returns quotient in A + .rept 8 + DIV_PART divident divisor + .endm + lda divident + eor #0xFF +.endm +.macro FAST_MOD8 divident divisor + ; returns modulus in A + .rept 8 + DIV_PART divident divisor + .endm +.endm

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.