So after I gathered enough information and examples for using SDAS, I gave it a shot.
The code should light the LEDs one after the other, then turn them off at the same order. The result came out something like this:
.module blink .area INTV (ABS) .org 0x0000 _int_reset: ljmp main .area CSEG (ABS, CODE) .org 0x0090 main: cpl P3.2 acall delay cpl P3.3 acall delay cpl P3.4 acall delay cpl P3.5 acall delay nop nop nop nop sjmp main delay: mov r4, #0x00 mov r3, #0x00 wait: djnz r4, wait djnz r3, wait ret
In the spirit of the usynth example, the areas are called INTV for interrupt vector and CSEG for the code segment. The code begins in address 0x90 as the interrupt vector address of INT4#, the farthest interrupt here, is 0x83.
I called the assembler in the command line:
While my code had errors, it shouted errors at me. But once the code was functioning, nothing happened. No hex file has appeared, or other output file whatsoever.
"sdas8051 -h" to the rescue! By looking at possible flags, it looks like I want to add the flags -l, -o, and -s to generate list file, object file and symbol file accordingly:
sdas8051 -los blink.asm
Runnig this generated these files, but none are hex. It seems that there's a need for linking now - although there's only one file here.
The linker is called SDLD, and it's flag list suggests that the -i flag generates an intel hex out of the arguments:
sdld -i semyon
This generated a .ihx format file. Looking at it, it looks like some gimp cousin of the intel .hex file with a weird extension. I'm not the only one who hates it, so a short google has showed me that SDCC has a utility called 'packihx' just to make these .ihx files into proper .hex files, mostly by ordering and aligning them.
Now that I have a blink.hex file I can finally download it to the chip! The lights indeed did their thing on and off, as I wanted them.
To ease the build, I made for semyon the crudest makefile you've ever seen:
build: sdas8051 -los semyon.asm sdld -i semyon packihx semyon.ihx > semyon.hex
Now that's I can use SDAS correctly, it's time to do write semyon's firmware!