clock.asm
;
; tape buffer is 033c-03fb (828-1019) 192 bytes
*= $033c
; dc08 - BCD 10ths of seconds (read to restart clock)
; dc09 - BCD seconds (bit7:0)
; dc0a - BCD minutes (bit7:0)
; dc0b - BCD hours (bit7:0-AM, 1-PM)
; Writing hours stops the clock until dc08 read.
start: sei ; turn off
lda #$49
sta $0314 ; store lobyte
lda #$03
sta $0315 ; store hibyte
cli
rts
check: lda $dc09
cmp seconds ; changed?
beq end ; nope
sta seconds
clock: lda #103 ; left border
sta $0420 ; &
lda #$00 ; load black
sta $d820
ldx #$06 ; rowsize-1
lda #99 ; bottom border
loop1: sta $0449,x ; &&&&&&&&
dex
bpl loop1 ; loop 7 times
lda #$00 ; load black
ldx #$06 ; rowsize-1
loop2: sta $d821,x ; @@@@@@@@
sta $d849,x ; @@@@@@@@
dex
bpl loop2 ; loop 8 times
ldx #$00 ; start of window
ldy #$02 ; numbytes-1
loop3: lda $dc09,y ; load tod,y
and #$7f ; strip hi bit
pha ; store it
lsr
lsr
lsr ; get to
lsr ; hi nybble
ora #$30 ; go ascii
sta $0421,x ; inside box
pla ; get save value
and #$0f ; get lo nybble
ora #$30 ; go ascii
inx ; bump box pointer
sta $0421,x ; inside box
inx
dey
bpl loop3
lda $dc0b ; load hours
and #$80 ; keep hi bit
bne pm
lda #$01 ; load 'a'
bne notpm
pm: lda #$10 ; load 'p'
notpm: sta $0427 ; end of box
end: lda $dc08 ; start clock
jmp $ea31
seconds: dsb 1
clock.bas
1 ps=828:si=112
2 for x=0 to si-1:read d:poke ps+x,d:next x
3 print"sys828"
4 data 120,169, 73,141, 20, 3,169, 3,141, 21
5 data 3, 88, 96,173, 9,220,205,171, 3,240
6 data 84,141,171, 3,169,103,141, 32, 4,169
7 data 0,141, 32,216,162, 6,169, 99,157, 73
8 data 4,202, 16,250,169, 0,162, 6,157, 33
9 data 216,157, 73,216,202, 16,247,162, 0,160
10 data 2,185, 9,220, 41,127, 72, 74, 74, 74
11 data 74, 9, 48,157, 33, 4,104, 41, 15, 9
12 data 48,232,157, 33, 4,232,136, 16,228,173
13 data 11,220, 41,128,208, 4,169, 1,208, 2
14 data 169, 16,141, 39, 4,173, 8,220, 76, 49
15 data 234, 0
30 rem set clock
40 input "am or pm (one letter)";ap$
50 if ap$<>"a" and ap$<>"p" then 40
60 ap=0:if ap$="p"then ap=128
70 input "hours (0-12): ";h
80 if h<0 or h>12 then 70
90 h1%=h/10:h2=h-h1%*10:h3=h1%*16+h2+ap
100 poke 56331,h3
110 input "minutes(0-59): ";m
120 if m<0 or m>59 then 110
130 m1%=m/10:m2=m-m1%*10:m3=m1%*16+m2
140 poke 56330,m3
150 input "seconds(0-59): ";s
160 if s<0 or m>59 then 150
170 s1%=s/10:s2=s-s1%*10:s3=s1%*16+s2
180 poke 56329,s3
190 rem start clock
200 poke 56328,0