0% found this document useful (0 votes)
20 views1 page

Bubble

This program scans through a block of memory, incrementing each byte by 1. It uses registers H and D as counters, loads the first byte into C, then decrements C and loads the next byte into A each pass through the loop. It increments A by 1, stores it back, then moves to the next byte. This repeats until C reaches 0, then it checks if D is 1, and if so starts over at the beginning.

Uploaded by

rani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Bubble

This program scans through a block of memory, incrementing each byte by 1. It uses registers H and D as counters, loads the first byte into C, then decrements C and loads the next byte into A each pass through the loop. It increments A by 1, stores it back, then moves to the next byte. This repeats until C reaches 0, then it checks if D is 1, and if so starts over at the beginning.

Uploaded by

rani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

START: LXI H,2040H

MVI D, 00H
MOV C, M
DCR C
INX H
CHECK: MOV A, M
INX H
CMP M
JC NEXTBYTE
MOV B, M
MOV M, A
DCX H
MOV M, B
INX H
MVI D, 01H
NEXTBYTE: DCR C
JNZ CHECK
MOV A, D
CPI 01H
JZ START
HLT

You might also like