Skip to content

Commit

Permalink
fixed (in lab)
Browse files Browse the repository at this point in the history
MUDERFKING FXD
  • Loading branch information
CCTL committed Aug 6, 2012
1 parent f2cc84f commit 0f6f5fe
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Lab1/a/code.asm
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
;unsigned int a, b;
;void main(void){
; while(a!=b){
; if(a>b){
; a=a-b;
; else
; b=b-a;
; }
; }
; while(a!=b){
; if(a>b){
; a=a-b;
; else
; b=b-a;
; }
; }
;}

.include "m64def.inc"
.def a_high =r16
.def a_high =r16
.def a_low =r17
.def b_high =r18
.def b_low =r19

; Theoretically it should look like
; 0000 0001 0000 0010
; which represents 257
ldi a_high, high (6969)
ldi a_low, low (6969)
; which represents 257
ldi a_high, high (65500)
ldi a_low, low (65500)

; Theoretically it should look like
; 0000 0001 0000 0001
Expand All @@ -33,7 +33,7 @@ breq while_end ; CHECK FOR EQUALITY

cp a_low, b_low
cpc a_high, b_high
brlt skip_if ; if A < B, this loop happens
brsh skip_if ; if A < B, this loop happens
sub b_low, a_low
sbc b_high, a_high
jmp skip_else
Expand Down

0 comments on commit 0f6f5fe

Please sign in to comment.