File: mlGraphicSis sor Author: # # Date: mm/dd/yyyy # Purpose Use AND of bits to make decisions; see mlGraphicsSissor.pptx # #. #Write a MIPS determine if parts of lines are in a display window #RESULT (***NOTE: BINARY [codes] will be 32-bits, leading 0’s*** # (1,1)-(1, 5) # (3,2)- (5,4) # (0,0)-(7,7) –> [0110]]&[1001] = [0000] # (1,3)- (4, 3) –> [0010]&[O000] = [0000] .data -> [0010]& [0010] = [0010] .-> [0000]&[0000] = [0000] no yes yes yes #word , byte, character eqv .eqv eqv .eqv .eqv .eqv .eqv .eqv SYS_PRINT WORD SYS_PRINT_FLOAT SYS_PRINT_DOUBLE SYS_PRINT TEXT SYS_INPUT_WORD SYS_INPUT F LOAT 1 #float 2 #double #text (zero terminated) #input word #input float #print binary #terminate 3 4 6 SYS_PRINT BIN SYS_EXIT 35 10 # declare variab les SIZE UP .eqv .eqv eqv .eqv .eqv pts: 16 # display window sides # (1,2) to (6,5) 5 DOWN 1 LEFT RIGHT .byte .byte .byte .byte 6 1,1, 1,5, 3,2, 5,4, 0,0, 7,7, 1,3, 4,3 end_pts: openParen .asciiz “(” .asciiz “, ” .asciiz “)-(“. .asciiz “) –> [” .asciiz “]&[” .asciiz “] = [” .asciiz “] .asciiz “1 .asciiz comma: parenCntr: arrow: braceCntr: equal yes” yes: no: no endl: “n” .text .globl main main: # # Main loop # # s0 = pts[] la la $s0, pts $s7, end_pts # s7 = end_pts loop1 # print numbers “(x0, y1)- (x2, y3) –> ” la $a0, openParen $v0, SYS_PRINT_TEXT li syscall lbu $ao, 0($s0) $v0, SYS_PRINT_WORD # x0 li syscall la $a0, commа $v0, SYS_PRINT_TEXT li syscall lbu li $a0, 1($s0) $v0, SYS_PRINT_WORD # y1 syscall # call locCode () to get 1st point code for (x0,y1) in s1 # print the 1st s1 code # print divider betwe en codes # call locCode ( ) to get 2nd point code for (x2,y3) in s2 # print the 2nd s2 code # print divider # AND s1 & s2 codes to s3 and print it # print yes if s3 is zero, else print no syscall prt # print end l la li $a0, endl $v0, SYS_PRINT_TEXT syscall # end of main loop # terminate exit li $v0, SYS_EXIT syscall # locCode) input # create 4-bit code $a0 = x $a1 = y # output: $v0 = code [UP DOWN LEFT RIGHT] # # locCode: #.end main Show transcribed image text File: mlGraphicSis sor Author: # # Date: mm/dd/yyyy # Purpose Use AND of bits to make decisions; see mlGraphicsSissor.pptx # #. #Write a MIPS determine if parts of lines are in a display window #RESULT (***NOTE: BINARY [codes] will be 32-bits, leading 0’s*** # (1,1)-(1, 5) # (3,2)- (5,4) # (0,0)-(7,7) –> [0110]]&[1001] = [0000] # (1,3)- (4, 3) –> [0010]&[O000] = [0000] .data -> [0010]& [0010] = [0010] .-> [0000]&[0000] = [0000] no yes yes yes #word , byte, character eqv .eqv eqv .eqv .eqv .eqv .eqv .eqv SYS_PRINT WORD SYS_PRINT_FLOAT SYS_PRINT_DOUBLE SYS_PRINT TEXT SYS_INPUT_WORD SYS_INPUT F LOAT 1 #float 2 #double #text (zero terminated) #input word #input float #print binary #terminate 3 4 6 SYS_PRINT BIN SYS_EXIT 35 10 # declare variab les SIZE UP .eqv .eqv eqv .eqv .eqv pts: 16 # display window sides # (1,2) to (6,5) 5 DOWN 1 LEFT RIGHT .byte .byte .byte .byte 6 1,1, 1,5, 3,2, 5,4, 0,0, 7,7, 1,3, 4,3 end_pts: openParen .asciiz “(” .asciiz “, ” .asciiz “)-(“. .asciiz “) –> [” .asciiz “]&[” .asciiz “] = [” .asciiz “] .asciiz “1 .asciiz comma: parenCntr: arrow: braceCntr: equal yes” yes: no: no endl: “n” .text .globl main main: # # Main loop # # s0 = pts[] la la $s0, pts $s7, end_pts # s7 = end_pts loop1 # print numbers “(x0, y1)- (x2, y3) –> ” la $a0, openParen $v0, SYS_PRINT_TEXT li syscall lbu $ao, 0($s0) $v0, SYS_PRINT_WORD # x0 li syscall
la $a0, commа $v0, SYS_PRINT_TEXT li syscall lbu li $a0, 1($s0) $v0, SYS_PRINT_WORD # y1 syscall # call locCode () to get 1st point code for (x0,y1) in s1 # print the 1st s1 code # print divider betwe en codes # call locCode ( ) to get 2nd point code for (x2,y3) in s2 # print the 2nd s2 code # print divider # AND s1 & s2 codes to s3 and print it # print yes if s3 is zero, else print no syscall prt # print end l la li $a0, endl $v0, SYS_PRINT_TEXT syscall # end of main loop # terminate exit li $v0, SYS_EXIT syscall # locCode) input # create 4-bit code $a0 = x $a1 = y # output: $v0 = code [UP DOWN LEFT RIGHT] # # locCode: #.end main
Expert Answer
Answer to File: mlGraphicSis sor Author: # # Date: mm/dd/yyyy # Purpose Use AND of bits to make decisions; see mlGraphicsSissor.pp…