1

I'm trying to convert this bit of assembly for as86 to fasm. I have 3 questions:

1) Why seg es given an error: illegal instruction. this is not valid in 16-bit?

2) Is mov byte [0],0x41(FASM syntax) exactly equivalent to mov [0],#0x41(as86 syntax)? if isn't,can you show me the equivalent to?

3) Why entry start give an error in FASM?

Here's the assemblies codes:

as86

entry start
start:
       mov ax,#0xb800
       mov es,ax
       seg es
       mov [0],#0x41
       seg es
       mov [1],#0x1f
 loop1: jmp loop1

and the fasm version that I wrote:

FASM

use16
format binary

start:
    mov ax,0xb800
    mov es,ax
    seg es
    mov byte [0],0x41
    seg es
    mov byte [1],0x1f
loop1:  jmp loop1
nrz
  • 10,435
  • 4
  • 39
  • 71
Jack
  • 16,276
  • 55
  • 159
  • 284

2 Answers2

1

Correct syntax is:

mov byte [es:0],0x41    ;I'm not sure if this instruction is supported under 16 bit CPU

or

push bx 
mov  bx,0   ;you can use also: xor  bx, bx
mov  byte [es:bx],0x41
pop  bx
GJ.
  • 10,810
  • 2
  • 45
  • 62
0

seg es looks fishy. Try following:

mov byte ptr es:[0],0x41
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
  • doesn't works for me: `s.asm [21]: mov byte ptr es:[0],0x41 error: invalid expression.` – Jack Jan 19 '13 at 22:02