42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
vram        EQU     0x0800
 | 
						|
x_bounds    EQU     0x9F
 | 
						|
y_bounds    EQU     0x77
 | 
						|
 | 
						|
x_rand      EQU     0x06
 | 
						|
y_rand      EQU     0x07
 | 
						|
sysFn       EQU     0x22
 | 
						|
 | 
						|
vbase       EQU     0x40
 | 
						|
pixels      EQU     0x42
 | 
						|
xy          EQU     0x44
 | 
						|
 | 
						|
                
 | 
						|
            LDWI    vram
 | 
						|
            STW     vbase
 | 
						|
 | 
						|
            LDWI    0x0000      
 | 
						|
            STW     xy
 | 
						|
 
 | 
						|
loop        LD      x_rand      ; x position
 | 
						|
            ST      xy
 | 
						|
            SUBI    x_bounds    ; works as (x_rand % x_bounds), but only because x_bounds is > 0x00FF/2, fails otherwise
 | 
						|
            BLE     y_load
 | 
						|
            ST      xy
 | 
						|
 | 
						|
y_load      LD      y_rand      ; y position
 | 
						|
            ST      xy+1
 | 
						|
            SUBI    y_bounds    ; works as (y_rand % y_bounds), but only because y_bounds is > 0x00FF/3, fails otherwise
 | 
						|
            BLE     draw
 | 
						|
            ST      xy+1
 | 
						|
            SUBI    y_bounds
 | 
						|
            BLE     draw
 | 
						|
            ST      xy+1
 | 
						|
            
 | 
						|
draw        LDW     vbase
 | 
						|
            ADDW    xy
 | 
						|
            STW     pixels
 | 
						|
            LD      x_rand
 | 
						|
            POKE    pixels
 | 
						|
 | 
						|
            BRA     loop        
 |