flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > What does rep movsb take? |
Author |
|
sid123 25 Dec 2013, 04:42
I am trying to copy a block of code from one segment to the another,
using a rep movsb. I think this is what rep movsb takes SI : Source DI : Destination (Offset) CX : Bytes to copy Is this correct? If not then please tell me what is the correct representation. Now to the code. This is an Interrupt that takes SI,CX and DI and when called it copies stuff in SI to 0x5000:0x0000. I tried it. It works pretty much. But I am still unsure whether this is doing what it should + If my representation of SI,DI and CX during movsb is correct or not. Code: int_26_ivt: cmp ah,0x00 je segment_copy segment_copy: mov bx,0x5000 mov es,bx ; SI : MOVed by programmer (Stuff to copy) ; DI : MOVed by programmer (Offset to copy) ; CX : MOVed by programmer (Bytes to Copy) rep movsb ; Copy it! mov ds,bx call 0x5000:0 ; Call it! ; Restore the segment registers mov bx, 0x2000 mov ds, bx mov es, bx ; Restore Everything jmp int_26_exit int_26_exit: pop ds pop es pop fs pop gs popa iret How can I forget this?!!! Merry Christmas to all! _________________ "Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X XD |
|||
25 Dec 2013, 04:42 |
|
sid123 25 Dec 2013, 04:59
@revolution
Thanks. I do clear the direction flag and push all the segment registers before calling the interrupt. Just wanted to focus on the main part. |
|||
25 Dec 2013, 04:59 |
|
revolution 25 Dec 2013, 05:08
sid123 wrote: I do clear the direction flag and push all the segment registers before calling the interrupt. Just wanted to focus on the main part. |
|||
25 Dec 2013, 05:08 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.