Deprecated: Return type of WP_Theme::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php on line 554

Deprecated: Return type of WP_Theme::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php on line 595

Deprecated: Return type of WP_Theme::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php on line 535

Deprecated: Return type of WP_Theme::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php on line 544

Deprecated: Return type of WP_REST_Request::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-request.php on line 952

Deprecated: Return type of WP_REST_Request::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-request.php on line 972

Deprecated: Return type of WP_REST_Request::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-request.php on line 984

Deprecated: Return type of WP_REST_Request::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-request.php on line 995

Deprecated: Return type of WP_Block_List::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 151

Deprecated: Return type of WP_Block_List::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 175

Deprecated: Return type of WP_Block_List::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 164

Deprecated: Return type of WP_Block_List::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 186

Deprecated: Return type of WP_Block_List::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 138

Deprecated: Return type of WP_Block_List::offsetExists($index) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 75

Deprecated: Return type of WP_Block_List::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 89

Deprecated: Return type of WP_Block_List::offsetSet($index, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 110

Deprecated: Return type of WP_Block_List::offsetUnset($index) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 127

Deprecated: Return type of WP_Block_List::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home1/smartva9/public_html/smartvania/wp-includes/class-wp-block-list.php on line 199

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home1/smartva9/public_html/smartvania/wp-includes/class-wp.php on line 173

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637

Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home1/smartva9/public_html/smartvania/wp-includes/wp-db.php on line 3031

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637

Warning: Cannot modify header information - headers already sent by (output started at /home1/smartva9/public_html/smartvania/wp-includes/class-wp-theme.php:9) in /home1/smartva9/public_html/smartvania/wp-includes/rest-api/class-wp-rest-server.php on line 1637
{"id":1554,"date":"2017-08-27T04:04:45","date_gmt":"2017-08-27T04:04:45","guid":{"rendered":"http:\/\/smartvania.com\/?p=1554"},"modified":"2017-08-27T04:08:20","modified_gmt":"2017-08-27T04:08:20","slug":"code-request-2","status":"publish","type":"post","link":"https:\/\/smartvania.com\/code-request-2\/","title":{"rendered":"Code Request"},"content":{"rendered":"

I was watching your videos on youtube about assembly, but I have many doubts… I have an exercise to do until next Sunday, and I don’t know how to do it!
\nThe steps are:<\/p>\n

A) Send the message: “Enter your registration number”;
\nB) Receive 9 numeric digits corresponding to a registration number;
\nC) If the registration is all zero, and the program (call the system with the exit operation)
\nD) Search in the registrations stored as constants in the program
\nD.1) If you find the registration, present the text:
\n“The registration number XXXXXXXXX corresponds to student YYYYYYYY.”
\nD.2) If you can not find the registration, please submit the text:
\n“Registration XXXXXXXXX was not found”
\nD.3) If the registration number corresponds to your registration number, present the text:
\n“It’s me! I’M YYYYY YYYYY YYYY and my register number is XXXXXXXXX ”
\nE) Go back to step “A”<\/p>\n

The names must be stored using .asciiz and the registration numbers must be stored as a 32-bit integer, formatted as BCD, that is, every 4 bits, we have a decimal digit. The first number of the register number is always 1 and should not be stored. Registration example: 112345678 will be stored in hexadecimal as
\n12345678h (binary 0001_0010_0011_0100_0101_0110_0111_1000);\n<\/p><\/blockquote>\n

See below:<\/b>
\n
\n# Partially completed solution.
\n.data
\n message: .asciiz \"Enter your registration number: \"
\n found_message: .asciiz \"The registration number XXXXXXXXX corresponds to student YYYYYYYY.\\n\"
\n not_found_message: .asciiz \"Registration XXXXXXXXX was not found.\\n\"
\n my_number_found_message: .asciiz \"It's me! I'M YYYYY YYYYY YYYY, and my register number is XXXXXXXXX.\\n\"
\n registration_names: .asciiz \"XXXXXX\", \"YYYYYY\"
\n registration_numbers: .word 0x0000000, 0x000000
\n my_number: .word 0x000000<\/p>\n

.eqv ARRAY_SIZE 8 # 2 ints = 8 bytes
\n.text
\n main:
\n loop:
\n # Show prompt.
\n li $v0, 4
\n la $a0, message
\n syscall<\/p>\n

# Get input.
\n li $v0, 5
\n syscall<\/p>\n

# If all 0's, then end program.
\n move $a0, $v0
\n beqz $a0, main_exit<\/p>\n

# Search (pass value to search in $a1).
\n move $a1, $a0
\n jal search_registration <\/p>\n

b loop <\/p>\n

main_exit:
\n li $v0, 10
\n syscall<\/p>\n

# Expects user input in $a1.
\n search_registration:
\n # $t1 is loop index. $t2 is my number.
\n li $t1, 0
\n search_loop:
\n lw $a0, registration_numbers($t1)
\n beq, $a0, $a1, number_found
\n addi $t1, $t1, 4
\n beq $t1, ARRAY_SIZE, number_not_found
\n blt $t1, ARRAY_SIZE, search_loop<\/p>\n

number_found:
\n lw $t2, my_number
\n beq $a0, $t2, my_number_found
\n li $v0, 4
\n la $a0, found_message
\n syscall <\/p>\n

b search_registration_exit
\n my_number_found:
\n li $v0, 4
\n la $a0, my_number_found_message<\/p>\n

syscall
\n b search_registration_exit
\n number_not_found:
\n li $v0, 4
\n la $a0, not_found_message
\n syscall
\n search_registration_exit:
\n jr $ra<\/p>\n

<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"

I was watching your videos on youtube about assembly, but I have many doubts… I have an exercise to do until next Sunday, and I don’t know how to do it! The steps are: A) Send the message: “Enter your registration number”; B) Receive 9 numeric digits corresponding to a registration number; C) If the […]<\/p>\n","protected":false},"author":1,"featured_media":1098,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,26,7],"tags":[],"jetpack_featured_media_url":"https:\/\/smartvania.com\/wp-content\/uploads\/2016\/03\/LTSK-copy.png","_links":{"self":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/1554"}],"collection":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/comments?post=1554"}],"version-history":[{"count":4,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/1554\/revisions"}],"predecessor-version":[{"id":1558,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/1554\/revisions\/1558"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/media\/1098"}],"wp:attachment":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/media?parent=1554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/categories?post=1554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/tags?post=1554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}