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