Author Topic: grldr and masm  (Read 1918 times)

mabdelouahab

  • Member
  • ***
  • Posts: 336
grldr and masm
« on: February 15, 2015, 09:02:39 PM »
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

  • Member
  • *****
  • Posts: 1704
Re: grldr and masm
« Reply #1 on: February 15, 2015, 09:10:48 PM »

Gunther

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: grldr and masm
« Reply #2 on: February 16, 2015, 11:51:20 PM »
mabdelouahab,

Is it possible to use mmx?

that seems possible, but mmx is a bit obsolete.

Erol,

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
Get your facts first, and then you can distort them.

mabdelouahab

  • Member
  • ***
  • Posts: 336
Re: grldr and masm
« Reply #3 on: February 17, 2015, 03:42:31 AM »
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

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: grldr and masm
« Reply #4 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

mabdelouahab

  • Member
  • ***
  • Posts: 336
Re: grldr and masm
« Reply #5 on: February 17, 2015, 05:48:19 AM »
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
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

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: grldr and masm
« Reply #6 on: February 17, 2015, 06:48:38 AM »
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

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: grldr and masm
« Reply #7 on: February 17, 2015, 08:41:10 AM »
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

  • Member
  • ***
  • Posts: 336
Re: grldr and masm
« Reply #8 on: March 01, 2015, 02:24:20 AM »
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)
Code: [Select]
.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

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: grldr and masm
« Reply #9 on: March 01, 2015, 03:51:52 AM »
maybe better to use 32 bit DOS  Extender ?

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: grldr and masm
« Reply #10 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

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)
Code: [Select]
    .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
Code: [Select]
    .data?

tablex  dq ?

    .code

    lgdt fword ptr tablex
Code: [Select]
    .data?

tablex  dq ?

    .code

    mov     ebx,offset tablex
    lgdt fword ptr [ebx]

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

mabdelouahab

  • Member
  • ***
  • Posts: 336
Re: grldr and masm
« Reply #11 on: March 01, 2015, 05:23:40 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: