flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > OS Construction > lds les ect...

Author
Thread Post new topic Reply to topic
Hayden



Joined: 06 Oct 2005
Posts: 132
lds les ect...
its been a while since i done any low level programming and i cant seem to remember how to use the lds instructrion.

here is what I have so far :


Code:

IVT     = 00000000h          ; The Interrupt Vector Table
BDA     = 00000400h          ; The BIOS Data Area
BDA_END = 00000500h  - 1     ; End of BIOS Data Area

use16                        ; Make sure compiler uses 16-bit code
org 00000500h                ; Start of OS

MemoryConfig dp ?
virtual at MemoryConfig
    MaxLowMemory   dw ?
    TotalLowMemory dw ?
    ExtendedMemory dw ?
end virtual

MemoryMap dp ?
virtual at MemoryMap
    LengthOfTable       dw ? ; excluding this word
    LocalMem1Mto16M     dd ? ; in 1K blocks
    LocalMem16Mto4G     dd ? ; in 1K blocks
    SystemMem1Mto16M    dd ? ; in 1K blocks
    SystemMem16Mto4G    dd ? ; in 1K blocks
    CacheableMem1Mto16M dd ? ; in 1K blocks
    CacheableMem16Mto4G dd ? ; in 1K blocks
    StartNonSystemMem1Mto16M dd ?
    StartNonSystemMem16Mto4G dd ?
    StartSegLargestBlock     dw ? ; from C0000h-DFFFFh
    SizeLargestBlock         dw ?
                             dd ? ; reserved
end virtual

int 12h                          ; GET MEMORY SIZE
mov word [MaxLowMemory],   ax    ; kilobytes of contiguous memory starting at 00000h
inc ax                           ; + Extended BIOS Data Area (1kB)
mov word [TotalLowMemory], ax    ; Total low memory

START_SCREEN = 000A0000h          ; Sart of VGA memory
; END_SCREEN   = 000E0000h        ; End of VGA memory (Expaned Memory)
START_VRE    = 000C0000h          ; Video ROM Extensions

mov ah000000C7h
lds si, [MemoryMap]
int 15h                





also shaould I be useing struc or virtual to define data structures

_________________
New User.. Hayden McKay.
Post 05 Dec 2015, 11:41
View user's profile Send private message Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 210
Location: film "CandyMan" directed through Bernard Rose
it is looking out this way:

Code:
FarAddress dd ? ; dw Offset dw Segment
...
lds ax,[FarAddress]


OR

Code:
FarAddress df ? ; dd Offset dw Segment
...
lds ebx,[FarAddress]


OR

Code:
FarAddress dw Offset,Segment
...
lds bx,dword [cs:FarAddress]



variants are still possible:
les edx,[...], lfs esi,[...], lgs di,[...], lss esp,[...]

your code should look this way:

Code:
        mov     [MemoryMap+2],cs
        mov     [MemoryMap+0],MemoryMapStart
        ...

        ...
        push    ds
        lds     si,[MemoryMap]
        mov     ah,0xC7
        int     15h
        pop     ds
        ...

        mov     eax,[MemoryMapStart+LocalMem1Mto16M]
        ...
        mov     eax,[MemoryMapStart+SystemMem16Mto4G]


MemoryMap dw ?,?

virtual at 0
    LengthOfTable       dw ? ; excluding this word
    LocalMem1Mto16M     dd ? ; in 1K blocks
    LocalMem16Mto4G     dd ? ; in 1K blocks
    SystemMem1Mto16M    dd ? ; in 1K blocks
    SystemMem16Mto4G    dd ? ; in 1K blocks
    CacheableMem1Mto16M dd ? ; in 1K blocks
    CacheableMem16Mto4G dd ? ; in 1K blocks
    StartNonSystemMem1Mto16M dd ?
    StartNonSystemMem16Mto4G dd ?
    StartSegLargestBlock     dw ? ; from C0000h-DFFFFh
    SizeLargestBlock         dw ?
                             dd ? ; reserved
    MemoryMapSize; = $
end virtual


MemoryMapStartrb MemoryMapSize



_________________
smaller is better
Post 05 Dec 2015, 12:24
View user's profile Send private message Reply with quote
Shahada



Joined: 25 Jul 2008
Posts: 75
In code you posted you not need appeal to LDS for help: mov si,MemoryMap is good.

-------------------------------------------------------------------------------------

None saw it;
Neither did Aminadab appear.

Ya Allah Ya Allah Ya Allah
Post 10 Dec 2015, 09:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.