Skip to content

Commit

Permalink
final 3 - all resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
nietup committed Apr 28, 2015
1 parent 02bf164 commit 49ac59c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
20 changes: 15 additions & 5 deletions main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ output: .asciiz "out.bmp"

width_prompt: .asciiz "podaj szerokosc: "
height_prompt: .asciiz "\npodaj wysokosc: "
points_prompt: .asciiz "\npodaj 5 punktow kotrolnych (fixed point 16,16):"
points_prompt: .asciiz "\npodaj 5 punktow kotrolnych (wartosci procentowe):"
x_prompt: .asciiz "\n\nx: "
y_prompt: .asciiz "\ny: "
y_prompt: .asciiz "y: "
debug: .asciiz "\n-------------------------------------\n"

control_points: .word 0
Expand Down Expand Up @@ -62,6 +62,7 @@ bh: .word 0 # biHeight

#!!!
#readInput.asm

#gathering resolution information
#t1 - width
#t2 - height
Expand Down Expand Up @@ -195,11 +196,20 @@ sw $t2, bh

sll $t4, $t1, 1
add $t4, $t4, $t1 #width x 3

and $t5, $t4, 3 #division by 4 check
beqz $t5, no_correction
li $t6, 4
sub $t5, $t6, $t5
add $t4, $t4, $t5
no_correction:

sw $t4, triple_w

mul $t4, $t1, $t2 #width x heigth x 3(bytes per pixel) + 54 (bitmap header)
sll $t5, $t4, 1
add $t5, $t5, $t4
#mul $t4, $t1, $t2 #width x heigth x 3(bytes per pixel) + 54 (bitmap header)
#sll $t5, $t4, 1
#add $t5, $t5, $t4
mul $t5, $t4, $t2
addi $t4, $t5, 54
sw $t4, bitmap_size

Expand Down
31 changes: 21 additions & 10 deletions readInput.asm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#gathering resolution information
#t1 - width
#t2 - height
Expand Down Expand Up @@ -32,15 +33,17 @@ syscall

li $v0, 5 #read int
syscall
sb $v0, ($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, ($t3)

li $v0, 4 #print string
la $a0, y_prompt
syscall

li $v0, 5 #read int
syscall
sb $v0, 1($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 4($t3)

#2nd point
li $v0, 4 #print string
Expand All @@ -49,15 +52,17 @@ syscall

li $v0, 5 #read int
syscall
sb $v0, 2($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 8($t3)

li $v0, 4 #print string
la $a0, y_prompt
syscall

li $v0, 5 #read int
syscall
sb $v0, 3($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 12($t3)

#3rd point
li $v0, 4 #print string
Expand All @@ -66,15 +71,17 @@ syscall

li $v0, 5 #read int
syscall
sb $v0, 4($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 16($t3)

li $v0, 4 #print string
la $a0, y_prompt
syscall

li $v0, 5 #read int
syscall
sb $v0, 5($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 20($t3)

#4th point
li $v0, 4 #print string
Expand All @@ -83,15 +90,17 @@ syscall

li $v0, 5 #read int
syscall
sb $v0, 6($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 24($t3)

li $v0, 4 #print string
la $a0, y_prompt
syscall

li $v0, 5 #read int
syscall
sb $v0, 7($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 28($t3)

#5th point
li $v0, 4 #print string
Expand All @@ -100,12 +109,14 @@ syscall

li $v0, 5 #read int
syscall
sb $v0, 8($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 32($t3)

li $v0, 4 #print string
la $a0, y_prompt
syscall

li $v0, 5 #read int
syscall
sb $v0, 9($t3)
mul $v0, $v0, 655 #0.01 x 2^16
sw $v0, 36($t3)

0 comments on commit 49ac59c

Please sign in to comment.