diff options
author | William Harrington <kb0iic@berzerkula.org> | 2019-05-22 16:50:26 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2019-05-22 16:50:26 -0500 |
commit | 23deda800dd486880b96cd26ca2c83c80f5f7b6b (patch) | |
tree | 6b6bed5b4902503ae54a542ebd142c37440450c4 /sb_rtc | |
parent | b784c8b27801db85c39ae0d613492b603b28e555 (diff) |
Move Scott Baker modules into addon
Diffstat (limited to 'sb_rtc')
-rw-r--r-- | sb_rtc/clock.bas | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/sb_rtc/clock.bas b/sb_rtc/clock.bas deleted file mode 100644 index d9671d7..0000000 --- a/sb_rtc/clock.bas +++ /dev/null @@ -1,53 +0,0 @@ -1 REM clock.bas -2 REM by Scott Baker, http://www.smbaker.com/ -3 REM Demonstrates use of BQ4845 RTC on Z80 RC2014 computer - -5 REM set 24-hour mode -6 OUT &HCE, 2 - -10 LS=999 -20 GOSUB 1000 -30 if (LS = S) GOTO 100 -40 LS = S -50 GOSUB 2000 -60 print T$ -70 REM for the display board, output seconds on the LEDs -80 OUT 0, S -100 GOTO 20 - -998 REM read the current time from the RTC -999 REM store it in the variables H, M, S. -1000 X=inp(&HC0) -1010 S=(X and 15) + INT(X/16)*10 -1020 X=inp(&HC2) -1030 M=(X and 15) + INT(X/16)*10 -1040 X=inp(&HC4) -1050 H=(X and 15) + (INT(X/16) and 3)*10 -1060 RETURN - -1999 REM format H, M, S into a string T$ -2000 T$="" -2010 if (H>9) GOTO 2030 -2020 T$=T$+"0" -2030 T$=T$+right$(str$(H),len(str$(H))-1) -2040 T$=T$+":" -2050 if (M>9) GOTO 2070 -2060 T$=T$+"0" -2070 T$=T$+right$(str$(M),len(str$(M))-1) -2080 T$=T$+":" -2090 if (S>9) GOTO 2110 -2100 T$=T$+"0" -2110 T$=T$+right$(str$(S),len(str$(S))-1) -2120 RETURN - -2999 REM set the clock using H, M, S -3000 TS=INT(S/10) -3010 OS=S-(TS*10) -3020 OUT &HC0, TS*16 + OS -3030 TM=INT(M/10) -3040 OM=M-(TM*10) -3050 OUT &HC2, TM*16 + OM -3060 TH=INT(H/10) -3070 OH=H-(TH*10) -3080 OUT &HC4, TH*16 + OH -3090 RETURN |