FOJ 1024 Simple Computer
来源:互联网 发布:r读取sas数据 编辑:程序博客网 时间:2024/05/20 18:03
搞了一个早上,代码有点搓。。。。
由于判断while退出的条件是HLT,而我却画蛇添足加了个PC>32的条件。
导致了几次的Wrong Answer
其实题目很简单,就是实现一些简单的运算罢了,主要还是对题目的理解。
下面是指令的翻译
000xxxxx STA x 把运算器的值存入内存x store the value of the accu into memory byte x
001xxxxx LDA x 从内存地址x载入值到运算器load the value of memory byte x into the accu
010xxxxx BEQ x 如果运算器的值为0,那么载入内存地址x到运算器if the value of the accu is 0 load the value x into the pc
011----- NOP 空操作 no operation
100----- DEC 运算器减1 subtract 1 from the accu
101----- INC 运算器加1 add 1 to the accu
110xxxxx JMP x 载入内存地址到 pc load the value x into the pc
111----- HLT 结束程序 terminate program
学过组成原理的同学都知道,x86机器内存中数据的存放是小顶机模型,也就是lower-to-higher
但是这道题目不同,是higher-to-lower.这个要注意。
另外加个比较good一些的代码。
这代码主要通过移位运算来做。比我那个字符串处理的简单多了。。。
- FOJ 1024 Simple Computer
- FOJ 1350 Very Simple Problem
- 【FOJ 1350】 Very Simple Problem
- foj 1350 Very Simple Problem
- ZOJ1098-Simple Computer
- FOJ Problem 2218 Simple String Problem
- FOJ Problem 2218 Simple String Problem
- Simple Computer Security: Disinfect Your PC
- A Simple Introduction To Computer Networking
- computer
- computer
- computer
- computer
- computer
- Simple Computer Transfer and Backup: Don't Lose your Music and Photos
- FOJ月赛被虐
- FOJ 1036
- foj 1689
- [收集]Visual C#中调用Windows API
- GreaseMonkey过的Google
- Head First C# 中文版 第13章 控件和图形 page567
- 一道c++题
- strcat函数原形
- FOJ 1024 Simple Computer
- 迭代法
- 转载暴强贴:从.NET平台调用Win32 API
- 怎么样把“显示桌面”按钮找回来
- 关于alarm函数
- 最新版迅雷定时器下载2009-7-19
- 大公司的Java面试题集(关于Java中的注意事项)
- 防采集的有效方法
- interview