nasm error: label or instruction expected at the start of line

时间:2015-05-12 23:18:34

标签: assembly x86 nasm

Hello I am very new to assembly(just started today) and ran into this problem when doing exactly what is said in this tutorial. I made an asm file with this text:

CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName);
using (var memoryStream = new System.IO.MemoryStream())
{
   blockBlob.DownloadToStream(memoryStream, null, new BlobRequestOptions()
   {
        ServerTimeout = TimeSpan.FromSeconds(120)
   });
   string content = Encoding.UTF8.GetString(memoryStream.ToArray());
}

I get this error

org 0x100 
start:
mov bx, [a]
mov ax, [val]
mov cx, 8
sub sp, 8
call search
ret

search:
mov di, sp
go:
    cmp [bx], ax
    jz detected
    continue:
        add bx, 2
        dec cx
        jnz go
        ret
detected:
    add di, 2
    shl word[bx], 2
    mov dx, [bx]
    mov [di], dx
    jmp continue



a dw 1, 2, 1, 4, 1, 6, 7 , 8
val dw 1

I am wondering if this is a bad tutorial or am I typing something wrong. also I would like to know what it means by "label or instruction".

2 个答案:

答案 0 :(得分:0)

You forgot to show the command you used to assemble, and what OS you are on, and what output format you want. Due to the var size = [9, 11, 13, 15]; var colorA = ["blue", "green", "yellow", "red"]; var myObj = [{x:0,y:1,sz:9},{x:4,y:11,sz:9},{x:11,y:17,sz:11},{x:29,y:18,sz:13},{x:39,y:15,sz:15}]; var d1 = []; var d2 = []; for (var i = 0; i < size.length; i++) { d1 = []; d1[0] = myObj[i]; d1[0].color = colorA[i]; d1[1] = myObj[i + 1]; d1[1].color = colorA[i]; d2.push(d1); } for (var i = 0; i < d2.length; i++) { for (var j = 0; j < d2[i].length; j++) { var html = '<div id="' + i + '_' + j + '"'; if (j%2==0) html += ' style="float:left;"'; html += '>x=' + d2[i][j].x + ';y=' + d2[i][j].y + ';sz=' + d2[i][j].sz + ';color=' + d2[i][j].color + ';</div>'; $('#container').append(html); } } I assume you want a DOS org 0x100 file. Now, your .com might not default to that format, so you should try something like nasm.

The error nasm -f bin -o laber.com laber.asm isn't a terribly good message, and basically means nasm didn't recognize the label or instruction expected and tells you to use a label (something followed by a colon) or an instruction (I hope you know what those are ;)). Of course you could also use other things, such as a valid directive, but nasm doesn't tell you that.

答案 1 :(得分:0)

You need to insert

relativeLayout.setBackgroundColor(Color.parseColor(mColorWheel.mColors[currentColor]));

at the top of your file.