Monday, October 11, 2010

Microprocessor lab 2 (10 too erembeldeg programm)

Programm 1:
mvi c,0a
dcr c
Repeat:
mov d,c
lxi h,2100
Loop:
mov a,m
inx h
cmp m
jnc skip
mov b,m
mov m,a
dcx h
mov m,b
inx h
skip:
dcr d
jnz Loop
dcr c
jnz Repeat

call sub1
  
hlt

sub1: 
lxi h,2100
lxi d,2110
start:
mov a,m
stax d
inx h
inx d

mvi a, 0a
cmp l
jnc start
ret

Programm 2
mvi d,0a
ehlel:
    mvi c,0a
    lxi h,2100
start:
    dcr c
    jz end
    mov a,m
    inx h
    mov b,m
    cmp b
    jc start
    mov m,a
    push h
    dcx h
    mov m,b
    pop h
    jmp start
end:
    dcr d
    jz davt
    jmp ehlel
davt:
    lxi b,2110
    lxi d,0b
duus:
   
    dcr d
    jz aaa
    mov a,m
    stax b
    inx b
    dcx h   
    jmp duus
aaa:
    hlt

No comments:

Post a Comment