0100 ;TIMER 2 0110 ;BY FRED PINHO 0120 ;(c) 1985, ANTIC PUBLISHING 0160 *= $0600 ;RELOCATABLE 0170 ;SINCE MAC/65 USES PAGE 6, ASSEMBLE TO DISK. RECOVER FILE WITH DOS. 0180 ;FOR DEBUGGING, ASSEMBLE WITH AN OFFSET VIA THE .SET AND .OPT DIRECTIVES. 0190 .TITLE "LISTING 2" 0200 .TAB 14,18,26 0210 .SET 1,4 0220 SETVBV = $E45C 0230 XITVBV = $E462 0240 CLD ;MUST BE DONE 0250 LDA 1021 ;TIMER ACTIVATED? 0260 BNE GOON ;YES. SKIP AROUND 0270 LDA #1 ;NO. SET DELAY FOR IMMEDIATE DISPLAY 0280 STA 1028 0290 LDA #255 ;SET TO INDICATE ACTIVE TIMER 0300 STA 1021 0310 STA 558 ;SET TIMER FLAG 0320 LDY 1025 ;DESIRED TIME,LOW 0330 LDX 1026 ;HIGH 0340 LDA #5 ;TIMER 5 TO BE ENABLED 0350 JSR SETVBV ;DOES THE JOB 0360 GOON DEC 1028 ;CALCULATE TIME? 0370 BNE EXIT ;NOT YET. BYPASS ROUTINE 0380 LDA #10 ;YES. RESET DELAY COUNTER 0390 STA 1028 0400 LDA 544 ;GET TIMER LO BYTE 0410 STA 1022 0420 LDA 545 ;HI BYTE 0430 DIVIDE LDX #8 ;DIVIDE BY 60 0440 LOOP1 ASL 1022 ;TO GET TOTAL SECONDS 0450 ROL A 0460 CMP #60 0470 BCC BRCH1 0480 SBC #60 0490 INC 1022 0500 BRCH1 DEX 0510 BNE LOOP1 0520 STA 1023 0530 ;TOTAL SECONDS STORED IN REGISTER 1022 0540 LDX #8 ;DIVIDE BY 60 0550 LDA #0 ;TO GET MINUTES 0560 LOOP2 ASL 1022 0570 ROL A 0580 CMP #60 0590 BCC BRCH2 0600 SBC #60 0610 INC 1022 0620 BRCH2 DEX 0630 BNE LOOP2 0640 STA 1023 0650 ;MINUTES IN 1022,REMAINING SECONDS IN 1023 0660 ;NOW DIVIDE BY 10 TO GET HI AND LO DIGITS OF DECIMAL NUMBER 0670 LDX #8 0680 LDA #0 0690 LOOP3 ASL 1023 0700 ROL A 0710 CMP #10 0720 BCC BRCH3 0730 SBC #10 0740 INC 1023 0750 BRCH3 DEX 0760 BNE LOOP3 0770 STA 1024 0780 ;SECONDS(TENS PLACE) IN 1023 0790 ;SECONDS(UNIT PLACE) IN 1024 0800 DISPLAY CLC ;STORE 3 DIGITS INTO DISPLAY AREA 0810 LDY #0 0820 LDA 1022 ;MINUTES 0830 ADC #16 ;CONVERT TO SCREEN CODE 0840 STA (208),Y ;STORE 0850 INY 0860 LDA #26 ;SCREEN CODE FOR ':' 0870 STA (208),Y 0880 INY 0890 LDA 1023 ;SECONDS(HI) 0900 ADC #16 0910 STA (208),Y 0920 INY 0930 LDA 1024 ;SECONDS(LO) 0940 ADC #16 0950 STA (208),Y 0960 LDA 558 ;TIMER DONE? 0970 BEQ DISABLE ;YES 0980 EXIT JMP XITVBV ;NO. JUST RETURN TO VBI 0990 DISABLE LDA #$62 ;RESTORE ORIGINAL VBI VECTOR 1000 STA 548 1010 LDA #$E4 1020 STA 549 1030 JMP XITVBV ;EXIT 1040 .END
Back to previous page