I am just beginning to learn assembly language and would like to know if it is necessary to setup the paths in Vista like i would have had to do in Windows 95/98SE? By path I mean the locations of tams\bin... \inc.. ect.. I know where and how to do this in vista but am curious if it is necessary.. I will be using RADASM also if that helps thanks in advance. -JBP
Posted on 2007-09-12 18:54:50 by JBP
The need for, and use of, relative and environmental paths will most likely never change as they are the only sure way to specify *where* something is without too much complexity.

Personally, I still use simple batch files that have direct path declarations on Vista.

If you are talking about path configuration within something like RadASM, unless the paths are apart of the "PATH" environment variable, you need to properly set those paths up.
Posted on 2007-09-12 19:01:59 by SpooK
Thanks a lot. could you possibly send me the batch file for vista that you mentioned.. I would modify it for my system using TASM
Posted on 2007-09-12 19:10:07 by JBP
Hmm... I just use standard batch files.

Here is a condensed example that assumes NASM is in C:\nasm32\bin... apply the same concept for TASM or whatever...


@ECHO OFF
C:\nasm32\bin\nasm.exe -o test.obj test.asm


If you have spaces in your path, quote the string like so...


@ECHO OFF
"C:\Program Files\nasm32\bin\nasm.exe" -o test.obj test.asm


Use Google to find more info, as BATCH files are a thoroughly documented subject and you can find some great guides on the net.

HtH.
Posted on 2007-09-13 13:25:45 by SpooK
You could always do what I do, although it's not very popular and most people tend to gripe about it because it doesn't look very elagant in IDE's.. but I use notepad and batch files for development which lead me to using batch sources to save time, heres an example...

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; @echo off
; rem Project Information
; set project=oop_demo
; set version=0.1
; rem Path Information
; set BIN=\NASM32\Bin
; set LIB=\NASM32\Lib\Win32
; rem Development Tools
; set AS=nasm.exe
; set LD=polink.exe
; set RC=porc.exe
; rem Build Settings
; set subsystem=windows
; set libraries=kernel32.lib user32.lib
; set debug_mode=0
; set view_log=1
; rem Build Application
; goto assemble_source
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
; Copyright (c) 2007 Bryant Keller
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; 1. Redistributions of source code must retain the above copyright
;    notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
;    notice, this list of conditions and the following disclaimer in the
;    documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
; SUCH DAMAGE.
;
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%INCLUDE '\Nasm32\Inc\Win32\Windows.INC'
%INCLUDE '\Nasm32\Inc\Win32\Kernel32.INC'
%INCLUDE '\Nasm32\Inc\Win32\User32.INC'
%INCLUDE '\Nasm32\Inc\Nasm32.INC'
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
ENTRY Start
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
STRUC CTEST
._virt_func_table RESD 1
._virt_data_table RESD 1
.myDWord RESD 1
.myWord RESW 1
.myByte RESB 1
.myPadding RESB 1
ENDSTRUC
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%DEFINE CTEST_PTR_FUNC_TABLE CTEST_VT
%DEFINE CTEST_PTR_DATA_TABLE CTEST_DT

%DEFINE _index_MethodA 0
%DEFINE _index_MethodB 1
%DEFINE _index_MethodC 2

%DEFINE _index_vDataA 0
%DEFINE _index_vDataB 1
%DEFINE _index_vDataC 2

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
.DATA
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CTEST_vDataA DB "Hello, World!", 0
CTEST_vDataB DW 256
CTEST_vDataC TIMES 1024 DD 44434241h
DD 0

CTEST_VT DD CTEST_MethodA, CTEST_MethodB, CTEST_MethodC
CTEST_DT DD CTEST_vDataA, CTEST_vDataB, CTEST_vDataC

szTitle DB "Raw OOP Demo", 0
szMessage DB "This is global data copied into our virtual member!", 13, 10
DB "Interesting stuff isn't it!", 0
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
.CODE
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CTEST_INITIALIZATION:
%IFDEF CTEST_PTR_FUNC_TABLE
; Setup Virtual Function Table
mov DWORD , CTEST_PTR_FUNC_TABLE
%ENDIF

%IFDEF CTEST_PTR_DATA_TABLE
; Setup Virtual Data Table
mov DWORD , CTEST_PTR_DATA_TABLE
%ENDIF

mov EAX, ECX
ret

PROC CTEST_MethodA
push ECX
mov EAX,
push DWORD MB_OK
push DWORD
push DWORD
push DWORD NULL
INVOKE MessageBoxA
pop ECX
mov EAX, ECX
ret
ENDPROC

PROC CTEST_MethodB
.arg1 ARGD
push ECX
mov EAX,
mov WORD , 1024
xor EBX, EBX
mov BX, WORD
push EBX
push DWORD
INVOKE RtlZeroMemory
pop ECX
mov EAX, ECX
ret
ENDPROC

PROC CTEST_MethodC
.arg1 ARGD
.arg2 ARGD
LOCALS
LOCAL _vdt, DWORD
ENDLOCALS
push ECX
mov EAX,
mov VAR(_vdt), EAX
push DWORD ARGV(.arg1)
push DWORD
INVOKE lstrcpyA
mov EAX, VAR(_vdt)
push DWORD MB_OK
push DWORD ARGV(.arg2)
push DWORD
push DWORD NULL
INVOKE MessageBoxA
pop ECX
mov EAX, ECX
ret
ENDPROC

PROC Start
LOCALS
LOCAL pObj, CTEST
ENDLOCALS
lea ECX, VAR(pObj)
CALL CTEST_INITIALIZATION
mov EAX,
call DWORD
push 1024
mov EAX, .CTEST._virt_func_table
call DWORD
push OFFSET szTitle
push OFFSET szMessage
mov EAX, .CTEST._virt_func_table
call DWORD
xor EAX, EAX
push EAX
INVOKE ExitProcess
ret
ENDPROC
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; :assemble_source
; "%BIN%\%AS%" -f win32 "%project%.bat" -o "%project%.obj" >> "%project%.log"
;
; :compile_resource
; if not exist "%project%.rc" set RESFILE=
; if not exist "%project%.rc" goto link_objects
; set RESFILE="%project%.res"
; echo  Compiling: %project%.rc >> "%project%.log"
; "%BIN%\%RC%" /v /r "%project%.rc" >> "%project%.log"
;
; :link_objects
; if %debug_mode%==0 set LDDEBUG=/RELEASE /ENTRY:main /LIBPATH:"%LIB%"
; if %debug_mode%==1 set LDDEBUG=/DEBUG /DEBUGTYPE:CV /ENTRY:main /LIBPATH:"%LIB%" /INCREMENTAL:NO
; echo  Linking: %project%.obj >> "%project%.log"
; "%BIN%\%LD%" /nologo /SUBSYSTEM:%subsystem% /VERSION:%version% %LDDEBUG% %libraries% "%project%.obj" %RESFILE% >> "%project%.log"
;
; :cleanup_directory
; if exist "%project%.obj" del "%project%.obj"
; if exist "%project%.res" del "%project%.res"
; if %view_log%==1 type %project%.log
; if exist "%project%.log" del "%project%.log"
; if %view_log%==1 pause
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Assemblers ignore anything after comments while the command line will jump over your code due to the "goto" statement; the command line doesn't bother with the semi-colons. Honestly I do this out of sure laziness, I can't be arsed keeping up to date with the latest IDE's features and batch scripting doesn't change much, if any. I can build my source by double clicking the file and edit it by right clicking and selecting "Edit" from the dropdown menu. I can change from debug to release by modifing switches, or even change assemblers by changing a few settings. I can't remember when I started doing this.. probably around 2004 when I finished toying around with Dev-IDE's source-level debugger and threw it into oblivion with a bunch of other semi-unfinished code I have. :lol:

I like it, it works great, but if you decide to pass your code on to other people, you might want to strip the batch code out into a separate file otherwise people will complain about you writing "obfuscated" code. I get that all the time, that's why if you look on my projects page I always clean up my source to "pretty" MASM code.

Regards,
Bryant Keller

EDIT: Btw, in this NASM version there is no INC path set because NASM always has issues with searching for includes so I just do it manually in the source. In my MASM/PoASM/GoASM sources you would see an extra line between 'set BIN' and 'set LIB' for 'set INC' to set the base includes directory.
Posted on 2007-09-13 16:30:22 by Synfire
Very handy  8)
Posted on 2007-09-13 16:45:12 by LocoDelAssembly