0

In my assembly language project i am facing three errors in corresponding line as given below:

1)Message:DB 13,10,"Non- 
 system disk or disk error"
 DB 13,10,"Replace and 
    press any key"
 DB 13,10,0

2)IOSYS: DB "IO    SYS"
   DB "MSDOS SYS"
   DB 0
   DB 0
   ORG 7C00H + 01FEH
   DB 55H
3) DB AAH ;Boot sector 
          ;signature

Line1 and line2 error

syntax error : DB

Line3 error

undefined symbol : AAH

Please guide me.

godmahakal
  • 57
  • 3
  • I don't think MASM allows `1)` at the start of a line. Did you only add that on stack overflow, so that code block is different from the file you actually assembled? Anyway, I'd guess that a space after the `:` would be a good idea! The other part is a duplicate of [How do I write letter-initiated hexadecimal numbers in masm code?](https://stackoverflow.com/q/33276232) – Peter Cordes Aug 09 '20 at 03:53
  • No, I don't use 1), 2) and 3) in program coding it is only for specification purpose. Actually I used "Message: DB 13,10". And i used space between "Message:" and DB. And same with the "IOSYS:" and DB. But why it is showing error. – godmahakal Aug 09 '20 at 06:42
  • And thanks to you, your guidance solved my 3rd error. thanks Peter. – godmahakal Aug 09 '20 at 06:45
  • 1
    I don't know MASM very well. Some quick googling on that error message found another way it can happen is if the label name is actually a keyword. So try a different label name. I'd also be worried about a line-ending inside double quotes. Normally that's why you'd use something like `db "foo", 13, 10, "bar"` – Peter Cordes Aug 09 '20 at 06:45

1 Answers1

2

Try to remove the colon between a label and a db statement:

IOSYS  DB "IO    SYS"

As for the last error: integer constants must begin with a digit, even if they are hexadecimal. Replace AAh with 0AAh to fix this problem.

fuz
  • 88,405
  • 25
  • 200
  • 352
  • The docs for the [`DB`](https://learn.microsoft.com/en-us/cpp/assembler/masm/db) directive show that the optional name before the `DB` should not have a colon, although looking at the [BNF Grammar](https://learn.microsoft.com/en-us/cpp/assembler/masm/masm-bnf-grammar) a _labelDef_ (with a colon) can be followed by a _dataDir_ (with an optional name before the `DB` directive) the `IOSYS: DB` should be legal. There's likely something outside of the BNF grammar to disallow the colon here. – 1201ProgramAlarm Aug 09 '20 at 21:28
  • @1201ProgramAlarm : There are some semantics involved and has to do with whether the label is defined in a data section or code section. If you place `IOSYS: DB "IO SYS"` in a `.data` segment (simplified dos model) it will give you an error. Place it in a `.code` segment and it will be allowed. This has to do with the scoping of labels within a procedure and those labels that are global. – Michael Petch Aug 11 '20 at 16:35