标志寄存器_访问标志寄存器,并与寄存器B |交换标志寄存器F的内容 8085微处理器...

标志寄存器

Problem statement:

问题陈述:

Write an assembly language program in 8085 microprocessor to access Flag register and exchange the content of flag register F with register B.

在8085微处理器中编写汇编语言程序以访问标志寄存器,并与寄存器B交换标志寄存器F的内容。

Assumptions: Initial values of flag register, register B and stack pointer are 00, 3F, and 3FFF respectively.

假设:标志寄存器,寄存器B和堆栈指针的初始值分别为00、3F和3FFF。

PSW stands for PROGRAM STATUS WORD. PSW combines accumulator A and flag register F.

PSW代表程序状态字。 PSW将累加器A和标志寄存器F组合在一起。

Algorithm:

算法:

  1. Push the value of PSW in memory stack by help of PUSH instruction

    通过PUSH指令将PSW的值压入存储器堆栈

  2. Pop the value of Flag register and store it in register H by help of POP instruction

    弹出标志寄存器的值,并借助POP指令将其存储在寄存器H中

  3. Move the value of register H in register C

    将寄存器H的值移到寄存器C中

  4. Move the value of register B in register H

    将寄存器B的值移到寄存器H中

  5. Move the value of register C in register B

    将寄存器C的值移到寄存器B中

  6. Push the value of register H in memory stack by help of PUSH instruction

    通过PUSH指令将寄存器H的值压入存储器堆栈

  7. Pop the value of PSW from memory stack using POP instruction

    使用POP指令从存储器堆栈中弹出PSW的值

Program:

程序:

ADDRESSMNEMONICSCOMMENTS
2000PUSH PSWPush value of accumulator and flag in stack
2001POP HPop value from TOP of memory stack in H
2002MOV C, HC ← H
2003MOV H, BH ← B
2004MOV B, CB ← C
2005PUSH HPush the value of register H
2006POP PSWPop value of flag register and Accumulator
2007HLTEND
地址 记忆 注释
2000 推PSW 将累加器的值和标志压入堆栈
2001 POP H 从H中的内存堆栈的TOP弹出值
2002年 MOV C,H C←H
2003年 MOV H,B H←B
2004年 MOV B,C B←C
2005年 推H 推送寄存器H的值
2006年 POP PSW 标志寄存器和累加器的弹出值
2007年 HLT 结束

Explanation – Registers used A, B, C, H, F

说明–使用的寄存器A,B,C,H,F

  1. PUSH PSW instruction performs the following task:

    PUSH PSW指令执行以下任务:

    • SP ← SP - 1
    • M[SP] ← A
    • SP ← SP - 1
    • M[SP] ← F
  2. POP H instruction performs the following task:

    POP H指令执行以下任务:

    • H ← M[SP]
    • SP ← SP + 1
  3. MOV C, H – moves the value of H in register C

    MOV C,H –将H的值移动到寄存器C中

  4. MOV H, B – moves the value of B in register H, hence H is updated

    MOV H,B –移动寄存器H中B的值,因此H被更新

  5. MOV B, C – moves the value of C in register B, hence B is updated

    MOV B,C –移动寄存器B中C的值,因此B被更新

  6. PUSH H performs the following task:

    PUSH H执行以下任务:

    • SP ← SP - 1
    • M[SP] ← H
  7. POP PSW performs the following task:

    POP PSW执行以下任务:

    • F ← M[SP]
    • SP ← SP + 1
    • A ← M[SP]
    • SP ← SP + 1
  8. HLT – stops executing the program and halts any further execution

    HLT –停止执行程序,并停止任何进一步的执行

翻译自: https://www.includehelp.com/embedded-system/access-flag-register-and-exchange-the-content-of-flag-register-f-with-register-b-using-8085-microprocessor.aspx

标志寄存器

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值