Last active
March 9, 2018 05:16
-
-
Save owskio/886430dee6017d899322813987e474dd to your computer and use it in GitHub Desktop.
Still trying to formulate some opinions about these, routines seem to be good for saving memory (haha) and keeping the listing file readable, while macros seem to be good for abstracting expressions that leverage assembler features like 'high()','low()', or 'x*2'
This file contains 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
; | |
; Output file in intel hex format with -fI | |
; | |
; wine avrasm2.exe -fI -l test.lst test.asm and; avrdude -c usbtiny -p atmega1284 -U flash:w:test.hex | |
; | |
.nolist | |
.include "./m1284def.asm" | |
.list | |
;.macro outi | |
; push r30 | |
; ldi r30,@1 | |
; out @0,r30 | |
; pop r30 | |
;.endm | |
#define outi(destination,value) \ | |
push r30 \ | |
ldi r30,(value) \ | |
out (destination),r30 \ | |
pop r30 | |
.cseg ;Code (flash) segment ;This is added by default if not written down | |
outi(DDRA,0xff) ; Data direction register | |
outi(PortA,0x56) ; set leds at port | |
outi(DDRB,0xff) ; Data direction register | |
outi(PortB,0x56) ; set leds at port | |
Main: | |
rjmp Main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment