; make primary header mphdr: ; HL - where to store 6-byte header ; DE - source sequence count ; BC - packet length ; A - ApID less 0x700 push psw push b push d push h ; Byte 0 ; 3 bits of version number = 000, fixed ; 1 bit of type = 0, fixed ; 1 bit showing presence of secondary header = 1, fixed ; 3 bits which are the MSB's of the APID = 111, fixed ; (all ISUAL ApIDs are 7XX) mvi M,0Fh inx h ; Byte 1 ; 8 bits which are the LSB's of the APID. mov M,a inx h ; Byte 2 ; 2 bits = 11, fixed, which show that segmentation is not being used ; 6 bits which are the MSB's of the source sequence count (variable) mov a,d ; MSB of source seq count ani 03Fh ; mask to 14 bits ori 0C0h ; merge in '11' mov M,a inx h ; Byte 3 ; 8 bits which are the LSB's of the source sequence count (variable) mov M,e ; LSB of source seq count inx h ; Length of the Packet Data Field ; portion of the packet. ; The value includes the Secondary Header ; and the Trailer, minus 1. ; BC=Total_packet_length xchg lxi h,-7 ; deduct length of primary hdr +1 dad b ; Byte 4 ; 8 bits which are the MSB's of the data length xchg mov M,d inx h ; Byte 5 ; 8 bits which are the LSB's of the data length. mov M,e pop h pop d pop b pop psw ret