NAM MONITR
*
* COPYRIGHT 1985, GEORGIA TECH RESEARCH CORPORATION
*
* THIS MONITOR WORKS ON A 6802 BASED COMPUTER WITH A 6821 PIA AT
* THE FOLLOWING ADDRESSES:
* $4000 : PORT A DATA REGISTER
* $4001 : PORT B DATA REGISTER
* $4002 : PORT A CONTROL REGISTER
* $4003 : PORT B CONTROL REGISTER
* AND WHERE NMI' IS CONNECTED TO IRQB' AND IS USED TO INDICATE AN
* INTERRUPT FROM THE KEYBOARD. THE LOWER 5 BITS OF PORT A BRING
* DATA FROM THE KEYBOARD. PORT B TAKES DATA TO THE DISPLAY.
* IRQ' IS NOT USED.
*
* THE SIX DIGIT MULTIPLEXED LED DISPLAY REQUIRES THE PROCESSOR TO
* REFRESH IT.
*
ORG 0
*
* BEGIN ADDRESSES IN RAM
*
NDGTS RMB 2 THE NUMBER OF DIGITS IN MEMORY
DIGITS RMB 6 STORAGE FOR THE DISPLAYED DIGITS
*
MASKS RMB 6 MASKS TO BE OVERLAYED ONTO THE DIGITS
* AS THEY ARE DISPLAYED
DIGNUM RMB 2 NUMBER OF THE NEXT DIGIT TO DISPLAY
*
TEMP RMB 2 TEMPORARY STORAGE
*
DELTMP RMB 2 TEMPORARY STORAGE FOR THE DELAY ROUTINE
DLNGTH RMB 3 DELAY CONSTANT
*
IRQ RMB 2 IRQ' INTERRUPT VECTOR ADDRESS
NMI RMB 2 NMI' INTERRUPT VECTOR ADDRESS
SWI RMB 2 SWI INTERRUPT VECTOR ADDRESS
*
SHIFT RMB 1 SHIFT FLAG
*
STACK EQU $007F BOTTOM OF STACK (= TOP OF RAM)
ISPC EQU 5 OFFSET OF PC FROM SP AFTER INTERRUPT (MINUS 1)
TBLSIZ EQU 40 TWICE THE NUMBER OF KEYS ON THE KEYBOARD
*
* END OF ADDRESSES IN RAM
*
*
* BEGIN ADDRESSES OF I/O DEVICES
*
ORG $4000
KBDATA RMB 1 PIA: PORT A DATA REGISTER
DSDATA RMB 1 PIA: PORT B DATA REGISTER
KBCTL RMB 1 PIA: PORT A CONTROL REGISTER
DSCTL RMB 1 PIA: PORT B CONTROL REGISTER
*
INTON EQU $07 PIA PROGRAM VALUE W/ INTERRUPT ON
INTOFF EQU $06 PIA PROGRAM VALUE W/ INTERRUPT OFF
*
* END ADDRESSES OF I/O DEVICES
*
*
* BEGIN ADDRESSES IN ROM
*
ORG $F800
* INITIALIZATION ROUTINE
CONS1 FCB $10 A CONSTANT USED IN SETTING UP THE MASKS
INIT LDS #STACK INITIALIZE STACK POINTER
JSR CLRDIG INITIALIZE DISPLAY MEMORY
*
LDX #MONKBD SET UP KEYBOARD INTERRUPT SERVICE ADDRESS
STX NMI
*
LDX #DSPLAY SET UP DUMMY INTERRUPT SERVICE ADDRESS
STX IRQ
*
LDX #DSPLAY SET UP DISPLAY INTERRUPT SERVICE ADDRESS
STX SWI
*
CLRA
STAA DLNGTH INITIALIZE DELAY CONSTANT
STAA DLNGTH+1
STAA DLNGTH+2
*
STAA SHIFT INITIALIZE SHIFT FLAG TO UNSHIFTED MODE
*
STAA DIGNUM START OUT ON FIRST DIGIT
STAA DIGNUM+1
*
TAB
ORAB #$00
STAB MASKS SET UP MASKS
ADDA CONS1
TAB
ORAB #$00
STAB MASKS+1
ADDA CONS1
TAB
ORAB #$00
STAB MASKS+2
ADDA CONS1
TAB
ORAB #$00
STAB MASKS+3
ADDA CONS1
TAB
ORAB #$80
STAB MASKS+4
ADDA CONS1
TAB
ORAB #$00
STAB MASKS+5
*
CLRA BEGIN PIA INITIALIZATION
STAA KBCTL SELECT DATA DIRECTION REGISTER A
STAA DSCTL SELECT DATA DIRECTION REGISTER B
STAA KBDATA MAKE PORT A INPUT
COMA
STAA DSDATA MAKE PORT B OUTPUT
LDAA #$04 SELECT PORT A DATA REGISTER
STAA KBCTL
LDAA #INTON CA2 AND CB2 ARE OUTPUT (UNUSED)
STAA DSCTL SELECT OUTPUT REGISTER B
* SET IRQB' ON LOWTOHIGH CB1 TRANSITION
* ENABLE CB1 INTERRUPTS
* DISABLE CB2 INTERRUPTS
CLI ENABLE INTERRUPTS
*
JMP IDLE JUMP TO THE IDLE ROUTINE
*
* END OF THE INITIALIZATIONS
*
*
* THE IDLE ROUTINE
*
* THIS IS THE MAIN ROUTINE OF THE SYSTEM. IT EXECUTES WHENEVER THERE
* IS NOTHING ELSE FOR THE PROCESSOR TO DO.
*
* THERE ARE TWO IDLE LOOPS. THE FIRST ONE (WITH THE NOP) EXECUTES
* UNTIL SOME KEY IS PRESSED ON THE KEYBOARD. FROM THEN ON, THE
* SECOND ONE (WITH THE SWI) EXECUTES. THE FIRST IDLE LOOP PRODUCES
* SIGNALS ON THE BUSSES THAT ARE USEFUL IN DEBUGGING, BUT IT DOES
* NOT DISPLAY ANY DIGITS. THE SECOND ONE DRIVES THE DISPLAY.
IDLE NOP
BRA IDLE LOOP FOREVER, WAITING FOR INTERRUPTS
*
IDLE2 SWI DISPLAY A DIGIT
JSR NBLINT ENABLE KEYBOARD INTERRUPT
JSR DBLINT DISABLE KEYBOARD INTERRUPT
BRA IDLE2 REPEAT
*
* END IDLE ROUTINE
*
*
* INTERRUPT SERVICE ROUTINES
*
* THE FOLLOWING THREE ROUTINES SERVICE THE THREE TYPES OF INTERRUPTS.
* EACH ROUTINE EXECUTES THE ROUTINE WHOSE ADDRESS IS STORED IN THE
* CORRESPONDING VECTOR ADDRESS LOCATION IN RAM.
*
NMISVC LDX NMI
JSR 0,X
RTI
*
IRQSVC LDX IRQ
JSR 0,X
RTI
*
SWISVC LDX SWI
JSR 0,X
RTI
*
* THE FOLLOWING TWO ROUTINES ENABLE AND DISABLE KEYBOARD INTERRUPTS,
* RESPECTIVELY.
*
NBLINT LDAA #INTON SET BIT 0 OF PORT B CONTROL REGISTER
STAA DSCTL
RTS
*
DBLINT LDAA #INTOFF RESET BIT 0 OF PORT B CONTROL REGISTER
STAA DSCTL
RTS
*
* END INTERRUPT SERVICE ROUTINES
*
*
* THE DISPLAY DRIVER ROUTINE
*
* THIS ROUTINE IS CALLED WHENEVER AN NMI' INTERRUPT OCCURS. IT WILL
* DISPLAY ONE DIGIT, AND THEN RETURN.
*
DSPLAY LDX DIGNUM SEE WHICH DIGIT TO DISPLAY NEXT
LDAA DIGITS,X GET THE DIGIT
ORAA MASKS,X OVERLAY DESTINATION ADDRESS
STAA DSDATA WRITE OUT DIGIT
CPX #$0000 IS IT THE LAST DIGIT?
BNE DSPL2 IF NOT, THEN SET TO NEXT DIGIT
LDX NDGTS RESET DIGIT COUNTER
BEQ DSPL1 RETURN
DSPL2 DEX SET TO NEXT DIGIT
STX DIGNUM
DSPL1 RTS
*
* END DISPLAY ROUTINE
*
*
* MONITOR MODE KEYBOARD INTERPRETER
*
* WHENEVER A KEY ON THE MONITOR KEYPAD IS PRESSED THIS ROUTINE IS CALLED.
* IT READS THE DIGIT FROM THE PIA AND BEHAVES ACCORDINGLY.
* IF THE KEY WAS A HEX DIGIT KEY ($0..$F) IT STORES THE DIGIT IN
* DISPLAY MEMORY AS THE NEXT DIGIT. IF THE KEY WAS THE STORE KEY
* IT STORES THE TWO LEFTMOST DIGITS AS ONE BYTE AT THE LOCATION
* SPECIFIED BY THE FOUR RIGHTMOST DIGITS.
* D5 D4 D3 D2 D1 D0
* !______!!______!
* DATA ADDRESS
*
* D5 IS THE LOCATION DIGITS+5, D4 IS DIGITS+4, ETC.
* IF THE KEY WAS THE RECALL KEY IT DISPLAYS THE DATA FROM THE
* SPECIFIED ADDRESS AS THE TWO DATA DIGITS.
* IF THE KEY WAS THE EXECUTE KEY IT JUMPS TO A SUBROUTINE AT THE
* SPECIFIED ADDRESS.
*
* FORMAT OF THE PIA INPUT:
*
* %0000XXXX %XXXX IS THE HEX VALUE
* %00010000 H KEY
* %00010001 L KEY
* %00010010 SHIFT KEY
* ANYTHING ELSE WILL CAUSE THE DISPLAY TO BE CLEARED.
*
* WHENEVER THIS ROUTINE IS EXECUTED IT FIXES UP THE STACK SO AS TO
* RETURN TO THE ROUTINE "IDLE" WHEN AN "RTI" INSTRUCTION IS EXECUTED.
*
MONKBD LDX #IDLE2 FIX UP RETURN ADDRESS ON STACK
STX TEMP
TSX
LDAA TEMP
STAA 2+ISPC,X
LDAA TEMP+1
STAA 3+ISPC,X
LDX #MONTBL SET UP PARAMETER FOR CALL TO KBDSVC
JSR KBDSVC INTERPRET THE KEY
LDAA DSDATA CLEAR ITERRUPT STATUS
RTS
*
* CALCULATOR MODE KEYBOARD INTERPRETER
*
* IN THIS MODE, THE USER ENTERS NUMBERS AND CAN DO VARIOUS PIDDLING
* ARITHMETIC OPERATIONS WITH THEM.
* THE DISPLAY HAS ONLY ONE FORMAT NUMERIC WITH LED 0 THE LEAST SIGNIFICANT
* DIGIT.
*
CLCKBD LDX #CLCTBL SET UP PARAMETER FOR CALL TO KBDSVC
JSR KBDSVC INTERPRET THE KEYSTROKE
RTS
*
* CLOCK MODE KEYBOARD INTERPRETER
*
* IN THIS MODE THE COMPUTER FUNCTIONS AS A CLOCK. THE DISPLAY IS IN THE FORMAT
* HH.MM.SS AT ALL TIMES. THE CLOCK HAS THREE FUNCTIONS: SET, FAST FORWARD, AND
* RUN.
*
CLKKBD LDX #CLKTBL SET UP PARAMETER FOR CALL TO KBDSVC
JSR KBDSVC INTERPRET THE KEYSTROKE
RTS
*
* END KEYBOARD SERVICE ROUTINES
*
*
* KEYBOARD BRANCH TABLES
*
* EACH ENTRY OF THIS TABLE IS THE ADDRESS OF THE ROUTINE TO SERVICE
* A KEY. IF KEY IS THE NUMBER OF THE KEY PRESSED, THEN THE ADDRESS
* AT LOCATION
* KBDTBL + 2*KEY (IF IN UNSHIFTED MODE)
* KBDTBL + 2*KEY + (SHFTBL KBDTBL) =
* SHFTBL + 2*KEY (IF IN SHIFTED MODE)
* IS TAKEN TO BE THE ADDRESS OF THE ROUTINE TO SERVICE THE KEY, WHERE
* KBDTBL AND SHFTBL ARE THE ADDRESSES OF THE UNSHIFTED AND THE SHIFTED
* PORTIONS OF THE TABLES, RESPECTIVELY. ALL TABLES MUST BE THE SAME SIZE, AS
* THE CONSTANT "TBLSIZ" GIVES THE SIZE OF THE UNSHIFTED PORTION.
*
* MONITOR MODE JUMP TABLE
*
MONTBL FDB STODIG KEY NUMBER $0 UNSHIFTED
FDB STODIG $1
FDB STODIG $2
FDB STODIG $3
FDB STODIG $4
FDB STODIG $5
FDB STODIG $6
FDB STODIG $7
FDB STODIG $8
FDB STODIG $9
FDB STODIG $A
FDB STODIG $B
FDB STODIG $C
FDB STODIG $D
FDB STODIG $E
FDB STODIG $F
FDB STO $10
FDB RCL $11
FDB ONSHFT $12
FDB CLRDIG $13 UNUSED
MNSTBL FDB CLRDIG KEY NUMBER $0 SHIFTED MODE
FDB EXC $1
FDB OLDIDL $2
FDB CLRDIG $3
FDB CLRDIG $4
FDB CLRDIG $5
FDB CLRDIG $6
FDB CLRDIG $7
FDB CLRDIG $8
FDB CLRDIG $9
FDB CLRDIG $A
FDB CLRDIG $B
FDB CLRDIG $C
FDB TOMON $D
FDB TOCLC $E
FDB TOCLK $F
FDB CLRDIG $10
FDB CLRDIG $11
FDB OFFSHF $12
FDB CLRDIG $13 UNUSED
*
* CALCULATOR MODE JUMP TABLE CALCULATOR MODE IS NOT IMPLEMENTED
*
CLCTBL FDB STODIG KEY NUMBER $0 UNSHIFTED
FDB STODIG $1
FDB STODIG $2
FDB STODIG $3
FDB STODIG $4
FDB STODIG $5
FDB STODIG $6
FDB STODIG $7
FDB STODIG $8
FDB STODIG $9
FDB STODIG $A
FDB STODIG $B
FDB STODIG $C
FDB STODIG $D
FDB STODIG $E
FDB STODIG $F
FDB STO $10
FDB RCL $11
FDB ONSHFT $12
FDB CLRDIG $13 UNUSED
CLSTBL FDB CLRDIG KEY NUMBER $0 SHIFTED MODE
FDB EXC $1
FDB OLDIDL $2
FDB CLRDIG $3
FDB CLRDIG $4
FDB CLRDIG $5
FDB CLRDIG $6
FDB CLRDIG $7
FDB CLRDIG $8
FDB CLRDIG $9
FDB CLRDIG $A
FDB CLRDIG $B
FDB CLRDIG $C
FDB CLRDIG $D
FDB CLRDIG $E
FDB CLRDIG $F
FDB CLRDIG $10
FDB CLRDIG $11
FDB OFFSHF $12
FDB CLRDIG $13 UNUSED
*
* CLOCK MODE JUMP TABLE CLOCK MODE IS NOT IMPLEMENTED
*
CLKTBL FDB STODIG KEY NUMBER $0 UNSHIFTED
FDB STODIG $1
FDB STODIG $2
FDB STODIG $3
FDB STODIG $4
FDB STODIG $5
FDB STODIG $6
FDB STODIG $7
FDB STODIG $8
FDB STODIG $9
FDB STODIG $A
FDB STODIG $B
FDB STODIG $C
FDB STODIG $D
FDB STODIG $E
FDB STODIG $F
FDB STO $10
FDB RCL $11
FDB ONSHFT $12
FDB CLRDIG $13 UNUSED
CKSTBL FDB CLRDIG KEY NUMBER $0 SHIFTED MODE
FDB EXC $1
FDB OLDIDL $2
FDB CLRDIG $3
FDB CLRDIG $4
FDB CLRDIG $5
FDB CLRDIG $6
FDB CLRDIG $7
FDB CLRDIG $8
FDB CLRDIG $9
FDB CLRDIG $A
FDB CLRDIG $B
FDB CLRDIG $C
FDB CLRDIG $D
FDB CLRDIG $E
FDB CLRDIG $F
FDB CLRDIG $10
FDB CLRDIG $11
FDB OFFSHF $12
FDB CLRDIG $13 UNUSED
*
* KEYBOARD SERVICE ROUTINE
*
* THIS ROUTINE CALLS THE ROUTINE CORRESPONDING TO THE KEY THAT WAS
* PRESSED. IT USES THE KEY AS AN INDEX INTO THE JUMP TABLE WHOSE
* ADDRESS IS PASSED IN THE X REGISTER. THE JUMP TABLE CONTAINS THE
* ADDRESS OF THE ROUTINE TO BE CALLED FOR EACH KEY.
*
KBDSVC STX TEMP STORE THE JUMP TABLE STARTING ADDRESS FOR MANIPULATION
LDAA KBDATA GET INPUT BYTE
ANDA #$1F MASK OFF UNUSED BITS
PSHA PRESERVE A REGISTER
ASLA MULTIPLY BY TWO
LDAB #0 ADD #KBDTBL + SHIFT TO 2 * INPUT BYTE TO GET ADDRESS
ADDA TEMP+1
ADCB TEMP
ADDA SHIFT AM I IN SHIFT MODE?
ADCB #0
STAB TEMP
STAA TEMP+1
PULB B NOW HOLDS THE INPUT BYTE
LDX TEMP X NOW HOLDS ADDRESS IN JUMP TABLE
LDX 0,X GET ADDRESS OF ROUTINE
JSR 0,X JUMP TO ROUTINE
RTS
*
*
* EXECUTION ROUTINES
*
* THESE ROUTINES ARE CALLED DIRECTLY THROUGH THE JUMP TABLE
*
STO JSR GETDDR FORM ADDRESS IN X FROM DISPLAYED DIGITS
JSR GETDIG FORM DATA BYTE IN A FROM DISPLAYED DIGITS
STAA 0,X STORE DATA BYTE
RTS
*
RCL JSR GETDDR GET ADDRESS
LDAA 0,X GET DATA
JSR PUTDIG DISPLAY THE DATA
LDAA #$06 MAKE SURE THERE ARE SIX DIGITS SHOWING
STAA NDGTS+1
RTS
*
ONSHFT LDAA #TBLSIZ SET SHIFT FLAG
STAA SHIFT
LDAA MASKS TURN ON LOWEST DECIMAL POINT
ORAA #$80
STAA MASKS
RTS
*
EXC JSR GETDDR FETCH ADDRESS FIELD OF THE DISPLAY
JSR 0,X JUMP TO REQUESTED ADDRESS
JSR OFFSHF TURN OFF SHIFT MODE
RTS
*
OLDIDL JSR CLRDIG RESET COMPUTER TO ITS POWER UP STATE
JSR OFFSHF
LDX #$0000
STX DIGNUM
JSR DSPLAY SHOW A 0 IN LED 0
LDX #IDLE PATCH UP THE STACK
STX TEMP
TSX
LDAA TEMP
STAA 6+ISPC,X
LDAA TEMP+1
STAA 7+ISPC,X
RTS
*
OFFSHF CLRA TURN OFF SHIFT MODE
STAA SHIFT
LDAA MASKS TURN OFF DECIMAL POINT
ANDA #$7F
STAA MASKS
RTS
*
TOMON LDX #MONKBD SWITCH TO MONITOR KEYBOARD INTERPRETER
STX IRQ
RTS
*
TOCLC LDX #CLCKBD SWITCH TO CALCULATOR KEYBOARD
STX IRQ
RTS
*
TOCLK LDX #CLKKBD SWITCH TO CLOCK KEYBOARD
STX IRQ
RTS
*
* END EXECUTION ROUTINES
*
* MISCELLANEOUS ROUTINES
*
* THESE ROUTINES ARE CALLED BY THE EXECUTION ROUTINES IN ORDER TO
* SERVICE A KEYSTROKE.
*
* ROUTINE TO CLEAR OUT THE DISPLAY MEMORY
*
CLRDIG CLRA
STAA DIGITS+0
STAA DIGITS+1
STAA DIGITS+2
STAA DIGITS+3
STAA DIGITS+4
STAA DIGITS+5
STAA NDGTS
STAA NDGTS+1
RTS
*
* THE FOLLOWING ROUTINE STORES ACCUMULATOR B AS THE LOWEST ORDER DIGIT OF
* THE DISPLAY, SHIFTING THE REST OF THE DISPLAY DOWN ONE DIGIT.
* THE LAST DIGIT FALLS OFF THE END DURING THE SHIFT.
*
STODIG LDAA DIGITS+4 BEGIN SHIFTING DISPLAY
STAA DIGITS+5
LDAA DIGITS+3
STAA DIGITS+4
LDAA DIGITS+2
STAA DIGITS+3
LDAA DIGITS+1
STAA DIGITS+2
LDAA DIGITS+0
STAA DIGITS+1
STAB DIGITS
LDAA NDGTS+1 INCREMENT THE NUMBER OF DIGITS
INCA
CMPA #$06 MAKE SURE THERE AREN'T MORE THAN 6 DIGITS
BLS STORTN
DECA
STORTN STAA NDGTS+1
RTS
*
* THE FOLLOWING ROUTINE FETCHES THE 4 LOWORDER DIGITS OF THE DISPLAY AND
* PACKS THEM TOGETHER INTO TWO BYTE, LEAVING THE RESULT IN THE X REGISTER.
*
GETDDR LDAA DIGITS+3 GET DIGIT 3
ASLA SHIFT LEFT 4 BITS
ASLA
ASLA
ASLA
ORAA DIGITS+2 OVERLAY DIGIT 2
STAA TEMP
LDAA DIGITS+1 GET DIGIT 1
ASLA SHIFT LEFT 4 BITS
ASLA
ASLA
ASLA
ORAA DIGITS+0 OVERLAY DIGIT 0
STAA TEMP+1
LDX TEMP LOAD RESULT INTO X REGISTER
RTS
*
* THE FOLLOWING ROUTINE UNPACKS THE X REGISTER INTO 4 HEX DIGITS AND
* PUTS THEM INTO THE FOUR LOWORDER DIGITS OF THE DISPLAY.
*
PUTDDR STX TEMP
LDAA TEMP+1 GET THE 2 LOWORDER DIGITS
ANDA #$0F SPLIT OFF THE LOWEST DIGIT
STAA DIGITS STORE THE LOWEST DIGIT
LDAA TEMP+1 GET THE 2 LOWORDER DIGITS
LSRA SPLIT OFF THE SECOND DIGIT (BY SHIFTING RIGHT 4 BITS)
LSRA
LSRA
LSRA
STAA DIGITS+1 STORE THE SECOND DIGIT
LDAA TEMP GET THE TWO HIGHORDER DIGITS
ANDA #$0F SPLIT OFF THE THIRD DIGIT
STAA DIGITS+2 STORE THE THIRD DIGIT
LDAA TEMP GET THE 2 HIGHORDER DIGITS
LSRA SPLIT OFF THE FOURTH DIGIT (BY SHIFTING RIGHT 4 BITS)
LSRA
LSRA
LSRA
STAA DIGITS+3 STORE THE FOURTH DIGIT
RTS
*
* THE FOLLOWING ROUTINE FETCHES THE TWO DATA DIGITS FROM THE DISPLAY
* AND PACKS THEM TOGETHER, LEAVING THE RESULT IN ACCUMULATOR A.
*
GETDIG LDAA DIGITS+5 GET DIGIT 5
ASLA SHIFT LEFT 4 BITS
ASLA
ASLA
ASLA
LDAB DIGITS+4 GET THE FOURTH DIGIT
ANDB #$0F MASK OFF THE DECIMAL POINT
STAB TEMP PUT THE TWO DIGITS TOGETHER
ORAA TEMP
RTS
*
* THE FOLLOWING ROUTINE UNPACKS ACCUMULATOR A INTO TWO HEX DIGITS
* AND STORES THEM AS THE TWO DATA DIGITS OF THE DISPLAY.
*
PUTDIG TAB PRESERVE REGISTER CONTENTS
LSRA SHIFT RIGHT 4 BITS
LSRA
LSRA
LSRA
STAA DIGITS+5 STORE DIGIT 5
ANDB #$0F MASK TO GET DIGIT FOUR
STAB DIGITS+4 STORE DIGIT 4
RTS
*
* END MISCELLANEOUS ROUTINES
*
*
* THIS ROUTINE PRODUCES A VARIABLE DELAY OF UP TO TWO AND A HALF
* MINUTES (AT ONE MICROSECOND CYCLE TIME). IT USES THE THREE BYTE
* VALUE STORED AT 'DLNGTH' TO DETERMINE THE LENGTH OF THE DELAY.
* THE TOTAL NUMBER OF MILLISECONDS DELAY =
* 66 + 10N + 17(N/256 + N/65536)
* = 66 + 659729N[0] + 2577N[1] + 10N[2]
* WHERE N[0], N[1], AND N[2] ARE THE CONTENTS OF LOCATIONS DLNGTH,
* DLNGTH+1, AND DLNGTH+2, RESPECTIVELY, AND / IS INTEGER DIVISION.
* THIS GIVES DELAYS FROM 66 TO 168,890,646 CYCLES.
*
NEG1 FCB $0FF CONSTANT = 1
DELAY LDAA DLNGTH GET MOST SIGNIFICANT BYTE
STAA DELTMP
LDAA DLNGTH+1 GET NEXT MOST SIGNIFICANT BYTE
STAA DELTMP+1
LDAA DLNGTH+2 GET LEAST SIGNIFICANT BYTE
DLOOP DECA DECREMENT LEAST SIGNIF. BYTE
CMPA NEG1 IS THE RESULT <0?
BNE DLOOP IF NOT, THEN LOOP
LDAB DELTMP+1 DECREMENT NEXT BYTE
DECB
STAB DELTMP+1
CMPB NEG1 IS IT LESS THAN 0?
BNE DLOOP IF NOT, THEN LOOP
LDAB DELTMP DECREMENT MOST SIGNIF. BYTE
DECB
STAB DELTMP
CMPB NEG1 IS IT LESS THAN 0?
BNE DLOOP IF NOT, THEN LOOP
RTS ELSE RETURN
*
*
* INTERRUPT VECTOR ADDRESSES
*
ORG $0FFF8
FDB IRQSVC IRQ'
FDB SWISVC SWI
FDB NMISVC NMI'
FDB INIT RST'
END