flat assembler
Message board for the users of flat assembler.

Index > Main > Some questions: [edi+ecx*3] | PUSH | RAM limit | IDT PIT

Goto page Previous  1, 2, 3, 4
Author
Thread Post new topic Reply to topic
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 12 Mar 2011, 18:21
i got a trouble.

How do i pass a value from RM to PM and vice-versa?

I fill the ModeInfoBlock in RM and have all my VBE functions there, but if i call them in PM i got a reset.

Code:
jmp 0x08:pmode

 include 'vbe.asm' ; all vbe functions and ModeInfoBlock here

pmode:

    ; move kernel to addr 0x100000 and jmp to there.

    ; code, code, code..

   call drawsomething ; NOOOOooooooo!!!
    


maybe bc i didn't move the vbe code together? but what if i want let it in the low memory?

if i change the include place, call drawsomething works, but then i cant call getInfoblock in RM:

Code:

    call getInfoBlock ; OH NOES!!!

    ; code...
jmp 0x08:pmode

pmode:

    ; move kernel to addr 0x100000 and jmp to there.

    ; code, code, code..

   call drawsomething ; YEAH!!!

 include 'vbe.asm' ; all vbe functions and ModeInfoBlock here
    


Last edited by Teehee on 12 Mar 2011, 18:27; edited 1 time in total
Post 12 Mar 2011, 18:21
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 12 Mar 2011, 18:22
Of course there are pros and cons for both, but Intel chose little-endian format because then you can read a byte and a qword (or any other size) from the same offset:
Code:
; data @ 1234h: 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 ...
mov rax,[1234h] ; rax=0807060504030201h
mov eax,[1234h] ; eax=04030201h
mov  ax,[1234h] ; ax=0201h
mov  al,[1234h] ; al=01h
    

with each read from memory al (the least significant byte) will still be 01h - the value at the first byte read from 1234h.

With big-endian format you'd have to read a qword from 1234h, dword from 1238h, ..., byte from 123Bh. I've gotten used to little-endian so much that I wouldn't know how to use the other one.

_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 12 Mar 2011, 18:22
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 12 Mar 2011, 18:41
@Teehee: You must code different subroutines for RM and PM. You can't expect them to work universally. I don't know what's behind your calls, but you definitely need to think these through. You cannot just move them around from RM to PM and vice-versa.
Post 12 Mar 2011, 18:41
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.