Quantcast
Channel: x86 Assembly - Programmers Heaven
Viewing all articles
Browse latest Browse all 152

what's wrong with these five lines?

$
0
0
hi, I'm a beginner -- just started learning ASM. Anyway, my first program is this:

[code]

[BITS 16] ;Set code generation to 16 bit mode
[ORG 0x0100] ;Set code start address to 0100h


start:

mov ax,0b800h ; VGA video refresh segment
mov es, ax ; move it to ES
xor di,di ; zero out DI to get B800:0000
mov ax,0441h ; code for a red 'A'
mov [es:di],ax ; move the red 'A' to video refresh buffer
; thus we can see red 'A' at top-left in screen
[/code]

after running this code, NASM crashs, and when I try it in DEBUG, I see the red 'A' but cursor starts to jump all over and windows says program cause a fault.

is there any problem with the code itself? I'm running it under DOS within Windows ME.

thanks,

Viewing all articles
Browse latest Browse all 152

Trending Articles