News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

grldr and masm

Started by mabdelouahab, February 15, 2015, 09:02:39 PM

Previous topic - Next topic

mabdelouahab

Anyone give me an example (Hello World) of how to make bin file, so call by grldr and can read and write to the hard disk (ntfs),
Is it possible to use mmx?

Vortex

How to develop your own Boot Loader :

http://www.codeproject.com/Articles/36907/How-to-develop-your-own-Boot-Loader

Gunther

mabdelouahab,

Quote from: mabdelouahab on February 15, 2015, 09:02:39 PM
Is it possible to use mmx?

that seems possible, but mmx is a bit obsolete.

Erol,

Quote from: Vortex on February 15, 2015, 09:10:48 PM
How to develop your own Boot Loader :

http://www.codeproject.com/Articles/36907/How-to-develop-your-own-Boot-Loader

good article, but the author recommends BC 3.5 and TASM. A bit obsolete, too.

Gunther
You have to know the facts before you can distort them.

mabdelouahab

Thank you Gunther, Vortex
I'm looking for a program, execute the following:

1. boot.
2. enter a file name. (if there is the possibility to browse the hard drive and select the file)
3. access to the file on the hard drive (ntfs)
4. read the file, byte by byte
5. pass each byte to a specific function.
6. show the result text.

Does anyone give me help, I have no experience in boot files :biggrin:

dedndave

if you intend to write all the code yourself, that's a huge task   :icon_eek:

the main reason - you need code to read NTFS formatted drives

if you want to boot from a CD and do this, you might be able to cobble together some pre-existing utilities

mabdelouahab

dedndave
Quote from: dedndave on February 17, 2015, 03:54:43 AM
if you intend to write all the code yourself, that's a huge task   :icon_eek:

the main reason - you need code to read NTFS formatted drives

if you want to boot from a CD and do this, you might be able to cobble together some pre-existing utilities
Is what I am looking for, and then how to use it.
What I want to do that I pass the file content to the special function, The remainder of the code I want to have it ready and do not intend to do myself
But where do I start?

GoneFishing

maybe How to create bootable DOS USB stick which sees NTFS drives?
You may choose DOS with NTFS support (keyword for search NTFS4DOS)  or one of the  light weight live Linux distros.

dedndave

there are numerous CD-based boot utilities out there
many are linux-based - but are able to read NTFS partitions

one place you might look is
http://www.msfn.org/board/

another way to go would be to create a bootable WinPE CD
WinPE is free and available from microsoft

mabdelouahab

vertograd,dedndave
For dos, I found this link:How to make a bootable MS-DOS thumb drive with full NTFS support (read\write)
An easy way to reach the result

But I couldn't switch to 32-bit mode (error A2008: syntax error : lgdt /error A2016: expression expected)

.model small
.486
.mmx
.xmm
.stack 1024h   
.data
    gdt_descr dw 23
        dd gdt
    gdt dd 0,0,00000FFFFh,000CF9A00h,00000FFFFh,000CF9200h 
.code
Start:
mov eax,seg gdt_descr
mov ds,ax
cli
mov al,0D1h
out 064h,al
mov al,0DFh
out 060h,al
lgdt  gdt_descr   ; error A2008: syntax error : lgdt
; lea  esi,gdt_descr
; lgdt [esi] ; error A2008: syntax error : [
; lgdt fword ptr ds:[gdt_descr]    ; error A2016: expression expected
mov eax,cr0
or eax,01h
mov cr0,eax

mov ah, 01h
int 21h
mov   ax,4c00h
int   21h
end Start

* I use: RadASM (masm/Dos app)
* Assemble:"3,O,$B\ML.EXE /DMASM /DDOS /Zm /c /nologo /I"$I",2";
* LINK:"0,O,$B\DOSLINK.exe /NOLOGO,3,"|||||""
* For: DOSLINK, I follow the steps in the Forum : DOS Project with RadASM - DOSLINK missing    
* For the application I use: Oracle VM VirtualBox

Is there any help

GoneFishing

maybe better to use 32 bit DOS  Extender ?

dedndave

first, not sure .486 will work with LGDT
i tried it using .686p, and got it to work

second, the global descriptor table is 6 bytes in size, although you may allocate a qword, or a word and a dword
the relavent keywords are FWORD and DF (define fword)
    .data?

tablex  df ?
tablex2 FWORD ? ;should also work

    .code

    lgdt    tablex


if you happen to allocate a qword or if you use a register, you can use FWORD PTR as a size override
    .data?

tablex  dq ?

    .code

    lgdt fword ptr tablex

    .data?

tablex  dq ?

    .code

    mov     ebx,offset tablex
    lgdt fword ptr [ebx]


and, i bet you though the fword was 4 letters   :lol:

mabdelouahab

Quote from: dedndave on March 01, 2015, 03:56:54 AM
first, not sure .486 will work with LGDT
i tried it using .686p, and got it to work
You're right, I've replace .486 by .686p only, just; I don't know how I missed this little  :biggrin: