prodos-drivers/cricket/date.s

128 lines
3.1 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"
2019-09-29 03:14:53 +00:00
2019-10-04 04:23:00 +00:00
.include "../inc/apple2.inc"
.include "../inc/macros.inc"
.include "../inc/prodos.inc"
2017-12-03 05:35:50 +00:00
start:
2019-09-29 03:14:53 +00:00
MLI_CALL GET_TIME, 0
2017-12-03 05:35:50 +00:00
;;; Standard format:
;;;
;;; 49041 ($BF91) 49040 ($BF90)
;;; 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;; DATE: | year | month | day |
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;;
;;; 49043 ($BF93) 49042 ($BF92)
;;; 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;; TIME: |0 0 0| hour | |0 0| minute |
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;;
;;; Extended format (ProDOS 2.5):
;;; https://groups.google.com/d/topic/comp.sys.apple2/6MwlJSKTmQc/discussion
;;;
;;; 49039 ($BF8F) 49038 ($BF8E)
;;; 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;; xTIME: | xSeconds | xMilliseconds |
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;;
;;; 49041 ($BF91) 49040 ($BF90)
;;; 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;; DATE: | year | month | day |
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;;
;;; 49043 ($BF93) 49042 ($BF92)
;;; 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
;;; TIME: |xYear| hour | |0 0| minute |
;;; +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
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
;; TODO: Shift in xYear bits
jsr cout_number ; TODO: Support 16-bit numbers
2017-12-03 05:35:50 +00:00
2017-12-08 04:49:53 +00:00
lda #HI(' ')
jsr COUT
jsr COUT
;; Time
lda TIMELO+1 ; hour
and #%00011111
2017-12-08 04:49:53 +00:00
jsr cout_number
lda #HI(':') ; ':'
jsr COUT
lda TIMELO ; minute
and #%00111111
2017-12-08 04:49:53 +00:00
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