I need to write a programe executable in DOS to control a hardware, a 12-bit analog-to-digital converter card using C++. I've the manual about this card and the procedures to develop the programe is given. However, i have many uncertainties about the procedures. Would any one help to solve them.

Here I show briefy the manual as below(deails of manual refer to attachment 128-bit.zip):
The I/O port address are &h278-27F or &H2F8-2FF selectable.
&H278 / 2F8 : Output A/D channel number. (low nibble).
279 / 2F9 : Input A/D low byte data. (8 bits).
27A / 2FA : Input A/D high byte data.
27B / 2FB : Clear A/D register.
27C / 2FC : A/D conversion loop. (low)
27D / 2FD : A/D conversion loop (high)
27E / 2FE : Output D/A low byte data. (8 bits)
27F / 2FF : Output D/A high byte data. (low nibble).

Analog to digital (A/D) procedure:
(1) Output channel number to port

OUT port channel

(2) Clear register

OUT (port + 3), 0

(3) Start convert
FOR I=1 to 5
A = INP (port + 4)
NEXT I=1 TO 9
A = INP (port + 5)
NEXT I

(4) Read high byte (low nibble)
C = INP (port + 2)
HB = (C/16 ¡V INT (C/16)) * 16

(5) READ LOW BYTE (8 BITS)
LB = INP (port + 1)

(6) Data:
A/D = HB * 256 + LB

My questions are:
1. In procedure (3), it seems that there should be two for-loop, one inside another, is there a typing error in the guideline. And if it is so, why should it take a total 45 times 'INP'. What's the purpose of that?

2. In procedure(4), to my understanding, INP(port +2) return the high byte from a 12-bit data. So, why shouldn't I directly multiply it by 256 to shift it by 8 bits higher like that is done in
procedure(6)? what's the use of that?

3. I've writen my own programe and compiled it using Turbo C++ 3, but some unexpected result usually obtained. I use "inp()" to get the HOB and LOB, but the HOB is always equal to 255 while the LOB results in range from 0- 194. Why is it so? Pls give comments on my programe (128-bit.zip)

Any help is apprepicate! Thanks