OpenBoot 2.x Command Reference Manual

Changing the Number Base

You can change the operating number base using the commands in Table 4-11.

Table 4-11 Changing the Number Base

Command  

Stack Diagram 

Description 

.d

( n -- ) 

Display n in decimal without changing base.

.h

( n -- ) 

Display n in hex without changing base.

base

( -- addr ) 

Variable containing number base. 

decimal

( -- ) 

Set the number base to 10. 

d# number

( -- n ) 

Interpret number in decimal; base is unchanged.

hex

( -- ) 

Set the number base to 16. 

h# number

( -- n ) 

Interpret number in hex; base is unchanged.

octal

( -- ) 

Set the number base to 16. 

o# number

( -- n ) 

Interpret number in hex; base is unchanged.

The d# , h# and o# commands are useful when you want to input a specific number in another base without explicitly changing the current base. For example:


ok decimal       (Changes base to decimal)
ok 4 h# ff 17 2
4 255 17 2 ok 

The .d and .h commands act like "." but display the value in decimal or hexadecimal, respectively, regardless of the current base setting. For example:


ok hex
ok ff .  ff .d
ff 255