Pregunta

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
¿Fue útil?

Solución

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

Otros consejos

seg es looks fishy. Try following:

mov byte ptr es:[0],0x41
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top