Author Topic: Im getting an error?  (Read 14004 times)

Offline andreadixon825

  • Jr. Member
  • *
  • Posts: 3
Im getting an error?
« on: June 05, 2014, 01:58:16 AM »
Hi, I have a bat file and in it is like this.

Code: [Select]
@echo off
echo Build script for Windows
echo.

echo Assembling bootloader...
cd source\bootload
nasm -O0 -f bin -o bootload.bin bootload.asm
cd ..

echo Assembling TestOS kernel...
nasm -O0 -f bin -o kernel.bin kernel.asm

echo Assembling programs...
cd ..\programs
 for %%i in (*.asm) do nasm -O0 -fbin %%i
 for %%i in (*.bin) do del %%i
 for %%i in (*.) do ren %%i %%i.bin
cd ..

echo Adding bootsector to disk image...
cd disk_images
partcopy ..\source\bootload\bootload.bin 0 200 testos.flp 0
cd ..

echo Mounting disk image...
imdisk -a -f disk_images\testos.flp -s 1440K -m B:

echo Copying kernel and applications to disk image...
copy source\kernel.bin b:\
copy programs\*.bin b:\
copy programs\sample.pcx b:\
copy programs\*.bas b:\

echo Dismounting disk image...
imdisk -D -m B:

echo Done!
pause


this is the error i get.
'nasm' is not recognized as an internal or external command,
operable program or batch file.

Please help me. thanks

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Im getting an error?
« Reply #1 on: June 05, 2014, 04:38:33 AM »
Hi andreadixon825,

It sounds as if Nasm (nasm.exe) is not on your path. I can't imagine why - surely this sophisticated batch file is not the first time you've used Nasm - but that's what it sounds like. It's been a while... I probably don't remember the correct syntax, but something like:
Code: [Select]
set PATH=$PATH$;Q\where\I\put\nasm
with drive and path replaced with the correct values, of course. Test it by typing just "nasm" or "nasm -v" or "nasm -h" or something. Possibly RTFM would help:
http://www.nasm.us/xdoc/2.11.05/html/nasmdoc1.html#section-1.3.1

I don't think it's part of your problem, but I'm curious why you're giving Nasm "-O0". You want bloated code? Just let Nasm optimize, it won't hurt ya. There might be an exception to this. A canonical bootsector starts with "jmp" near, or "jmp short"/"nop" over your BPB. If you haven't got the "nop" in there, Nasm's emitting a short "jmp" (which it will) without the "nop" might screw you up on a particularly picky BIOS. I've never encountered this, but I have heard of it (long time ago!). I doubt if you'll encounter such a BIOS. Nobody writes a canonical bootsector these days anyway...

I could be completely off base with this, but I can;t think of anything else that would generate that error. Get back to us if you have further trouble.

Best,
Frank


Offline andreadixon825

  • Jr. Member
  • *
  • Posts: 3
Re: Im getting an error?
« Reply #2 on: June 05, 2014, 04:16:17 PM »
Hi, thanks for your replay. I have used NASM before but I'm not new to FASM they are almost the same but Iv never done this with nasm before by making a bat file, all I want to do is test my os with mikeos and use the bat file but that bat file dose not work, I have a meeting to day at 3:00 pm so I want be on my pc till the meeting is over, I'm going to try to see whats wrong with it and do further testing, but what I have done and this method dose not work ether. I copied nasm.exe and placed it in the folder where all the sources code is, and I ran it by right click and administrator, because I'm using windows 8.1 and VirtualBox. I even downloaded PARTCOPY.EXE and put that in there and still says the same error but with less nasm error. All I'm trying to do is compile of mikeos to see how it works and stuff, because I'm using fasm as my project but would like to use nasm. I like both, but I'm just trying new things.
Thanks

Andrea Dixon

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Im getting an error?
« Reply #3 on: June 06, 2014, 04:27:37 AM »
Yeah, Fasm is a nice assembler. It's frustrating that the syntax is almost the same, but not quite (rb vs resb for example). I think Mike Gonta once wrote some code that would assemble with either, but generally they won't quite assemble each other's code. Shouldn't be too hard to become "multilingual" between those two - compared to AT&T or something.

Anyway, putting Nasm in the directory with the source and then running a batch file which changes directories may be your problem. Better to put Nasm in some directory and then make that directory part of your PATH environment variable. I said "set" nut that's probably obsolete. The Friendly Manual says:

"The only file NASM needs to run is its own executable, so copy nasm.exe to a directory on your PATH, or alternatively edit autoexec.bat to add the nasm directory to your PATH (to do that under Windows XP, go to Start > Control Panel > System > Advanced > Environment Variables; these instructions may work under other versions of Windows as well.)"

What I used to do is have a directory (I called it \cmd - wasn't too bad a name at the time, not so good now) in which I put miscellaneous batch files and executables that I wanted to be able to run from anywhere, and put that on the path, rather than adding a zillion directories to the path. You might want to do the same with PARTCOPY.exe, if you do that. Heck, throw 'em in the same directory with Fasm. Fasm won't mind. One way or another, get 'em on the path so you don't have to run them from some particular directory, and your problems should diminish. If you still can't assemble MikeOS, get back to us.

Best,
Frank


Offline andreadixon825

  • Jr. Member
  • *
  • Posts: 3
Re: Im getting an error?
« Reply #4 on: June 07, 2014, 12:48:59 AM »
Hi, I got it all working but one part here is what cmd says.

Code: [Select]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Program Files\nasm>buildwin
Build script for Windows

Assembling bootloader...
Assembling MikeOS kernel...
Assembling programs...
Adding bootsector to disk image...
Mounting disk image...
Creating device...
Created device 1: D: -> disk_images\mikeos.flp
Notifying applications...
Done.
Copying kernel and applications to disk image...
        1 file(s) copied.
programs\edit.bin
programs\fileman.bin
programs\hangman.bin
programs\keyboard.bin
programs\monitor.bin
programs\serial.bin
programs\viewer.bin
        7 file(s) copied.
        1 file(s) copied.
programs\advnture.bas
programs\calc.bas
programs\draw.bas
programs\example.bas
programs\mbpp.bas
programs\memedit.bas
programs\muncher.bas
        7 file(s) copied.
Dismounting disk image...
Flushing file buffers...
Locking volume...
Failed, forcing dismount... <----- This what dose this mean?
Removing device...
Removing mountpoint...
Done.
Done!

C:\PROGRA~1\nasm>

And here is my bat file.

Code: [Select]
@echo off
echo Build script for Windows
echo.

echo Assembling bootloader...
nasm -O0 -f bin -o bootload.bin bootload.asm

echo Assembling MikeOS kernel...
nasm -O0 -f bin -o kernel.bin kernel.asm

echo Assembling programs...
cd programs
 for %%i in (*.asm) do nasm -O0 -fbin %%i
 for %%i in (*.bin) do del %%i
 for %%i in (*.) do ren %%i %%i.bin
cd..

echo Adding bootsector to disk image...
cd disk_images
partcopy ..\bootload.bin 0 200 mikeos.flp 0
cd..

echo Mounting disk image...
imdisk -a -f disk_images\mikeos.flp -s 1440K -m d:

echo Copying kernel and applications to disk image...
copy kernel.bin d:\
copy programs\*.bin d:\
copy programs\sample.pcx d:\
copy programs\*.bas d:\

echo Dismounting disk image...
imdisk -D -m d:

echo Done!
« Last Edit: June 07, 2014, 12:50:54 AM by andreadixon825 »