0100 .TITLE SPRAY for BASIC - 21 May 1982¢0110 ;¢0120 ; BASIC callable subroutine to spray¢0130 ; a value across any number of bytes.¢0140 ;¢0150 ; By Bob Stewart, of The Logic Smiths¢0160 ; For ANTIC Magazine¢0170 ;¢0180 ; Calling sequence:¢0190 ;¢0200 ; XX=USR(SPRAY,VALUE,OUTADD,COUNT)¢0210 ;¢0220 ; XX - Any useless variable¢0230 ; SPRAY - Adress of SPRAY code¢0240 ; VALUE - Value to spray¢0250 ; OUTADD - Output address¢0260 ; COUNT - Number of bytes to spray¢0270 ;¢0280 ; Notes:¢0290 ;¢0300 ; Uses page 0 for temporary¢0310 ; storage at 204-208.¢0320 ;¢0330 *=$600 Actually relocatable¢0340 ;¢0370 VALUE=204 Input address¢0380 OUTADD=205 Output address¢0390 COUNT=207 Byte count¢0400 ;¢0410 ; Get arguments¢0420 ;¢0430 SPRAY PLA Ignore argument count¢0440 PLA Ignore value hi¢0450 PLA Value lo¢0460 STA VALUE¢0470 PLA Output address hi¢0480 STA OUTADD+1¢0490 PLA Output address lo¢0500 STA OUTADD¢0510 PLA Count hi¢0520 STA COUNT+1¢0530 PLA Count lo¢0540 STA COUNT¢0550 .PAGE¢0560 ;¢0570 ; Move 256 byte chunks¢0580 ;¢0590 LDA VALUE Get value to spray¢0600 LDX COUNT+1 Get count hi¢0610 BEQ HIDONE If 0, hi done¢0620 LDY #0 Set to spray 256¢0630 MORE STA (OUTADD),Y Store value¢0640 DEY Decrement count¢0650 BNE MORE If not 0, more¢0660 INC OUTADD+1 Next output chunk¢0670 DEX Decrement count hi¢0680 BNE MORE If not 0, more¢0690 ;¢0700 ; Move remainder¢0710 ;¢0720 HIDONE LDY COUNT Count remainder¢0730 CHKLO DEY Decrement count¢0740 CPY #255 Check against end¢0750 BEQ LODONE If equal, done¢0760 STA (OUTADD),Y Put byte¢0770 BNE CHKLO Always branches!¢0780 LODONE RTS Fini, return¢0790 .END¢