凡-32768从哪里来? [英] Where is -32768 coming from?

查看:323
本文介绍了凡-32768从哪里来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是LC3大会code我的工作以

This is LC3 Assembly code I am working with

.ORIG x3000
LOOP LDI R0, KBSR 
BRzp LOOP

LC3大会的,我知道, LDI为负载间接寻址方式,这意味着它在存储在一个位置的地址读取,然后读取在该位置的值

From LC3 Assembly, I know that LDI is a load indirect addressing mode, meaning it read in an address stored at an location and then read the value at that location

LC3键盘,我知道KBSR是键盘状态寄存器,一个当键盘已经收到了新的角色。

From Lc3 Keyboard, I know that KBSR is the keyboard status register, which is one when keyboard has received a new character.

下面是我的测试中LC3模拟器中运行?我输入的字符'A'

Here is my test run in Lc3 simulator? I entered the character 'a'

执行LDI R0后,KBSR,寄存器0商店-32768值。

After executing LDI R0, KBSR, register 0 stores a value of -32768.

有谁知道,基于了我的LDI和KBSR哪里这个数字是从哪里来的定义?我期待像1被存储,因为键盘已经获得了新的角色。

Does anyone know, based off my definitions for ldi and KBSR where this number is coming from? I was expecting something like 1 to be stored because the keyboard has received a new character.

推荐答案

在KBSR(键盘状态寄存器)位时,关键是看15集,让你获得 0b1000_0000_0000_0000 (或为0x8000 )...这 - PTED为2的补负数间$ p $ - 恰好是-32768小数

In KBSR (keyboard status register) bit 15 is set when a key is read, so you get 0b1000_0000_0000_0000 (or 0x8000) ... which - interpreted as a 2's complemented negative number - happens to be -32768 decimal.

这篇关于凡-32768从哪里来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆