flat assembler
Message board for the users of flat assembler.

Index > Main > macros, procedures, structures

Author
Thread Post new topic Reply to topic
phreak



Joined: 19 Dec 2007
Posts: 10
phreak
Hi!
after a million of manuals of asm and os development I started to develop a simple os.
I have a few questions about macros.
Can I use the proc32 and struct macros without using win32a.inc?
And there is any advance tutorial about macros? because all I found are a few examples.

Thanks!

PD: Sorry about my english... I hope you understand
Post 19 Dec 2007, 13:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17273
Location: In your JS exploiting you and your system
revolution
phreak wrote:
Can I use the proc32 and struct macros without using win32a.inc?
Yes, you can include each file individually if you want to.
Post 19 Dec 2007, 13:41
View user's profile Send private message Visit poster's website Reply with quote
phreak



Joined: 19 Dec 2007
Posts: 10
phreak
Hi, I have this program, that seems to work on windows.. I followed it with a debugger and everything works ok. But in my "command line" that is bootable program, it isnt work (I only use the procedure in my program, this code is a test).
What can be the problem?


use32

format PE

include "PROC32.H"

stdcall mode03h_clear, 0x90
jmp $

;-- ------------------------
;clean screen
;--------------------------
proc mode03h_clear, color:BYTE ; CLEAR (byte color)
mov ah,0x06
mov al,0x00
mov bh,[color]
mov ch,0x00
mov cl,0x00
mov dh,0x18
mov dl,0x4F
;int 0x10 ;This doesnt work on windows...
ret
endp
Post 20 Dec 2007, 10:28
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you use PE format as your bootable format?
Post 20 Dec 2007, 10:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
phreak



Joined: 19 Dec 2007
Posts: 10
phreak
no, That source is a test program... I used PE so I coud debug with ollydbg...

The booteable is flat binary... I can upload the source if you have some time to see them..
Post 20 Dec 2007, 10:33
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
I believe problem is that you don't start 32bit protected mode before executing the code? Note that proc32.inc macros are written to be used in 32bit code, and PE is 32bit code too. And after you are in protected mode, interrupts doesn't work (so easily).
Post 20 Dec 2007, 12:12
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
phreak



Joined: 19 Dec 2007
Posts: 10
phreak
no .. I do start protected mode ...
but.. I use interrupts being on protected mode, so might that is the problem..
The program works until I use procedures.. please help!

I upload the sources...


Description: Sources of bootloader and kernel
Download
Filename: Simple os.rar
Filesize: 7.14 KB
Downloaded: 89 Time(s)

Post 21 Dec 2007, 06:11
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
one error, you cannot use bios int in PM
int 13h, disk read, is unusable under protected mode

because it is extracted from the IVT and not the IDT

ivt =/= idt

ivt = real mode
idt = protected mode

and even if the ivt = idt, in the most of case, code for RM doesn't work for PM.
Post 21 Dec 2007, 06:25
View user's profile Send private message Visit poster's website Reply with quote
phreak



Joined: 19 Dec 2007
Posts: 10
phreak
ok .. Thanks! I'll learn a bit more about PM..
Cannot use interrupts means that I have to access everything direct from memory?
Post 21 Dec 2007, 15:22
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
phreak: no. you should start by writing just real mode code. But real mode code is (usually) only 16 bit, and those macros are for 32bit code.

That means:
- write 16 bit real mode code
- don't use proc32.inc, it is for 32bit code
Post 21 Dec 2007, 15:40
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
yes, and GOTO int13h topic in OS construction forum...
Post 21 Dec 2007, 15:42
View user's profile Send private message Visit poster's website Reply with quote
phreak



Joined: 19 Dec 2007
Posts: 10
phreak
ja .. thanks for your help, but I want to use protected mode, no matter what it takes...
Post 21 Dec 2007, 16:04
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
here

if you want to PM, the good section is OS construction...
why?
because people who are iterested in OS construction consult automatically this forum...
and possible they are not interrested by MAIN topic,, so they will not consult the new messages in MAIN...
Post 21 Dec 2007, 16:44
View user's profile Send private message Visit poster's website Reply with quote
phreak



Joined: 19 Dec 2007
Posts: 10
phreak
ok, Thanks!
Post 21 Dec 2007, 22:45
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


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.