Re: A86: ASM Programming Test


[Prev][Next][Index][Thread]

Re: A86: ASM Programming Test




> How about for the challenge write a call that divides the accumulator by 3?

//Min t-states: 65 (40) for a = 0,1,2
//Max t-states: 2024 (1999) for a = 255
//Destroys bc (a, b)
//b = a / 3
//c = a % 3 (a = a % 3)
//Value in parenthesis is without push/pop/ld c,a

DivA_3:
 push af
DA3Loop:
 inc b
 sub a,3
 jr p,DA3Loop
 add a,3
 ld c,a
 pop af
 ret

--
Dark Ryder
ICQ#:     8189903
E-Mail:   DarkRyder@cyberdude.com

Happiness is inversely proportional to how much you want to upgrade your
computer.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/CC/ED/IT/M/MU/P/S/O/AT (!)d-? s++(+):+(++) a?--- C++++$
UB>L+++ P L>+++ E- W+++$ !N o? K- w(---)$ !O M(+)(-) V?
PS+(+++) PE-- Y PGP++ t*+(+++) 5++ X+ R*+++ tv b+++ DI++++
D++ G++>++++ e*>+++++ h!>++ r-(+) y**++
------END GEEK CODE BLOCK------



References: