0

this code gives error line 1:error:expression syntax error line 6:expression syntax error

if i use "H" at last then the error disappear

7C00 EB3C          JMP     7C3E          ; Jump over the BPB.
7C02 90            NOP                   ; Do nothing. Address not used.
7C3E FA            CLI               ; Disable maskable Interrupts
7C3F 33C0          XOR  AX,AX        ; Zero-out the Accumulator and set
7C41 8ED0          MOV  SS,AX        ;  Stack Segment register to ZERO.
7C43 BC007C        MOV  SP,7C00      ; Stack Pointer top now 0000:7C00
7C46 16            PUSH SS           ;|
7C47 07            POP  ES           ;|Makes sure Extra Segment = ZERO.
7C48 BB7800        MOV  BX,0078      ; 0078h ---> BX
7C4B 36C537        LDS  SI,SS:[BX]   ; SS is still zero...
                                 ; Load Far Pointer from [SS:0078]
                                 ; into DS:SI  (usually 0000:0522).
7C4E 1E            PUSH DS
7C4F 56            PUSH SI
7C50 16            PUSH SS
7C51 53            PUSH BX

; The following four instructions will overwrite 11 code bytes starting at 
;7C3Eh:
7C52 BF3E7C        MOV  DI,7C3E      ; Will overwrite some code bytes!
7C55 B90B00        MOV  CX,000B      ; Copy CX (0Bh = 11) bytes from ...
7C58 FC            CLD               ; Clear Direction Flag (df=0).
7C59 F3A4          REP  MOVSB        ; ... DS:SI to ES:DI (0000:7C3E) and
                                 ; following; DI increases to 7C49.

this code gives error line 1:error:expression syntax error line 6:expression syntax error

if i use "H" at last then the error disappear

  • 1
    `7C3E` is not a valid numeric constant because you didn't do anything to indicate that it's hex. It started with a digit so NASM is trying to parse it as a base-10 number. `7C3Eh` is a hex constant, like `0x7C3E`. It happens that `E` as a suffix doesn't mean anything (unlike `b` which means base 2 binary) so it's a syntax error. See [How to represent hex value such as FFFFFFBB in x86 assembly programming?](https://stackoverflow.com/q/11733731) – Peter Cordes Aug 16 '20 at 09:15
  • 1
    Also, use labels instead of writing `JMP 7C3E`; that's what labels are for. – Peter Cordes Aug 16 '20 at 09:18
  • What was the point of your edit? The original question was clearer. Also note that `0078` is a decimal constant if you write it that way. See the linked duplicate for how to write hex constants in NASM. – Peter Cordes Aug 16 '20 at 13:07
  • 2
    @PeterCordes : I think what is going on here is that the OP is moving code they use with DOS DEBUG which assumes all value are HEX so no prefix and suffix is used. DOS DEBUG also has no labels so you need to hard code all the JMP values etc. All the code here would be assembled by DOS DEBUG with no issues. I suspect that this user is attempting to use their DOS DEBUG code directly in NASM and then they run into these errors. – Michael Petch Aug 16 '20 at 14:13
  • 2
    I've tried to communicate with this OP in the past and they don't respond. They also ask questions and don't seem to accept answers. I have assumed there is a language barrier of some sort. – Michael Petch Aug 16 '20 at 14:18

0 Answers0