solve method
This commit is contained in:
		
							parent
							
								
									1b2234c51a
								
							
						
					
					
						commit
						4986e97e2b
					
				
							
								
								
									
										
											BIN
										
									
								
								solve/solve
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								solve/solve
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@ -73,9 +73,68 @@ sd tape, 0x01
 | 
			
		||||
sd tape, 0x02
 | 
			
		||||
sd tape, 0x03
 | 
			
		||||
; {a, b, c, d}
 | 
			
		||||
; [i[0], i[1], i[2], i[3] + i[0]]
 | 
			
		||||
; - add i[3] and i[0]
 | 
			
		||||
 | 
			
		||||
; [i[0], i[1], i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - xor i[1] with i[3] + i[0], pop from arith
 | 
			
		||||
 | 
			
		||||
; [i[0] + i[1], i[1], i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - add i[0] and i[1], pop from arith
 | 
			
		||||
 | 
			
		||||
; [i[0] + i[1], i[1], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - xor i[0] + i[1] with i[2], pop from arith
 | 
			
		||||
 | 
			
		||||
; [i[2], i[1], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - xor (i[0] + i[1]) ^ i[2] with i[0] + i[1], pop from arith
 | 
			
		||||
 | 
			
		||||
; [i[2], i[2] + i[1], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - add i[2] + i[1], pop from arith | store i[2] + i[1] in arith
 | 
			
		||||
 | 
			
		||||
; [i[2], i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - pop i[3] from tape use previous i[1] + i[2] from arith to xor
 | 
			
		||||
 | 
			
		||||
; [i[2], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - use previous i[1] + i[2] from arith to xor and pop
 | 
			
		||||
 | 
			
		||||
; [i[1], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - put i[2] in arith, pop i[1] from tape
 | 
			
		||||
 | 
			
		||||
; [i[2] + i[1], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - put i[1] in arith, add, pop
 | 
			
		||||
 | 
			
		||||
; [i[3], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - xor i[2] + i[1] with (i[2] + i[1]) ^ i[3]
 | 
			
		||||
 | 
			
		||||
; [i[2], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - put i[3] in arith, pop i[2] from tape
 | 
			
		||||
 | 
			
		||||
; [i[2] + i[3], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - put i[2] in arith, add to i[3]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
; [i[0], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - put i[2] + i[3] in arith, pop i[0] from tape
 | 
			
		||||
 | 
			
		||||
; [(i[2] + i[3]) ^ i[0], (i[2] + i[1]) ^ i[3], (i[0] + i[1]) ^ i[2], (i[3] + i[0]) ^ i[1]]
 | 
			
		||||
; - xor in arith
 | 
			
		||||
 | 
			
		||||
; push all to tape
 | 
			
		||||
; pop all back into mem in correct spot
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
; routine for doing overflowing add
 | 
			
		||||
; [a, b]
 | 
			
		||||
; [255 - a, b]
 | 
			
		||||
; 255 - a < b
 | 
			
		||||
;    a = b - [255 - a]
 | 
			
		||||
; 255 - a >= b
 | 
			
		||||
;    a = a + b
 | 
			
		||||
; 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
le 0x00, 0x01, label
 | 
			
		||||
sd disp, 0x00
 | 
			
		||||
sd disp, 0x01
 | 
			
		||||
 | 
			
		||||
label: 
 | 
			
		||||
    sd disp, 0x01
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user