execuse me, when i assembler my code, it appears
LINK32 : error LNK2001: unresolved external symbol _mainCRTStartup
file.exe : fatal error LNK1120 : 1 unresolved externals
what does it mean?
Boon,
It usually means your code has no entry point. Show us the basics of you code and we will be able to help you.
hutch,
already can compile but when run the exe file it will stop working...i think may be cause by the macro i made..why?
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc ; always first
include \masm32\macros\macros.asm ; MASM support macros
; -----------------------------------------------------------------
; include files that have MASM format prototypes for function calls
; -----------------------------------------------------------------
include \masm32\include\masm32.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\winmm.inc ; multimedia for music playback
include \masm32\include\msvcrt.inc
; ------------------------------------------------
; Library files that have definitions for function
; exports and tested reliable prebuilt code.
; ------------------------------------------------
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\winmm.lib ; multimedia for music playback
includelib \masm32\lib\msvcrt.lib
.data
cr equ 13
lf equ 10
middle_c db "middle c.wav",0
d db "d.wav",0
e db "e.wav",0
f db "f.wav",0
g db "g.wav",0
a db "a.wav",0
b db "b.wav",0
high_c db "high c.wav",0
;input_key db ?
setcolor macro line,from,to,color
pushad
mov ah, 06h ; clear the DOS screen
mov al, line
mov cx, from
mov dx, to
mov bh, color
int 10h
popad
endm
.code
start:
setcolor 03h,09h,0,11110001b
inkey
exit
end start
OK,
The problem is you cannot run 16 bit interrupts in 32 bit mode. In 32 bit mode you use the Windows API functions. Now there IS a line drawing function in the API functions but you need to create a window first so you can draw on its client area.
emm...sound complicated..by the way in masm32 is there any macro same functions as my created "setcolor" macro in my code above? can you please directed me to it?
Yes there is but you must create a window first, you cannot set the video mode of a full screen like you did in DOS and draw in graphics mode to it, you must create a window and draw on its client area.
The Windows APIs you are after is MoveToEx() and LineTo() but they can only be learnt in the context of a GUI Window. At an even higher level there is DirectDraw() but that is more complicated again.
I think you need to learn some basic Windows architecture first. Good luck.
ok..thanks hutch..i think i try to do in another way
oh ya...1 more question..what is the difference between call and invoke? can i use call as invoke and vice versa?
Nope, TASM used to use CALL in the same way as invoke but basically CALL is an Intel mnemonic that is used to call a single address. The INVOKE operator automates the PUSH/CALL sequence for a function call.
Attached a hyper color pixel and black line drawing program using a DialogBox.
It is a modified version of code MichaelW posted in the Campus, like colored TV snow.
Setting the color for a pixel is straightforward, it is a parameter on SetPixelV.
I didn't find a method to change the color on LineTo.
Also the last of the dialog parameters and it's proper value is a mystery.
Dialog "Colored Pixels & Black Lines", \
"FixedSys", 11, \
WS_VISIBLE or WS_OVERLAPPEDWINDOW or \
DS_CENTER, \
0, \
0,0,512,376, \
1024
I had to severely limit the number of lines drawn per pixel color
or it would have nearly instantly filled the screen with black.
It only draws lines on the last 24 iterations of drawing pixels
with a particular color.
[attachment deleted by admin]
After searching the MASM32 forums and the Win32 help file,
I've found an answer to setting the LineTo color.
invoke nrandom, 1 SHL 24 ; 24 bit for color
mov edi, eax
invoke CreatePen, PS_SOLID, 0, edi ; step 1 of 2 to set pen ( LineTo ) color, edi has the color value
mov hpen, eax
invoke SelectObject, hdc, hpen ; step 2 of 2
mov ebx, 1
mov esi, 1
invoke MoveToEx, hdc, ebx, esi, NULL ; set FROM x, y for later LineTo
add ebx, 10
add esi, 10
invoke LineTo, hdc, ebx, esi ; draw line in current pen color TO x, y
invoke DeleteObject, hpen ; later get rid of pen