18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

310 System programm<strong>in</strong>g<br />

which when run on an MSDOS system with none of these keys set would pr<strong>in</strong>t:<br />

Insert mode not set<br />

Caps lock not set<br />

Number lock not set<br />

Note:<br />

21.3 Self-assessment<br />

For this to work, the generated code must be able to access these low locations <strong>in</strong> DOS.<br />

• Us<strong>in</strong>g a representation clause, the follow<strong>in</strong>g enumeration for Country def<strong>in</strong>es the IDC(International<br />

Diall<strong>in</strong>g Code) for a small selection of countries.<br />

type Country is (USA, France, UK, Australia);<br />

for Country'Size use Integer'Size;<br />

for Country use (USA=> 1, France=> 33,<br />

UK=> 44, Australia=> 61);<br />

What do the follow<strong>in</strong>g deliver?<br />

(a) Country'Pos( USA )<br />

(b) Country'Val( 2 ).<br />

• How can the IDC of France be extracted from the enumeration for France?<br />

• As Canada has the same IDC as the USA, how can an enumeration for Canada be <strong>in</strong>cluded <strong>in</strong> the list<br />

of countries above?<br />

• How can the variable Cost be declared so that its address maps on to the byte at absolute location<br />

040 <strong>in</strong> programs address space?<br />

21.4 Exercises<br />

Construct the follow<strong>in</strong>g:<br />

• Memory dump<br />

A program which pr<strong>in</strong>ts <strong>in</strong> hexadecimal the contents of the bottom 100 locations of the current program.<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!