flat assembler
Message board for the users of flat assembler.

Index > DOS > EXE's in FASM (the Worrywart strikes again)

Author
Thread Post new topic Reply to topic
peter_rk



Joined: 17 Apr 2005
Posts: 13
Location: somewhere in the world?
peter_rk 25 Nov 2005, 06:40
Being a nervous maniac again, I fear that filesize will become overwhelming in FASM. I have looked through the manual but have found little said on the subject of EXE files besides that they can be done. The included example does little to help ease the problem. Help?
Post 25 Nov 2005, 06:40
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 25 Nov 2005, 15:19
what is your problem with EXE files?
Post 25 Nov 2005, 15:19
View user's profile Send private message Visit poster's website Reply with quote
peter_rk



Joined: 17 Apr 2005
Posts: 13
Location: somewhere in the world?
peter_rk 26 Nov 2005, 05:59
How to make large(r) EXE files?

(Excuse me for not being clearer. There are many tutorials for this on Internet, just none for FASM.)

_________________
[insert witty remark here]
Post 26 Nov 2005, 05:59
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 26 Nov 2005, 06:30
peter_rk,
could you tell us what you whould like to do, maeby it whould be easier to find solution,
once i saw a demo exe, it was 5 MB in size,
( it uses CWSDPMI )

i whould guess you were asking about paging?
http://www.embedded.com/98/9806fe2.htm
http://kurser.iha.dk/eit/embedded/Artikler/Gareau/Paging.pdf
http://www.delorie.com/djgpp/v2faq/faq24.html

or you are just missing the memory models thing like in tasm?
http://www.google.com/search?hl=en&q=+exe+memory+models+asm&meta=

or you whould like to store wav files in the exe?
you can do it easy, just copy wav file to the end of exe file, that should not bother anyone there.
Post 26 Nov 2005, 06:30
View user's profile Send private message Visit poster's website Reply with quote
peter_rk



Joined: 17 Apr 2005
Posts: 13
Location: somewhere in the world?
peter_rk 27 Nov 2005, 08:02
I know what I need. It's called segments, and they help extend program size past the conventional COM file size. I understand them now too.

Thank you for puting up with idiot me. Mr. Green

_________________
[insert witty remark here]
Post 27 Nov 2005, 08:02
View user's profile Send private message Visit poster's website Reply with quote
TDCNL



Joined: 25 Jan 2006
Posts: 56
TDCNL 11 Apr 2006, 14:23
Thought specifying segments under a COM source file was not possible because of the limited addressing in COM files? Correct me if I'm wrong please.

Or were you talking about EXE format only?

_________________
:: The Dutch Cracker ::
Post 11 Apr 2006, 14:23
View user's profile Send private message Reply with quote
casey



Joined: 18 Aug 2005
Posts: 35
casey 12 Apr 2006, 05:05
When I used to use DOS and found a COM file
too restricting in the memory department
I used wdosx.

http://tippach.business.t-online.de/wdosx/

Here is a NASM version which shows how I
loaded a mode 13h image (saved simply as
a 64000 byte file). 320 x 200 x 256 colors

I assume it can be translated to the FASM syntax??

;image6.asm
;
;HOW TO CREATE AN .EXE WITH THIS CODE
;
; >nasm -f rdf -o image6.exe image6.asm
; >stubit image6.exe
;
;NOTE the CUPS.GRA file must be placed
;in a folder called GRAPHICS in the
;C directory or the file string in this
;source code changed.
;

[section .text]
[bits 32]

GLOBAL _WdosxStart

_WdosxStart:
;screen mode 320 x 200, 256
mov ah,0
mov al,19
int 10h

call AllocateBuffer

call GreyPalette

call LoadImage

call Display

;wait for keypress
mov ah,7
int 21h

;screen text mode 80 x 25
mov ah,0
mov al,3
int 10h

call ReleaseBuffer

mov ax,4C00h ;exit to dos
int 21h
;--------------------------------------------
LoadImage:
;load image file into screen ram
mov edx,file
mov al,0 ;READ FILE
mov ah,3Dh ;OPEN FILE
int 21h
mov [handle],ax

mov bx,[handle]
mov cx,64000 ;bytes to read
mov edx,[screenmem] ;start of buffer
mov ah,3Fh ;READ FILE
int 21h

mov bx,[handle]
mov ah,3Eh ;CLOSE FILE
int 21h
ret

GreyPalette:
push edi
push eax
push ebx
push ecx

xor edi,edi
xor ecx,ecx
xor ebx,ebx
mov cl,192 ;first palette
Pal1:
call SetPalette
inc cl
inc bh ;red
inc bl ;green
inc ch ;blue
inc di ;counter
cmp di,64
jne Pal1
pop ecx
pop ebx
pop eax
pop edi
ret

SetPalette:
push edx
mov dx,3C6h ;palette_mask
mov al,0FFh ;mask to all colors
out dx,al ;OUT 3C6h,0FFh
mov dx,3C8h ;write palette
mov al,cl ;get number
out dx,al ;OUT 3C8h,number
mov dx,3C9h ;rgb values port
mov al,bh ;get red
out dx,al
mov al,bl ;get green
out dx,al
mov al,ch ;get blue
out dx,al
pop edx
ret

AllocateBuffer:
mov eax,64000 ;bytes to allocate
xor ebx,ebx ;clear ebx
xor ecx,ecx ;clear ecx
mov cx,ax ;low word of bytes in cx
shr eax,16
mov bx,ax ;high word of bytes in bx
mov ax,501h ;DPMI call 501h
int 31h ;make call
shl ebx,16 ;returns bx high word of memory
mov bx,cx ;cx is low word of memroy
mov [screenmem],ebx ;store memory location
mov ax,si ;si high word block handle
shl eax,16
mov ax,di ;di low word block handle
mov [screenmemhan],eax ;store block handle
ret

ReleaseBuffer:
xor esi,esi
xor edi,edi
mov eax,[screenmemhan]
mov di,ax
shr eax,16
mov si,ax
mov eax,502h
int 31h
ret

Display:
mov edi,0A0000h ;edi points to start of block
mov esi,[screenmem] ;point at screen ram
mov ecx,64000 ;number of bytes
Display2:
mov al,[ds:esi]
shr al,2 ;/4
or al,0C0h ;set upper 2 bits to 1
mov [ds:edi],al
inc edi
inc esi
dec ecx
jnz Display2
ret


ClearScreen:
mov edi,0A0000h ;start of screen
mov ecx,64000 ;number of bytes
more:
mov [ds:edi],BYTE 127
inc edi
dec ecx
jnz more
ret

[section .data]
screenmem dd 0
screenmemhan dd 0
handle dw 0


file db "C:\GRAPHICS\CUPS.GRA",0
Post 12 Apr 2006, 05:05
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.