addi $t1, $t1, 1 #increment counter for next element
addi $s0, $s0, 4
rem $t5, $t1, 6 #print areas in6 columns
beq $t5, $zero, newline
j print_lp1
newline:
la $a0, new_ln
li $v0, 4 #print newline
syscall
j print_lp1
print_end1:
I can't get the elements aligned however.
We can asume that the longest length of the integer is 8, and must be right justified.
Could you please guide me on how to do this?
Thanks.
Use a static buffer 256 or so bytes in size. Plenty of room!
You can subtract the current add new character position from the buffer base to get your index. Do a modulus operation and advance that many slots by inserting spaces.
OR you can have a moving partition.
NEXT = THIS + 12 space.
print column entry,
If THIS < NEXT
SKIP = NEX - THIS print skip spaces.
OR prefill entire buffer with spaces (0x20).
Then merely skip, no fill needed since its prefilled.
But don't forget your ASCIIz terminator after the last column!
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.