Atmelavr assembler (directives and some commands)

When I write in the above setup

.global main
    	.equ SPL, 0x3d		//stack pointer low
    	.equ SPH, 0x3e		//stack pointer high
    	.equ RAMEND, 0x08ff
    main:	
    	LDI	R16,hi8(RAMEND)           //line 152
    	OUT	SPH,R16
    	LDI	R16,lo8(RAMEND)
    	OUT	SPL,R16		//stack pointer

It assembles and disassembles to the exact same thing as in the post above.

RAM:   [          ]   0.0% (used 0 bytes from 2048 bytes)
Flash: [          ]   0.4% (used 140 bytes from 32768 bytes)
============= [SUCCESS] Took 1.50 seconds =============
>avr-objdump.exe -d .pio\build\ATmega328\firmware.elf
[...]
00000080 <main>:
  80:   08 e0           ldi     r16, 0x08       ; 8
  82:   0e bf           out     0x3e, r16       ; 62
  84:   0f ef           ldi     r16, 0xFF       ; 255
  86:   0d bf           out     0x3d, r16       ; 61

so, no problems there…

1 Like