Home > Software design >  Sjasm: can't assemble DW or OUTPUT directive?
Sjasm: can't assemble DW or OUTPUT directive?

Time:09-18

This is my code:

output "ejemplo1.bin"

db #fe
dw START
dw END

org #8500

START:
    ld a, [#8600]
    ld b, a
    ld a, [#8601]
    add a, b
    ld [#8602], a

    ret

END: And this is what I'm getting when trying to compile it:

C:\Users\Daniel\Programming\MSX\asm>sjasm ejemplo1.asm
Sjasm Z80 Assembler v0.42c - www.xl2s.tk
ejemplo1.asm(1) : Unrecognized instruction: "ejemplo1.
ejemplo1.asm(3) : Label not found: fe
ejemplo1.asm(4) : Unrecognized instruction: start
ejemplo1.asm(5) : Duplicate labelname: dw

Any idea what I'm doing wrong?

CodePudding user response:

It helps if you read the manual.

The main error: Only labels start in the first column, insert at least a space or tab before any instruction or pseudo instruction.

ejemplo1.asm(1) : Unrecognized instruction: "ejemplo1.

output is interpreted as label, and consequently the filename is tried as an instruction. The interesting detail is that the point "." is taken as a separator. BTW, the filename is not in quotation marks, according to the examples.

ejemplo1.asm(3) : Label not found: fe

db is interpreted as label, and perhaps #fe is interpreted as a structure field entry. # defines the length on a field, and therefore fe is not recognized as a number, but as a label. This interpretation looks like a bug in the assembler to me.

ejemplo1.asm(4) : Unrecognized instruction: start

dw is interpreted as label, and consequently start is tried as an instruction.

ejemplo1.asm(5) : Duplicate labelname: dw

dw is again interpreted as label, as the error message tells us that it is already defined (in the line before).

Note: If you correct your code and get new errors, feel free to post a new question. You might want to add this to this question, but don't remove the current contents, add it and mark it as addition.

  • Related