Skip to content

Commit

Permalink
refactor-tri-example
Browse files Browse the repository at this point in the history
Signed-off-by: yzamir <[email protected]>
  • Loading branch information
yaacov committed Oct 6, 2023
1 parent 41baf8f commit 3f2b999
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions examples/recursive-triangular.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@ TEMP: DATA 0x00

; Recursive triangular
FUNC:
; Load argument to register A
; Load arg to register A
LOADA [BP + 1] ; [base pointer + 1] is the first function argument

; Load argument into TEMP
; Add the arg to register B using TEMP
STOREA TEMP

; Add the argument to register B
ADDB TEMP

; Check for termination condition, arg == 0
JZA RET

; Call recursively with (arg - 1)
; Call recursively with (arg - 1)
ADDA MINUSONE
PUSHA
CALL FUNC
Expand Down

0 comments on commit 3f2b999

Please sign in to comment.