first is 16bit DOS code
befor I use masm, and wannt to use nasm from now on.
I feel I can't write simple code use if/else do/while because I haven't read enough nasm code
hope some one show your code.

follow code is wrong, I don't know why, is someone know ?
if you can't see what's wrong, debug it! you will found !



segment data
BUF: db 45, 61, 70, 86, 75, 100, 69, 88, 81
n equ $ - BUF

RESULT: resb 2


segment stack
st resb 100


segment code
..start:
mov ax, stack
mov ss, ax
mov sp, 100

mov ax, data
mov ds, ax
mov cx, n
mov si, BUF
mov di, RESULT

mov ah, 0
mov bh, 0

.0:
mov al,
cmp al, 60
jb .1

inc ah
jmp .2

.1:
inc bh

.2:
inc si
dec cx
cmp cx, 0
jz .exit
jnz .0

mov , ah
mov , bh

.exit:
mov ax, 0x4c00
int 0x21




next is win32 code, it is right.
but i found the envionment variables is not work, why ?
nasm don't search envionment variables?
you can change directory in %include line

hope for your answer..
sorry for my poor english..


%include 'd:\nasmx\inc\nasmx.inc' ; change here
%include 'd:\nasmx\inc\win32\windows.inc'      ; change here
%include 'd:\nasmx\inc\win32\kernel32.inc'     ; change here
%include 'd:\nasmx\inc\win32\msvcrt.inc'    ;; change here


entry main

secction .text
proc main
invoke GetLogicalDrives
mov ebx ,eax


.count:
test ebx, 1
je .here
inc DWORD
mov eax,
add eax, 'A'
invoke printf, szDriver, eax

.here:
shr ebx, 1
jne .count


invoke printf, szMsg,
invoke ExitProcess, 0
endproc



section .data
szDriver: db '%c:', 0xa, 0
szMsg: db 'there are %d driver(s)', 0
DiskCount: dd 1

Posted on 2009-01-11 21:27:30 by mnzn2530

GetLogicDriver.exe: GetLogicDriver.obj
golink /console /entry _main GetLogicDriver.obj kernel32.dll  msvcrt.dll

GetLogicDriver.obj: GetLogicDriver.asm
nasm GetLogicDriver.asm -o GetLogicDriver.obj -fwin32

.PHONY:clean
clean:
del *.obj *.exe


here is makefile for win32
Posted on 2009-01-11 21:29:10 by mnzn2530
You can supply directories to include at the command line (-I), or include relative files from within the source, as is standard.
Posted on 2009-01-14 20:58:02 by SpooK