Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MultiplyNumbers macro #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions gbasmdev.tex
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,11 @@ \section{Loops}
push bc ; lets us use B register
; without messing up existing data,
; as it is restored before we return
ld c, a

ld b, 11 ; the number of times we loop
ld b, 10 ; the number of times we loop
.loop:
add a ; add A onto itself
add c ; add the original value (in C) onto A
dec b ; decrease loop counter
jr nz, .loop ; if didn't reach zero, go back
; If we got here, the loop is finished
Expand Down Expand Up @@ -507,10 +508,10 @@ \section{Compile time operations}

\begin{code}
MultiplyNumbers: MACRO
ld a, \1
ld b, \2
ld bc, (\2) << 8 | (\1)
xor a
.loop\@:
add a
add c
dec b
jr nz, .loop\@
\end{code}
Expand Down