Resource centre for ZX Spectrum games
      using Manic Miner and Jet Set Willy game engines

 

Archive of the

Manic Miner & Jet Set Willy Yahoo! Group

messages

 

 

 

Message: 5487

Author: andrewbroad

Date: 11/02/2006

Subject: How best to represent hexadecimal?

 

I'm trying to decide on a convention for representing hexadecimal
literals, which I will then use consistently on my website, in
SPECSAISIE, and in any more assembly-code that I publish
(hexadecimal is probably better than denary, because it's consistent
with all the existing disassemblies except mine, as well as being a
more logical radix than denary).

The possibilities I'm considering include:

(a) &DE. I like the idea of having a one-character non-alphanumeric
symbol as a prefix, as long as there's no ambiguity with the use of
& as the bitwise-AND operator. Unfortunately if you type &DE on a
command-line, it strips off the & unless you type "&DE".

(b) $DE (as in Pascal) or #DE (as in HTML). I don't find these
as 'hexy' as &DE, but they do have the advantages of not being
confused with operators, and of being able to type them on a command-
line without "". Unfortunately some assemblers use $ to mean the
current value of the location-counter.

(c) 0xDE (as in C and Java, which use & for bitwise-AND). Easily
recognisable as a number, but a bit long-winded. This is the only
hex-notation that SPECSAISIE Disassemble currently recognises in its
command-line arguments. But I certainly wouldn't want to use it on
my website.

(d) DE in contexts where hexadecimal is the default radix (as
SPECSAISIE Disassemble -h does now). But this could also mean the 16-
bit register DE, or even a variable. Such cases have to be
disambiguated as 0DE, which makes it less clear that it is a single
byte.

(e) DEh (as seen in assemblers, along with 222t for denary,
11011110y for binary and 336o for octal). But this is long-winded,
and again could be misinterpreted as a variable-name unless written
as 0DEh - yuck!

(f) DE_16 (_ represents that 16 is a subscript). Too long-winded.

(g) Hex DE. May be useful in informal contexts, such as telling one
what to type into JSWED's hex-editor, e.g. I might write:

>>>
The three POKEs to bypass Jet Set Willy's colour-code protection:
POKE 34480,195: POKE 34481,202: POKE 34482,135 (Hex 86B0: C3 CA 87)
<<<
or I might even write:
>>>
The room-data are stored from 49152 to 65535 (Hex C000 to FFFF).
<<<
This obviates the need to prefix each hex-literal individually, and
makes each literal as short as possible.

I'll probably use (g) on my website, and get SPECSAISIE to recognise
a variety of hex-notations as input. But it'll probably be too
fiddly for me to bother implementing command-line flags to control
which hex-notation to output, so I must meditate on the best option
for disassemblies...

-----------------
128K memory-banks
-----------------

My hex-notation will also have to interact with my bank-notation
(when I implement SPECSAISIE's model of 128K memory).

e.g. John Elliott wrote "C300h in bank 3"

3:C300h

&3:C300 }
3:&C300 } ditto re. $ and #

Ox3:C300
3:0xC300

Hex 3:C300

Hex 5:86B0: C3 CA 87
(5: is unnecessary in this example, but you get the idea of how
messy it could become)

Bank 5: Hex 86B0: C3 CA 87

--
Dr. Andrew Broad
http://geocities.com/andrewbroad/
http://geocities.com/andrewbroad/spectrum/
http://geocities.com/andrewbroad/spectrum/willy/

 

 

arrowleft
arrowright