Files
simpleasm/frontend/src/lib/levels/01.yaml

49 lines
1.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
id: 1
title: 认识寄存器
subtitle: 小机器人的记忆槽
description: 学习 MOV 指令给寄存器赋值
tutorial:
- title: 什么是寄存器?
text: >
CPU 是计算机的大脑,而**寄存器**是它手边的小抽屉 ——
速度最快的存储空间!我们的机器有 8 个寄存器:**R0** 到 **R7**。
- title: MOV 指令
text: >
`MOV` 把一个数字放进寄存器。注意数字前面要加 **#** 号,表示"这是一个数值"
code: |
MOV R0, #42 ; 把 42 放进 R0
MOV R1, #100 ; 把 100 放进 R1
- title: HLT 指令
text: >
程序最后要写 `HLT`halt = 停止),告诉机器"运行结束!"
code: |
MOV R0, #42
HLT
goal: 把数字 **42** 放进 **R0** 寄存器
initialState: {}
testCases:
- init: {}
expected:
registers:
R0: 42
hints:
- "MOV 的格式MOV 寄存器, #数字"
- "试试MOV R0, #???"
- "答案MOV R0, #42 然后 HLT"
starThresholds: [2, 3, 5]
starterCode: |
; 把 42 放进 R0 寄存器
; 提示:数字前面要加 # 号
HLT
showMemory: false