Self modifying code to save 2 bytes
This commit is contained in:
		
							
								
								
									
										7
									
								
								xylo.asm
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								xylo.asm
									
									
									
									
									
								
							@@ -1,5 +1,7 @@
 | 
				
			|||||||
org 51000
 | 
					org 51000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					counter EQU inc_counter + 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
zero_counter:
 | 
					zero_counter:
 | 
				
			||||||
	xor a
 | 
						xor a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -51,13 +53,10 @@ key_5:
 | 
				
			|||||||
	call play
 | 
						call play
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inc_counter:
 | 
					inc_counter:
 | 
				
			||||||
	ld a, (counter)
 | 
						ld a, 0		;This value will be modified by the running code
 | 
				
			||||||
	add a, 5
 | 
						add a, 5
 | 
				
			||||||
	cp 25
 | 
						cp 25
 | 
				
			||||||
	jr nz, set_counter
 | 
						jr nz, set_counter
 | 
				
			||||||
	jr zero_counter
 | 
						jr zero_counter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
counter:
 | 
					 | 
				
			||||||
	defb 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INCLUDE "sample.asm"
 | 
					INCLUDE "sample.asm"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user