conout equ 02h ;character out boot equ 0 ;Restart bdos equ 05 ;entry point passes equ 08 ;# of passes to run acr equ 0dh ;carriage return alf equ 0ah ;line feed passcnt equ 1 port equ 4 ;*************************************************************** ;* ;* This program tests switchboard ports by executing OUT ;* instructions followed by IN instructions and comparing ;* data. ;* ;*************************************************************** org 100h start lxi sp,stack call errmsg ;Prints error bit pattern jmp boot errmsg lxi d,msg3 call pbuff call bitout lxi d,msg4 call pbuff call bitout ret bitout mvi b,8 ;bit counter bitlp push b rlc ;first bit jc one ;if on mvi c,conout mvi e,'0' ;if off call bdos ;Print character pop b dcr b ;decrement bit counter push b jnz bitlp ;next bit pop b ret one mvi e,'1' ;on bit mvi c,conout call bdos ;Print character pop b dcr b ;decrement bit counter push b jnz bitlp ;next bit pop b ret pbuff mvi c,9 jmp bdos rbuff mvi c,10 jmp bdos msg3 db acr,alf db 'Pass ' db passcnt db ' Port ' db port db ' should be $' msg4 db ' was $',acr,alf error ds 1 testpat db 0 db 0aah db 55h db 0cch db 66h db 33h db 99h db 0ffh ds 30 stack equ $ end