From 49ac59ce93a70efd450336cec82a644aab56518a Mon Sep 17 00:00:00 2001 From: "22.jakub@gmail.com" <22.jakub@gmail.com> Date: Tue, 28 Apr 2015 12:58:52 +0200 Subject: [PATCH] final 3 - all resolutions --- main.asm | 20 +++++++++++++++----- readInput.asm | 31 +++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/main.asm b/main.asm index b41ed8e..e7d4622 100644 --- a/main.asm +++ b/main.asm @@ -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 @@ -62,6 +62,7 @@ bh: .word 0 # biHeight #!!! #readInput.asm + #gathering resolution information #t1 - width #t2 - height @@ -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 diff --git a/readInput.asm b/readInput.asm index 542e8af..baacf48 100644 --- a/readInput.asm +++ b/readInput.asm @@ -1,3 +1,4 @@ + #gathering resolution information #t1 - width #t2 - height @@ -32,7 +33,8 @@ 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 @@ -40,7 +42,8 @@ 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 @@ -49,7 +52,8 @@ 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 @@ -57,7 +61,8 @@ 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 @@ -66,7 +71,8 @@ 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 @@ -74,7 +80,8 @@ 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 @@ -83,7 +90,8 @@ 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 @@ -91,7 +99,8 @@ 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 @@ -100,7 +109,8 @@ 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 @@ -108,4 +118,5 @@ syscall li $v0, 5 #read int syscall -sb $v0, 9($t3) \ No newline at end of file +mul $v0, $v0, 655 #0.01 x 2^16 +sw $v0, 36($t3) \ No newline at end of file