Jump to content

Anyone know what's wrong with my program?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
It doesn't even output anything to the screen, for some reason.

.386 

.model flat, stdcall 

option casemap:none 

include \RS\include\ifiles.inc 

.data 

.data? 

string1                           DB  512 dup (?) 

i1                                DWORD ? 

i2                                DWORD ? 

i3                                DWORD ? 

i4                                DWORD ? 

hFile                             DWORD ? 

.code 

start: 


push ebp 

mov ebp, esp 

sub esp, 4 


push dword ptr string("Enter the bitmap filename: ", 13, 10) 

call StdOut 


push dword ptr 512 

push dword ptr offset string1 

call StdIn 


push dword ptr 2 

push dword ptr space(SIZEOF OFSTRUCT) 

push dword ptr offset string1 

call OpenFile 

cmp eax, 0 

jz no_file 

mov dword ptr [hFile], eax 


push dword ptr string("Enter the X coordinate for the pixel to get: ", 13, 10) 

call StdOut 


push dword ptr 512 

push dword ptr offset string1 

call StdIn 


push dword ptr offset string1 

call str2i 

mov dword ptr [i1], eax 


push dword ptr string("Enter the Y coordinate for the pixel to get: ", 13, 10) 

call StdOut 


push dword ptr 512 

push dword ptr offset string1 

call StdIn 


push dword ptr offset string1 

call str2i 

mov dword ptr [i2], eax 


push dword ptr [i2] 

push dword ptr [i1] 

push dword ptr [hFile] 

call get_pixel 

mov dword ptr [i3], eax 


push dword ptr string("Red= ") 

call StdOut 

mov eax, dword ptr [i3] 

mov bl, al 

xor eax, eax 

mov al, bl 

push dword ptr offset string1 

push eax 

call i2str 

push eax 

call StdOut 

push dword ptr string(13, 10) 

call StdOut 


push dword ptr string("Green= ") 

call StdOut 

mov eax, dword ptr [i3] 

mov bl, ah 

xor eax, eax 

mov al, bl 

push dword ptr offset string1 

push eax 

call i2str 

push eax 

call StdOut 

push dword ptr string(13, 10) 

call StdOut 


push dword ptr string("Blue= ") 

call StdOut 

mov eax, dword ptr [i3] 

shr eax, 16 

push dword ptr offset string1 

push eax 

call i2str 

push eax 

call StdOut 

push dword ptr string(13, 10) 

call StdOut 


push dword ptr [hFile] 

call CloseHandle 


jmp finish1 


no_file: 

	push dword ptr string("The file could not be opened. ", 13, 10) 

	call StdOut 

	

	jmp finish1 

finish1: 


mov esp, ebp 

pop ebp 


ret 


include bmp_px.asm 


end start 


#2
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
Oh, I get it. I was building it the wrong way. I forgot to build it for console, not for windows.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users