Personal Computer News


Amstrad Address Causes Confusion

Categories: Letter

 
Author: L. W. Cox
Published in Personal Computer News #093

Amstrad Address Causes Confusion

Q. You published an article which gave the address of the ROM routine SCR HW ROLL as &BC4D. This, it was claimed, is the same as decimal 50395. Please can you explain how on earth you get this? Every time I try PRINT &BC4D, my Amstrad displays - 17331. I am sure there must be many other readers who are as confused as I am.

L. W. Cox
Gravesend, Kent

A. Oops. That 50395 should have been 48205, but that doesn't answer your question. Basically, the Amstrad's print function doesn't work properly for numbers greater than 32767.

It deals with 16-bit signed integers and in this system the top bit (bit 15) is used to signify a negative number. Therefore a number over 32767 will be taken as negative because its MSB is set.

There are many ways to get your Amstrad to tell you the correct decimal equivalent of large hex numbers. The simplest is to add negative results to 65536, so 65536 + (-17331) gives 48205.

L. W. Cox