Báo cáo project Môn Thực hành Kiến trúc máy tính Viết một chương trình sử dụng MIPS để vẽ một quả bóng di chuyển trên màn hình mô phỏng Bitmap của Mars). Nếu đối tượng đập vào cạnh của màn hình thì sẽ di chuyển theo chiều ngược lại.

14 149 0
Báo cáo project Môn Thực hành Kiến trúc máy tính Viết một chương trình sử dụng MIPS để vẽ một quả bóng di chuyển trên màn hình mô phỏng Bitmap của Mars). Nếu đối tượng đập vào cạnh của màn hình thì sẽ di chuyển theo chiều ngược lại.

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Báo cáo project Môn Thực hành Kiến trúc máy tính Mã lớp 122032 Sinh viên Hoàng Trọng Nghiên 20184167 Mai Văn Linh 20184132 Vũ Minh Long 20184144 Nguyễn Việt Tùng 20184225 Phân công công việc Mai Văn L.\ Đề bài: Viết một chương trình sử dụng MIPS để vẽ một quả bóng di chuyển trên màn hình mô phỏng Bitmap của Mars). Nếu đối tượng đập vào cạnh của màn hình thì sẽ di chuyển theo chiều ngược lại. Yêu cầu: Thiết lập màn hình ở kích thước 512x512. Kích thước pixel 1x1. Quả bóng là một đường tròn. Chiều di chuyển phụ thuộc vào phím người dùng bấm, gồm có (di chuyển lên (W), di chuyển xuống (S), Sang trái (A), Sang phải (D) trong bộ giả lập Keyboard and Display MMIO Simulator). Tốc độ bóng di chuyển là không đổi. Vị trí bóng ban đầu ở giữa màn

Báo cáo project Mơn Thực hành Kiến trúc máy tính Mã lớp: 122032 Sinh viên: Hoàng Trọng Nghiên - 20184167 Mai Văn Linh - 20184132 Vũ Minh Long - 20184144 Nguyễn Việt Tùng - 20184225 Phân công công việc Mai Văn Linh Nguyễn Việt Tùng: Bài Hoàng Trọng Nghiên Vũ Minh Long: Bài 10 Bài 2: Đề bài: Viết chương trình sử dụng MIPS để vẽ bóng di chuyển hình mơ Bitmap Mars) Nếu đối tượng đập vào cạnh hình di chuyển theo chiều ngược lại u cầu: - Thiết lập hình kích thước 512x512 Kích thước pixel 1x1 - Quả bóng đường trịn Chiều di chuyển phụ thuộc vào phím người dùng bấm, gồm có (di chuyển lên (W), di chuyển xuống (S), Sang trái (A), Sang phải (D) giả lập Keyboard and Display MMIO Simulator) Tốc độ bóng di chuyển khơng đổi Vị trí bóng ban đầu hình I Phân tích cách làm II Mã nguồn Biến khởi tạo data right frameBuffer: xVel: word yVel: word xPos: word yPos: word tail: word circleUp: word circleDown: word circleLeft: word circleRight: xConversion: bitmap display yConversion: bitmap display space 0x100000 # 512 wide x 512 high pixels # x velocity start 0 # y velocity start 256 # x position 256 # y position # location of rail on bit map display 0x0000ff00 # green pixel for when snaking moving up 0x0100ff00 # green pixel for when snaking moving down 0x0200ff00 # green pixel for when snaking moving left word 0x0300ff00 # green pixel for when snaking moving word 512 # x value for converting xPos to word # y value for converting (x, y) to Vẽ border text main: # draw border la $t0, frameBuffer # li $t1, 512 # li $t2, 0xFF4500 drawBorderTop: sw $t2, 0($t0) # addi $t0, $t0, # addi $t1, $t1, -1 bnez $t1, drawBorderTop # Bottom wall section load frame buffer addres save 512*512 pixels # load light gray color color go to # # Pixel black next pixel decrease pixel count repeat unitl pixel count == la addi addi $t0, frameBuffer # load frame buffer addres $t0, $t0, 1046528 # set pixel to be near the bottom left $t1, $zero, 512 # t1 = 512 length of row drawBorderBot: sw $t2, 0($t0) # color Pixel black addi $t0, $t0, # go to next pixel addi $t1, $t1, -1 # decrease pixel count bnez $t1, drawBorderBot # repeat unitl pixel count == # left wall section la $t0, frameBuffer addi $t1, $zero, 511 # t1 = 512 length of col drawBorderLeft: sw $t2, addi $t0, addi $t1, bnez $t1, 0($t0) # color Pixel black $t0, 2048 # go to next pixel $t1, -1 # decrease pixel count drawBorderLeft # repeat unitl pixel count == # Right wall section la $t0, frameBuffer addi $t0, $t0, 2044 addi $t1, $zero, 511 drawBorderRight: sw $t2, addi $t0, addi $t1, bnez $t1, # load frame buffer address # make starting pixel top right # t1 = 512 length of col 0($t0) # color $t0, 2048 # $t1, -1 # drawBorderRight # Pixel black go to next pixel decrease pixel count repeat unitl pixel count == Nhận input từ Keyboard gameUpdateLoop: lw $t3, 0xffff0004 # get keypress from keyboard input ### Sleep for 66 ms so frame rate is about 15 addi $v0, $zero, 32 # syscall sleep addi $a0, $zero, 66 # 66 ms syscall beq beq beq beq moveDown beq moveUp: lw add jal $t3, $t3, $t3, $t3, 100, moveRight # if key press = 'd' branch to moveright 97, moveLeft # else if key press = 'a' branch to moveLeft 119, moveUp # if key press = 'w' branch to moveUp 115, moveDown # else if key press = 's' branch to $t3, 0, moveUp $s3, circleUp $a0, $s3, $zero updatecircle # start game moving up # s3 = direction of circle # a0 = direction of circle # move the circle jal updateCirclePosition j moveDown: lw add jal exitMoving $s3, circleDown $a0, $s3, $zero updatecircle # s3 = direction of circle # a0 = direction of circle # move the circle jal updateCirclePosition j moveLeft: lw add jal exitMoving $s3, circleLeft $a0, $s3, $zero updatecircle # s3 = direction of circle # a0 = direction of circle # move the circle jal updateCirclePosition j moveRight: lw add jal exitMoving $s3, circleRight $a0, $s3, $zero updatecircle # s3 = direction of circle # a0 = direction of circle # move the circle jal updateCirclePosition j exitMoving exitMoving: j gameUpdateLoop # loop back to beginning Vẽ hình trịn di chuyển hình trịn # updatecircle: get position center circle -> Velocity -> check -? print # getNextPosUp: ******************************************************* # getNextPosDown *************************************************** # getNextPosLeft *************************************************** # getNextPosRight *************************************************** # updatecircle: addiu $sp, $sp, -24 # allocate 24 bytes for stack sw $fp, 0($sp) # store caller's frame pointer sw $ra, 4($sp) # store caller's return address addiu $fp, $sp, 20 # setup updatecircle frame pointer ### DRAW HEAD lw $t0, xPos lw $t1, yPos lw $t2, xConversion mult $t1, $t2 mflo $t3 add $t3, $t3, $t0 lw $t2, yConversion mult $t3, $t2 mflo $t0 la $a1, tail sw $t0,0($a1) tren # # # # # # # # # t0 = xPos of circle t1 = yPos of circle t2 = 512 yPos * 512 t3 = yPos * 64 t3 = yPos * 64 + xPos t2 = (yPos * 64 + xPos) * t0 = (yPos * 64 + xPos) * la add li li beq $t1, $t0, $t5, $t6, $a0, frameBuffer # load frame buffer address $t1, $t0 # t0 = (yPos * 64 + xPos) * + frame address 31 0x00FFFF00 # t6 - yellow 0x0000ff00, getNextPosUp # xem huong di de doi chieu neu la canh beq beq beq $a0, 0x0100ff00, getNextPosDown $a0, 0x0200ff00, getNextPosLeft $a0, 0x0300ff00, getNextPosRight getNextPosUp: addi $t7, $t0, -32768 # o 16 phia tren lw $t8 ,0($t7) # lay mau beq $t8, 0xFF4500, swapVelocityUp # dung mau thi doi huong j loop # in binh thuong getNextPosDown: addi $t7, $t0, 30720 # o 16 phia duoi lw $t8 ,0($t7) # lay mau beq $t8, 0xFF4500, swapVelocityDown # dung mau thi doi huong j loop # in binh thuong getNextPosLeft: addi $t7, $t0, -64 lw $t8 ,0($t7) beq $t8, 0xFF4500, swapVelocityLeft j loop getNextPosRight: addi $t7, $t0, 64 lw $t8 ,0($t7) beq $t8, 0xFF4500, swapVelocityRight j loop #star print circle loop: lw $t0, xPos # t0 = xPos of circle lw $t1, yPos # t1 = yPos of circle addi $t2,$t0,-15 # ban kinh bang 15 addi $t3,$t1,-15 addi $t4,$t1,15 li $t5,31 # t5 = 15+15+1 circle: sub $t7,$t2,$t0 # t7 = toa diem tru toa tam theo x mul $t7,$t7,$t7 # binh phuong sub $t8,$t3,$t1 # giong t7 nhung la theo y mul $t8,$t8,$t8 add $t9,$t7,$t8 # x^2 + y^2 addi $t9,$t9,-225 # - R^2 bltzal $t9,circle15 # so sanh vo neu nho hon thi chuyen den buoc tiep theo addi $t2,$t2,1 # tang x va lap lai addi $t5, $t5, -1 beqz $t5, reset bnez $t5, circle reset: # tang li addi addi beq j circle15: ban kinh 14 addi bgezal addi addi j print: lw mult mflo add lw mult mflo la add sw addi addi j sleep: y len dua x ve gia tri ban dau $t5,31 $t2,$t2,-31 $t3,$t3,1 $t3,$t4,sleep circle # neu da nam vong tron 15 thi can theo dieu kien nam ngoai duong tron $t9,$t9,29 # 29 = 15^2-14^2 $t9,print # thoa man thi in khong thi quay lai lap $t2,$t2,1 $t5, $t5, -1 circle $t7, xConversion $t3, $t7 $s3 $s3, $s3, $t2 $s4, yConversion $s3, $s4 $s5 $s6, frameBuffer $s5, $s5, $s6 $t6,0($s5) $t2,$t2,1 $t5, $t5, -1 circle # # # # # # # # # t7 = 512 yPos * 512 s3 = yPos * 64 s3 = yPos * 64 + xPos s4 = (yPos * 64 + xPos) * s5 = (yPos * 64 + xPos) * load frame buffer address s5 = (yPos * 64 + xPos) * + frame address move $a1 , $a0 addi $v0, $zero, 32 addi $a0, $zero, 400 syscall # syscall sleep # 400 ms #end print circle move $a0 , $a1 ### Set Velocity lw $t2, circleUp beq $a0, $t2, setVelocityUp branch to setVelocityUp # load word circle up = 0x0000ff00 # if head direction and color == circle up lw $t2, circleDown # load word circle down = 0x0100ff00 beq $a0, $t2, setVelocityDown # if head direction and color == circle down branch to setVelocityUp lw $t2, circleLeft # load word circle left = 0x0200ff00 beq $a0, $t2, setVelocityLeft # if head direction and color == circle left branch to setVelocityUp lw $t2, circleRight # load word circle right = 0x0300ff00 beq $a0, $t2, setVelocityRight # if head direction and color == circle right branch to setVelocityUp setVelocityUp: addi $t5, $zero, # set x velocity to zero addi $t6, $zero, -20 # set y velocity to -1 sw $t5, xVel # update xVel in memory sw $t6, yVel # update yVel in memory j removeCirle # xoa di de them moi setVelocityDown: addi $t5, $zero, addi $t6, $zero, 20 sw $t5, xVel sw $t6, yVel j removeCirle # # # # set x velocity set y velocity update xVel in update yVel in to zero to memory memory setVelocityLeft: addi $t5, $zero, -20 addi $t6, $zero, sw $t5, xVel sw $t6, yVel j removeCirle # # # # set x velocity set y velocity update xVel in update yVel in to -1 to zero memory memory setVelocityRight: addi $t5, $zero, 20 addi $t6, $zero, sw $t5, xVel sw $t6, yVel j removeCirle # # # # set x velocity set y velocity update xVel in update yVel in to to zero memory memory swapVelocityUp: # neu gap canh thi doi chieu li $t3, 0xffff0004 # dia chi cua keyboard li $t4, 115 # s sw $t4,0($t3) # luu lai j moveDown # if head direction and color == circle down branch to setVelocityUp swapVelocityDown: # tuong tu li $t3, 0xffff0004 li $t4, 119 sw $t4,0($t3) j moveUp # if head direction and color == circle down branch to setVelocityUp swapVelocityLeft: li $t3, 0xffff0004 li $t4, 100 sw $t4,0($t3) j moveRight # if head direction and color == circle down branch to setVelocityUp swapVelocityRight: li $t3, 0xffff0004 li $t4, 97 sw $t4,0($t3) j moveLeft setVelocityUp removeCirle: li li lw lw addi addi addi circle_r: sub mul sub mul add addi bltzal addi addi beqz bnez reset_r: li addi addi beq j circle15_r: addi bgezal addi addi j print_r: lw mult mflo add lw mult mflo la add sw addi addi j # if head direction and color == circle down branch to #xoa di de them moi $t5, 31 $t6, 0x00000000 $t0, xPos # t0 = $t1, yPos # t1 = $t2,$t0,-15 $t3,$t1,-15 $t4,$t1,15 # xoa giong in chi khac la thay bang mau blaclk # t6 - black xPos of circle yPos of circle $t7,$t2,$t0 $t7,$t7,$t7 $t8,$t3,$t1 $t8,$t8,$t8 $t9,$t7,$t8 $t9,$t9,-225 $t9,circle15_r $t2,$t2,1 $t5, $t5, -1 $t5, reset_r $t5, circle_r $t5,31 $t2,$t2,-31 $t3,$t3,1 $t3,$t4,sleep_r circle_r $t9,$t9, 29 # 15 binh phuong tru 14 binh phuong $t9,print_r $t2,$t2,1 $t5, $t5, -1 circle_r $t7, xConversion $t3, $t7 $s3 $s3, $s3, $t2 $s4, yConversion $s3, $s4 $s5 $s6, frameBuffer $s5, $s5, $s6 $t6,0($s5) $t2,$t2,1 $t5, $t5, -1 circle_r # # # # # # # # # t2 = 512 yPos * 512 t3 = yPos * 64 t3 = yPos * 64 + xPos t2 = (yPos * 64 + xPos) * t0 = (yPos * 64 + xPos) * load frame buffer address t0 = (yPos * 64 + xPos) * + frame address sleep_r: move $a1 , $a0 addi $v0, $zero, 32 # syscall sleep addi $a0, $zero, # 1000 ms syscall move $a0 , $a1 ### update new Tail lw $t5, circleUp beq $t5, $a0, setNextTailUp branch to setNextTailUp lw beq # load word circle up = 0x0000ff00 # if tail direction and color == circle up $t5, circleDown # load word circle down = 0x0100ff00 $t5, $a0, setNextTailDown # if tail direction and color == circle down branch to setNextTailDown lw $t5, circleLeft # load word circle left = 0x0200ff00 beq $t5, $a0, setNextTailLeft # if tail direction and color == circle left branch to setNextTailLeft lw $t5, circleRight # load word circle right = 0x0300ff00 beq $t5, $a0, setNextTailRight # if tail direction and color == circle right branch to setNextTailRight setNextTailUp: la $t0,tail addi $t0, $t0, -2048 sw $t0, tail j exitUpdatecircle # tail = tail - 2048 # store tail in memory setNextTailDown: la $t0,tail addi $t0, $t0, 2048 sw $t0, tail j exitUpdatecircle # tail = tail + 2048 # store tail in memory setNextTailLeft: la $t0,tail addi $t0, $t0, -4 sw $t0, tail j exitUpdatecircle # tail = tail - # store tail in memory setNextTailRight: la $t0,tail addi $t0, $t0, sw $t0, tail j exitUpdatecircle # tail = tail + # store tail in memory exitUpdatecircle: lw $ra, 4($sp) # lw $fp, 0($sp) # addiu $sp, $sp, 24 # jr $ra # updateCirclePosition: addiu $sp, $sp, -24 # sw $fp, 0($sp) # sw $ra, 4($sp) # addiu $fp, $sp, 20 # III lw lw lw lw add add sw sw $t3, $t4, $t5, $t6, $t5, $t6, $t5, $t6, lw lw addiu jr $ra, 4($sp) $fp, 0($sp) $sp, $sp, 24 $ra load caller's return address restores caller's frame pointer restores caller's stack pointer return to caller's code allocate 24 bytes for stack store caller's frame pointer store caller's return address setup updatecircle frame pointer xVel # load xVel from memory yVel # load yVel from memory xPos # load xPos from memory yPos # load yPos from memory $t5, $t3 # update x pos $t6, $t4 # update y pos xPos # store updated xpos back to memory yPos # store updated ypos back to memory # # # # load caller's return address restores caller's frame pointer restores caller's stack pointer return to caller's code Kết chạy mô Bài 10: Đề bài: Sử dụng ngoại vi bàn phím led để xây dựng máy tính bỏ túi đơn giản Hỗ trợ phép toán +, -, *, / Do bàn phím khơng có phím nên dùng phím - Bấm phím a để nhập phép tính + - Bấm phím b để nhập phép tính – - Bấm phím c để nhập phép tính * - Bấm phím d để nhập phép tính / - Bấm phím f để nhập phép = Yêu cầu cụ thể sau: - Khi nhấn phím số, hiển thị lên LED, có LED nên thị số cuối Ví dụ nhấn phím  thị 01 Khi nhấn thêm phím  hiển thị 12 Khi nhấn thêm phím  hiển thị 23 - Sau nhập số, nhập phép tính + - * / - Sau nhấn phím f (dấu =) , tính tốn hiển thị kết lên LED I Phân tích cách làm II Mã nguồn Biến khởi tạo data Message: eqv eqv eqv eqv asciiz "Loi chia cho 0" IN_ADRESS_HEXA_KEYBOARD 0xFFFF0012 OUT_ADRESS_HEXA_KEYBOARD 0xFFFF0014 SEVENSEG_RIGHT 0xFFFF0010 # dia chi den LED doan phai SEVENSEG_LEFT 0xFFFF0011 # dia chi den LED doan trai Chạy polling text main: li li li li li li $t1, $t2, $t3, $t4, $t5, $t6, IN_ADRESS_HEXA_KEYBOARD OUT_ADRESS_HEXA_KEYBOARD 0x08 # duyet hang 0x01 # duyet hang 0x02 # duyet hang 0x04 # duyet hang c,d,e,f 0,1,2,3 4,5,6,7 8,9,a,b li $s0, 0x3f # Ma hien thi hang don vi li $a1, 0x3f # Ma hien thi hang chuc polling: sb $t3, 0($t1) # Quet hang c,d,e,f lbu $t0, 0($t2) # $t0 = ma phim quet duoc $t0=0 neu ko co phim nao dc an bnez $t0, switch_button nop sb $t4, 0($t1 ) lbu $t0, 0($t2) bnez $t0, switch_button nop sb $t5, 0($t1 ) lbu $t0, 0($t2) bnez $t0, switch_button nop sb $t6, 0($t1 ) lbu $t0, 0($t2) switch_button: beq $t0, 0x00, free beq $t0, 0x11, case_0 beq $t0, 0x21, case_1 beq $t0, 0x41, case_2 beq $t0, 0x81, case_3 beq $t0, 0x12, case_4 beq $t0, 0x22, case_5 beq $t0, 0x42, case_6 beq $t0, 0x82, case_7 beq $t0, 0x14, case_8 beq $t0, 0x24, case_9 beq $t0, 0x44, case_a beq $t0, 0x84, case_b beq $t0, 0x18, case_c beq $t0, 0x28, case_d beq $t0, 0x88, case_f nop case_0: li $a0, 0x3f li $s2, j process_button case_1: li $a0, 0x06 li $s2, j process_button case_2: li $a0, 0x5B li $s2, j process_button case_3: li $a0, 0x4f li $s2, j process_button case_4: li $a0, 0x66 li $s2, j process_button case_5: li $a0, 0x6D li $s2, j process_button case_6: li $a0, 0x7d li $s2, j process_button case_7: li $a0, 0x07 li $s2, j process_button case_8: li $a0, 0x7f li $s2, j process_button # Quet hang 0,1,2,3 # Quet hang 4,5,6,7 # Quet hang 8,9,a,b # # # # # # # # # # # # # # # # Ko An An An An An An An An An An An An An An An an phím phím phím phím phím phím phím phím phím phím phím phím a phím b phím c phím d phím f # $a0 = ma hien thi so # $s2 = gia tri phim dc an # $a0 = ma hien thi so # $a0 = ma hien thi so # $a0 = ma hien thi so case_9: li $a0, 0x6f li $s2, j process_button case_a: li $t7, '+' j do_math case_b: li $t7, '-' j do_math case_c: li $t7, '*' j do_math case_d: li $t7, '/' j do_math case_f: j result # $t7 = phep tinh cong # Xu ly phep tinh # Phep tru # Phep nhân # Phep chia # Neu an dau = free: move $a0, $s0 # Chuyen Ma phim ve lai $a0 li $s1, # Dat den bao = 0, phim da duoc tha j show_number # Chuyen den phan hien thi process_button: bnez $s1, show_number # Kiem tra trang thai cua phim move $a1, $s0 # Chuyen ma hien thi sang hang chuc bnez $s4, second_number # Neu la toan hang thu chuyen den xu ly toan hang mul $s3, $s3, 10 # Xu ly toan hang add $s3, $s3, $s2 # $s3 luu gia tri so hang thu nhat j print_int second_number: mul $s5, $s5, 10 # Xu ly toan hang add $s5, $s5, $s2 # $s5 luu gia tri so hang thu print_int: move $a0, $s2 li $v0, syscall j is_old do_math: li $a0, 0x3f li $a1, 0x3f bnez $s1, is_old move $a0, $t7 li $v0, 11 syscall li $s2, li $s4, is_old: li $s1, # In so vua nhan console # Dat lai ma hien thi so # Kiem tra co phim moi duoc bam chua # Hien thi phep tinh len man hinh console # $s2 = (Dat gia tri phim bam hien tai ve 0) # $s4 = 1, Xu ly Toan hang thu # $s1 = : Chua co phim moi duoc bam show_number: move $s0, $a0 # Luu ma hien thi hang don vi jal SHOW_LED_RIGHT jal SHOW_LED_LEFT delay: li $a0, 100 # sleep 100ms li $v0, 32 syscall nop back_to_polling: j polling result: li $v0, 11 li $a0, '=' syscall # Hien thi dau = add: sub: mul: div: beq beq beq beq $t7, $t7, $t7, $t7, '+', '-', '*', '/', add sub mul div # # # # Thuc Thuc Thuc Thuc hien hien hien hien phep phep phep phep cong tru nhan chia add $a0, $s3, $s5 j show_result sub $a0, $s3, $s5 j show_result mul $a0, $s3, $s5 j show_result beq $s5, , print_message div $a0, $s3, $s5 show_result: li $v0, syscall div $s7, $a0, 10 mfhi $t0 jal DATA_FOR_LED move $s0, $a0 div $s7, $s7, 10 mfhi $t0 jal DATA_FOR_LED move $a1, $a0 # Neu chia cho thi bao loi jal SHOW_LED_RIGHT jal SHOW_LED_LEFT li $v0, 10 syscall # In ket qua console # $s7 = $a0 / 10 # so du = hang don vi # gia tri hang don vi > ma hien thi cua LED # $s0 = ma hien thi hang don vi # $s7 = $s7 / 10 # so du = hang chuc # gia tri hang chuc > ma hien thi cua LED # $a1 = ma hien thi hang chuc # hien thi LED phai # hien thi LED trai # Ket thuc chuong trinh Hiển thị LED SHOW_LED_RIGHT: sb $s0, SEVENSEG_RIGHT # assign new value jr $ra SHOW_LED_LEFT: sb $a1, SEVENSEG_LEFT # assign new value jr $ra DATA_FOR_LED: beq $t0, 0, setNumber0 beq $t0, 1, setNumber1 beq $t0, 2, setNumber2 beq $t0, 3, setNumber3 beq $t0, 4, setNumber4 beq $t0, 5, setNumber5 beq $t0, 6, setNumber6 beq $t0, 7, setNumber7 beq $t0, 8, setNumber8 beq $t0, 9, setNumber9 nop setNumber0: li $a0, 0x3f j END F setNumber1: li $a0, 0x06 j END F setNumber2: li $a0, 0x5B j END F setNumber3: li $a0, 0x4f j END F setNumber4: li $a0, 0x66 j END F setNumber5: li $a0, 0x6D j END F setNumber6: li $a0, 0x7d j END F setNumber7: li $a0, 0x07 j END F setNumber8: li $a0, 0x7f j END F setNumber9: li $a0, 0x6f j END F END F: jr $ra Ngoại lệ # Trong truong hop so chia = print_message: li $v0, la $a0, Message syscall li $v0, 10 syscall III Kết chạy mô ...Bài 2: Đề bài: Viết chương trình sử dụng MIPS để vẽ bóng di chuyển hình mơ Bitmap Mars) Nếu đối tượng đập vào cạnh hình di chuyển theo chiều ngược lại Yêu cầu: - Thiết lập hình kích thước 512x512... addi addi addi circle_r: sub mul sub mul add addi bltzal addi addi beqz bnez reset_r: li addi addi beq j circle15_r: addi bgezal addi addi j print_r: lw mult mflo add lw mult mflo la add sw addi... pixel 1x1 - Quả bóng đường trịn Chiều di chuyển phụ thuộc vào phím người dùng bấm, gồm có (di chuyển lên (W), di chuyển xuống (S), Sang trái (A), Sang phải (D) giả lập Keyboard and Display MMIO

Ngày đăng: 27/02/2023, 20:08