Created
October 10, 2024 15:27
-
-
Save petrosagg/0cb9fa23d892e4dddfea508030ca1324 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .include "m328PBdef.inc" | |
| ;define variables | |
| .def A=r24 | |
| .def AN=r18 | |
| .def F=r26 | |
| .def FN=r20 | |
| .def C=r28 | |
| .def CN=r21 | |
| .def D=r30 | |
| .def DN=r23 | |
| .def F0=r17 | |
| .def F1=r25 | |
| .def count=r15 | |
| .cseg ; memory code segment, correct place in flash memory | |
| .org 0 ; set the starting address for the subsequent code | |
| ; Initialize variables | |
| ldi A, 0x51 | |
| ldi F, 0x41 | |
| ldi C, 0x21 | |
| ldi D, 0x01 | |
| ldi count, 6 | |
| loop: | |
| ; creation of F0,F1 | |
| and A,FN ; A=A*BN | |
| and FN,D ; B=B?*D | |
| or A,F ; A=A+B | |
| mov F0,A | |
| com F0 ; F0 = (A*BN + B*D)' | |
| or A,CN ; A=A+CN | |
| or F,DN ; B=B+DN | |
| and A,F | |
| mov F1,A ; F1 = (A+CN)*(B+D?) | |
| ; Increment variables | |
| adiw A, 0x01 ; Increment A by 0x01 | |
| adiw F, 0x02 ; Increment B by 0x02 | |
| adiw C, 0x03 ; Increment C by 0x03 | |
| adiw D, 0x04 ; Increment D by 0x04 | |
| dec count | |
| brne loop | |
| sleep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment