prodos-drivers/date.s

86 lines
1.5 KiB
ArmAsm
Raw Normal View History

2017-12-08 05:48:41 +00:00
;;; Query ProDOS and print the current date/time
;;; (No dependency on Cricket clock)
;;; Output is: MM/DD/YY HH:MM
2017-12-03 05:35:50 +00:00
.setcpu "6502"
.org $2000
.include "apple2.inc"
.include "common.inc"
start:
PRODOS_CALL MLI_GET_TIME, 0
2017-12-08 04:49:53 +00:00
;; Date
2017-12-03 05:35:50 +00:00
lda DATELO+1 ; month
ror a
pha
lda DATELO
pha
rol a
rol a
rol a
rol a
and #%00001111
jsr cout_number
2017-12-08 04:49:53 +00:00
lda #HI('/') ; /
2017-12-03 05:35:50 +00:00
jsr COUT
pla ; day
and #%00011111
jsr cout_number
2017-12-08 04:49:53 +00:00
lda #HI('/') ; /
2017-12-03 05:35:50 +00:00
jsr COUT
pla ; year
jsr cout_number
2017-12-08 04:49:53 +00:00
lda #HI(' ')
jsr COUT
jsr COUT
;; Time
lda TIMELO+1 ; hour
jsr cout_number
lda #HI(':') ; ':'
jsr COUT
lda TIMELO ; minute
jsr cout_number
2017-12-03 05:35:50 +00:00
jsr CROUT
rts
2017-12-08 04:49:53 +00:00
pm_flag:
.byte 0
;;; ------------------------------------------------------------
2017-12-03 05:35:50 +00:00
.proc cout_number
2017-12-08 04:49:53 +00:00
ldx #HI('0')
2017-12-03 05:35:50 +00:00
cmp #10 ; >= 10?
bcc tens
;; divide by 10, dividend(+'0') in x remainder in a
: sbc #10
inx
cmp #10
bcs :-
tens: pha
txa
jsr COUT
units: pla
2017-12-08 04:49:53 +00:00
ora #HI('0')
2017-12-03 05:35:50 +00:00
jsr COUT
rts
.endproc