Author Topic: help nasm copy memory to memory problem !!!!  (Read 9048 times)

nobody

  • Guest
help nasm copy memory to memory problem !!!!
« on: November 09, 2006, 06:22:21 PM »
hi
  i have some problem blew,see about the code
INITSEG=0x7c00
SETUPSEG=0x9000
_start:
 mov ax,INITSEG
mov ds,ax
mov ax,SETUPSEG
mov es,ax
mov di,0
 sub di,di
 sub si,si; copy to SETUPSEG   (256*2) Byte
cld
rep
movsw
       jmp SETUPSEG:SysBegin
SysBegin:

i rewrite the code of bootsect.s in linux0.11 kernel by nasm ,but
this code can't work ,and i use bochs debug it ,find that after run
this code at 0x9000 address ,there is no data,still null, it seems
have't copy any data to 0x9000 ,
  please help me to  point the error ,3x
  my system is debian , use nasm NASM version 0.98.38

email :fxlstep@gmail.com

nobody

  • Guest
Re: help nasm copy memory to memory problem !!!!
« Reply #1 on: November 09, 2006, 10:28:32 PM »
Ah, there we go! I couldn't log on earlier 'cause SF was updating our page at http://www.sf.net/projects/nasm - I like the mew look!

The question has been answered in several fora, but for completeness...

You want "INIT_SEG" to be 0x7C0, not 0x7C00. (an alternative would be ds - 0, si = 0x7C00)

You need to initialize cx to the "count" for the "rep movsw" - wants to be 0x100 (or 256).

Best,
Frank