;PROCESSOR LOOP

;FOR LASER AND BOMB

;SOUND EFFECT

*

ORG $8F00

 ;FOR FIRST 6522

* 

PTR EQU $08 ;DATA POINTE

TONE EQU $0A ;TONAL VALUE

TIME EQU $0B ;TIME VALUE FOR DELAY

BASE EQU $C400 ;CARD ADDRESS

ORA EQU BASE+1 ;PORT A

TAR EQU $8000 ; TABLE ACCESS ROUTINE

LATCH EQU $900B ;LATCH SUBROUTINE

 

WRITE EQU $9016 ;WRITE SUBROUTINE

RESET EQU $9021 ;RESET SUBROUTINE

WAIT EQU $FCAB ;WAIT SUBROUTINE

* 

* 

LASER LDA #$00 ;LOAD HIGHEST

 STA TONE ;FREQUENCY VALUE

 LDA #$0F ;LOAD SHORT

 STA TIME ;TIME DELAY

 JMP START ;AND START

BOMB LDA #$30 ;LOAD MIDDLE

 STA TONE ;FREQUENCY VALUE

 LDA #$40 ;LOAD LONGER

 STA TIME ;TIME DELAY

START LDA #$90 ;SET TABLE ADDRESS

 STA PTR

 LDA #$81

 STA PTR+1

 JSR TAR ;TRANSFER DATA

 LDA #$00 ;LATCH FIRST REGISTER

 STA ORA ;ADDRESS

 JSR LATCH

LOOP LDA TONE ;GET TONE VALUE

 STA ORA ;STORE IN REGISTER

 JSR WRITE

 LDA TIME ;GET TIME VALUE 

 JSR WAIT ;AND DELAY

 INC TONE ;INCREMENT TONE VALUE

 LDA #$FF ;END OF INCREASE?

 CMP TONE

 BEQ DONE ;YES,EXIT

 JMP LOOP ;NO, START AGAIN

 DONE LDA TIME ;GET TIME VALUE

 JSR WAIT ;DELAY

 LDA #$00 ;RESTORE ORIGINAL

 STA TONE ;TONE VALUE

 JSR RESET ;CLEAR SOUND CHIP

 RTS ;REGISTERS AND RETURN


