Source program :
- LDA 2200H
- MOV C, A : Initialize count
- MVI B, 00 : Negative number = 0
- LXI H, 2201H : Initialize pointer
- BACK: MOV A, M : Get the number
- ANI 80H : Check for MSB
- JZ SKIP : If MSB = 1
- INR B : Increment negative number count
- SKIP: INX H : Increment pointer
- DCR C : Decrement count
- JNZ BACK : If count 0 repeat
- MOV A, B
- STA 2300H : Store the result
- HLT : Terminate program execution
|
Flowchart for program
|
0 Comments