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