Author Topic: ASM help...  (Read 1354 times)

Offline ladyGeek

  • Jr. Member
  • *
  • Posts: 2
ASM help...
« on: November 07, 2017, 04:21:16 PM »
hi guys!

ladyGeek here. I'm new to the asm community. Trying to get the code below to work, but I keep getting errors. I figured I'd ask for help here. Hope I'm not intruding. ^-^

Code: [Select]
BA3D01 mov dx,0x13d
BA90 mov ah,0x9
CD21 int 0x21
BA6301 mov dx,0x163
CDFF int 255d
3C06 cmp al,0x6
B401 mov ah,0x1
CD21 int 21h
3CA1 cmp al,241o
E90900 jmp word 0x26
BA8201 mov dx,0x182
EBCE jmp short 0x7
B44C mov AL,0x4c
CDAF int 10101111b

produces these errors.

Code: [Select]
asm16.asm:6: error: label or instruction expected at start of line
asm16.asm:8: error: symbol `CD21' redefined
asm16.asm:9: error: label or instruction expected at start of line

So I'm guessing that the second error is because I got the label wrong for int 21h. And... i'm not sure what's going on with the other two.

Any ideas?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2381
  • Country: us
Re: ASM help...
« Reply #1 on: November 07, 2017, 06:39:49 PM »
Hi ladyGeek,

Welcome to the Forum.

You are not intruding, but you've got the strangest coding style I've ever seen. It is not doing what you intend. Nasm is attempting to interpret the leftmost column as a label. In one case you've got the duplicate label "CD21". The other two errors are because the line starts with a numeral, not an alpha character - not a valid label. (numbers must start with a decimal digit, labels may not).

Nasm doesn't flag it as an error, but line 2 is incorrect. That is, the presumed opcodes don't match the assembly. Nasm doesn't know they're supposed to be opcodes - it's just a label. This tells me that an assembler didn't write that leftmost column, some human did. You?

If you prepend an underscore to the three offending lines... or delete the leftmost columns... your code will assemble. You use some "unusual" interrupts, and I doubt if you're going to get that octal number from the keyboard. What's it supposed to do? Did you write this code or find it somewhere? What's the story here, ladyGeek?

Best,
Frank


Offline ladyGeek

  • Jr. Member
  • *
  • Posts: 2
Re: ASM help...
« Reply #2 on: November 07, 2017, 11:23:49 PM »
Frank,

The code isn't my own, and I don't even know if I am supposed to have it run. It was originally a fill-in-the-blank type problem, with lines like:

CD?? int 0x21

I am not exactly sure what it does. I know that's less than exciting, but it's the answer to your question.

Also, thank you very much for your advice.

The original problem was:

Code: [Select]
BA3D01 mov dx,0x13d
???? mov ah,0x9
CD21 int 0x21
BA6301 mov dx,0x163
??FF int 255d
3C06 cmp al,0x6
B401 mov ah,0x1
C??1 int 21h
???? cmp al,241o
E90900 jmp word 0x26
BA8201 mov dx,0x182
EBCE jmp short 0x7
B44C mov ??,0x4c
CD?? int 10101111b

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2381
  • Country: us
Re: ASM help...
« Reply #3 on: November 08, 2017, 02:05:43 AM »
Okay. Still pretty strange code. And a strange type of problem to set out for a beginner. If this is a course you're taking, my condolences.

There's another error I missed - in the next to last line, that should be "mov ah, 4Ch" not "mov al, 4Ch". If that had been followed by " int 21h" it would terminate your program and return to the DOS prompt... but it isn't... perhaps another error?

If you have any questions, feel free to ask.

Best,
Frank