You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

time 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. .PAG 'TIME FUNCTION'
  2. ;***********************************
  3. ;* *
  4. ;* TIME *
  5. ;* *
  6. ;*CONSISTS OF THREE FUNCTIONS: *
  7. ;* (1) UDTIM-- UPDATE TIME. USUALLY*
  8. ;* CALLED EVERY 60TH SECOND. *
  9. ;* (2) SETTIM-- SET TIME. .Y=MSD, *
  10. ;* .X=NEXT SIGNIFICANT,.A=LSD *
  11. ;* (3) RDTIM-- READ TIME. .Y=MSD, *
  12. ;* .X=NEXT SIGNIFICANT,.A=LSD *
  13. ;* *
  14. ;***********************************
  15. .SKI
  16. ;INTERRUPTS ARE COMING FROM THE 6526 TIMERS
  17. ;
  18. UDTIM LDX #0 ;PRE-LOAD FOR LATER
  19. ;
  20. ;HERE WE PROCEED WITH AN INCREMENT
  21. ;OF THE TIME REGISTER.
  22. ;
  23. UD20 INC TIME+2
  24. BNE UD30
  25. INC TIME+1
  26. BNE UD30
  27. INC TIME
  28. ;
  29. ;HERE WE CHECK FOR ROLL-OVER 23:59:59
  30. ;AND RESET THE CLOCK TO ZERO IF TRUE
  31. ;
  32. UD30 SEC
  33. LDA TIME+2
  34. SBC #$01
  35. LDA TIME+1
  36. SBC #$1A
  37. LDA TIME
  38. SBC #$4F
  39. BCC UD60
  40. ;
  41. ;TIME HAS ROLLED--ZERO REGISTER
  42. ;
  43. STX TIME
  44. STX TIME+1
  45. STX TIME+2
  46. ;
  47. ;SET STOP KEY FLAG HERE
  48. ;
  49. UD60 LDA ROWS ;WAIT FOR IT TO SETTLE
  50. CMP ROWS
  51. BNE UD60 ;STILL BOUNCING
  52. TAX ;SET FLAGS...
  53. BMI UD80 ;NO STOP KEY...EXIT STOP KEY=$7F
  54. LDX #$FF-$42 ;CHECK FOR A SHIFT KEY (C64 KEYBOARD)
  55. STX COLM
  56. UD70 LDX ROWS ;WAIT TO SETTLE...
  57. CPX ROWS
  58. BNE UD70
  59. STA COLM ;!!!!!WATCH OUT...STOP KEY .A=$7F...SAME AS COLMS WAS...
  60. INX ;ANY KEY DOWN ABORTS
  61. BNE UD90 ;LEAVE SAME AS BEFORE...
  62. UD80 STA STKEY ;SAVE FOR OTHER ROUTINES
  63. UD90 RTS
  64. .SKI 5
  65. RDTIM SEI ;KEEP TIME FROM ROLLING
  66. LDA TIME+2 ;GET LSD
  67. LDX TIME+1 ;GET NEXT MOST SIG.
  68. LDY TIME ;GET MSD
  69. .SKI 5
  70. SETTIM SEI ;KEEP TIME FROM CHANGING
  71. STA TIME+2 ;STORE LSD
  72. STX TIME+1 ;NEXT MOST SIGNIFICANT
  73. STY TIME ;STORE MSD
  74. CLI
  75. RTS
  76. .END
  77. ; RSR 8/21/80 REMOVE CRFAC CHANGE STOP
  78. ; RSR 3/29/82 ADD SHIT KEY CHECK FOR COMMODORE 64