简体   繁体   English

将PEP / 8程序集伪操作转换为十六进制机器语言

[英]Translate PEP/8 assembly pseudo-ops to hexadecimal machine language

I'm reading the textbook Computer Systems 4th Edition . 我正在阅读《 计算机系统第四版 》教科书。 The question below is in the context of the Pep/8 virtual computer. 下面的问题是在Pep / 8虚拟计算机的上下文中。 In the exercises I am given this question: 在练习中,我被问到以下问题:

Convert the following assembly language pseudo-ops into hexadecimal machine language: 将以下汇编语言伪操作转换为十六进制机器语言:

  1. .ASCII "Bear\\x00" .ASCII“熊\\ x00”
  2. .BYTE 0xF8 .BYTE 0xF8
  3. .WORD 790 .WORD 790

I am trying to get these values converted to hex, but I cannot understand my textbook's explanation of the process, and I don't feel the book gives much of an explanation. 我试图将这些值转换为十六进制,但是我无法理解教科书对这一过程的解释,而且我不觉得这本书提供了太多解释。

For the first answer I think it is a simple lookup in an ASCII conversion table: 对于第一个答案,我认为这是在ASCII转换表中的简单查找:

42 65 61 72 00 42 65 61 72 00

The answers for this exercise are as follows: 此练习的答案如下:

  1. 42 65 61 72 00 42 65 61 72 00
  2. F8 F8
  3. 0316 0316

Despite knowing these answers I have no idea how to get the answers for 2 and 3 尽管知道这些答案,但我不知道如何获得2和3的答案

Here is the download link for the Pep/8 assembler and simulator. 这是Pep / 8汇编器和模拟器的下载链接 Here is the source code for the assembler. 这是汇编程序的源代码

So number 2... Is in hexadecimal form. 所以2 ...是十六进制形式。

you just need to change it to binary form with 8 bits 您只需要将其更改为8位二进制形式

For example.... 例如....

If you had 0xA7.... 如果您有0xA7 ...

In base ten this is 167 以10为基数的数字是167

The answer would be... In unsigned binary 10100111 答案将是...在无符号二进制10100111中

This is how interpreted the question, is this what you meant? 这是问题的解释方式,这是您的意思吗? Do you have anymore information? 您还有更多信息吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM