NASM Forum > Programming with NASM

A simple calculation goes wrong

(1/2) > >>

RuudB:
I'm busy creating a diagnostic ROM for the IBM-AT and compatibles. I'll need a 32 KB EPROM but I think I only need 16 KB for the actual code. So:

  org 8000h

  setloc 0C000h    ; macro that fills range between this address and last code with 0FFh

L_start:
   .....  code  ...

I want to calculate the checksum of the EPROM as part of the test. The number of bytes to test is 64 KB minus the starting address, thus:

  mov  cx,10000h-L_start

and here I get an error: invalid operand type. If I replace the minus with a plus, things go fine where I maybe would expect a kind of "number too big" error. Using "strict word" does not help.  I could calculate the checksum of the whole ROM as work around but I'm sure I will need the above calculation again. So I would like to know what is going on.

Thank you in advance for any help!

Kind regards, Ruud Baltissen

Frank Kotler:
Hi Ruud,

I am unable to duplicate the "invalid operand type" error. Double check what you're telling Nasm, including making sure your editor is outputting ascii.

I am seeing Nasm silently truncate 10000h without issuing the warning I would expect. Bug?

Best,
Frank

RuudB:
I was able to bring the source back to this bare minimum:


   org   08000h
L_start:
   mov   cx,10000h-L_start


FYI: I'm using NASM 2.11.08 from 2015.

Command: nasm.exe %1.asm -f bin -l %1.lst -o %1.bin

 I attached a printscreen of the DOS window.

Frank Kotler:
I am simply unable to duplicate this error. I'm using nasm-2.14.03rc2 - just upgraded to the latest version.

It looks to me like what you'd get if your editor were not producing ascii text. That's not only my best guess, it's my only guess... Wish I could help you more!

Best,
Frank

RuudB:
Hallo Frank,

I just upgraded to 2.14.02 and that one works fine. So it was indeed the version.
Thank you!

Kind regards, Ruud Baltissen

Navigation

[0] Message Index

[#] Next page

Go to full version