Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- github
- python
- architecture
- DoM
- function
- html
- Algorithm
- Linux
- Java
- Class
- for
- web
- DS
- Pipelining
- mysql
- react
- DB
- while
- instruction
- control
- MIPS
- CSS
- XML
- system
- data structure
- javascript
- php
- DATAPATH
- computer
- MacOS
Archives
- Today
- Total
YYYEJI
[MacOS] MIPS assembly language 알아보기 본문
728x90
아래 코드를 가지고 설명하겠습니다.
✓ 코드를 작성할 땐 textEdit(메모장), visual Studio 등을 사용하시면 됩니다.
↓↓↓ C language code ↓↓↓
#include <stdio.h>
int main(){
printf("Hello World!!!\n");
return 0;
}
↓↓↓ Assembly language code ↓↓↓
# test.s
# print "Hello World!!!"
.data
str: .asciiz "\nHello, World!\n"
.text
main:
li $v0, 4
la $a0, str
syscall
li $v0, 10
syscall
pseudo assembly instruction
MIPS 언어에는 pseudo assembly instruction이 존재합니다.
(실제로 존재하지 않지만 사용하면 MIPS가 알아서 실행시켜 줍니다)
li $rs, immed
(Load immediate vlaue(immed) to s$rs)
la $rs, immed
(Load address(addr) to $rs)
data part
str. .asciiz "Heelo World!!!"
✓ str.은 변수라고 생각해도 좋고, 위치라고 생각해도 좋습니다.
✓ .asciiz는 "" doucle quote를 사용하겠다는 의미입니다.
syscall - System Call
✓ System call code에 따라 실행되는 결과가 달라집니다.
✓ 우리가 사용한 코드에서는 4를 사용했습니다.
✓ 위에 표를 보면 4는 print_string이기 때문에 .str을 출력해줍니다.
Breakpoint 란?
MIPS는 실행 후 에러가 뜬 부분에서 멈춰서 디버깅할 수 있게 해줍니다.
◡̈
'Computer architectures' 카테고리의 다른 글
[MIPS] Three MIPS Instruction Format (0) | 2022.10.10 |
---|---|
[MIPS] MIPS Instruction Summary (0) | 2022.10.10 |
[MacOS] QtSpim 사용하기 (0) | 2022.10.07 |
[MacOS] QtSpim 설치하기 (0) | 2022.10.07 |
[MIPS] Control Instruction (2) | 2022.09.25 |