## page no 414
## example no 14.1
## INITIALIZE HYPOTHETICAL CHIP AS OUTPUT BUFFER
def hex2dec(s):
return int(s, 16)
def dec2bin(n):
return ''.join(str(1 & int(n) >> i) for i in range(8)[::-1])
print ('MVI A,01H \n')# ## Set D0=1, D1 through D7 are don't care lines.
a=hex2dec('1')#
b=dec2bin(a)#
print ('A--> ')
print (b)#
print('\n')
print ('OUT FFH \n')# ## write in the control register.
print ('MVI A,BYTE1 \n')# ## load data byte.
print ('OUT FEH')# ## send data out.
## page no 420
## example no 14.2
## ADDRESS DETERMINATION OF GIVEN FIGURE
print ('To select the chip: \n \n');
print ('A15 A14 A13 A12 A11 \n');
print ('0 0 1 0 0 \n \n');
print ('A15,A14 Enable lines of 8205 \n');
print ('A13,A12,A11 Input logic to activate the output line O4 of the 8205 \n \n');
print ('A15,A14,A13,A12,A11 = A7,A6,A5,A4,A3, = 20H \n \n');
print ('AD2 AD1 AD0 = Address Ports \n');
print (' 0 0 0 = 20H Control or status register \n');
print (' 0 0 1 = 21H Port A \n');
print (' 0 1 0 = 22H Port B \n');
print (' 0 1 1 = 23H Port C \n');
print (' 1 0 0 = 24H Timer LSB \n');
print (' 1 0 1 = 25H Timer MSB \n \n');
print ('Port numbers in given figure thus range from 20H-25H');