109 lines
2.5 KiB
Plaintext
109 lines
2.5 KiB
Plaintext
JSR SYS_READ_CALENDAR ;outputs calendar date to BIOS RAM
|
|
|
|
MOVE.B #'2',D0 ;a character in single or double quotes refers to its ascii equivalent.
|
|
JSR PrintChar
|
|
MOVE.B #'0',D0
|
|
JSR PrintChar
|
|
|
|
LEA BIOS_YEAR,A1
|
|
MOVE.B (A1)+,D0 ;stores last 2 digits of year into D0, in binary coded decimal
|
|
JSR UnpackNibbles8 ;separate the digits into high and low nibbles: D0 = 00020001
|
|
ADD.L #$00300030,D0 ;convert both numerals to their ascii equivalents.
|
|
SWAP D0 ;print the "2" first
|
|
JSR PrintChar
|
|
SWAP D0 ;then the "1"
|
|
JSR PrintChar
|
|
|
|
MOVE.B #'-',D0
|
|
JSR PrintChar
|
|
|
|
MOVE.B (A1)+,D0 ;get the month
|
|
JSR UnpackNibbles8
|
|
ADD.L #$00300030,D0
|
|
SWAP D0
|
|
JSR PrintChar
|
|
SWAP D0
|
|
JSR PrintChar
|
|
|
|
MOVE.B #'-',D0
|
|
JSR PrintChar
|
|
|
|
MOVE.B (A1)+,D0 ;get the day
|
|
JSR UnpackNibbles8
|
|
ADD.L #$00300030,D0
|
|
SWAP D0
|
|
JSR PrintChar
|
|
SWAP D0
|
|
JSR PrintChar
|
|
|
|
;now the date is printed.
|
|
|
|
;Now do it again only written out:
|
|
jsr NewLine
|
|
|
|
CLR.L D0 ;reset D0
|
|
MOVE.B (A1),D0 ;A1 happens to point to the weekday
|
|
LSL.W #2,D0 ;we are indexing into a table of longs
|
|
LEA Days_Lookup,A2
|
|
LEA (A2,D0),A2
|
|
MOVEA.L (A2),A3 ;dereference the pointer into A3, which the PrintString routine takes as an argument.
|
|
|
|
JSR PrintString
|
|
|
|
CLR.L D0
|
|
LEA BIOS_MONTH,A1 ;GET THE MONTH
|
|
MOVE.B (A1)+,D0
|
|
LSL.W #2,D0
|
|
LEA Months_Lookup,A2
|
|
LEA (A2,D0),A2
|
|
MOVEA.L (A2),A3
|
|
|
|
JSR PrintString
|
|
|
|
MOVE.B (A1),D0 ;GET THE DAY
|
|
JSR UnpackNibbles8
|
|
ADD.L #$00300030,D0
|
|
SWAP D0
|
|
JSR PrintChar
|
|
SWAP D0
|
|
JSR PrintChar
|
|
|
|
MOVE.B #',',D0
|
|
JSR PrintChar
|
|
MOVE.B #' ',D0
|
|
JSR PrintChar
|
|
|
|
MOVE.B #'2',D0
|
|
JSR PrintChar
|
|
MOVE.B #'0',D0
|
|
JSR PrintChar
|
|
|
|
LEA BIOS_YEAR,A1
|
|
MOVE.B (A1)+,D0 ;stores last 2 digits of year into D0, in binary coded decimal
|
|
JSR UnpackNibbles8 ;separate the digits into high and low nibbles: D0 = 00020001
|
|
ADD.L #$00300030,D0 ;convert both numerals to their ascii equivalents.
|
|
SWAP D0 ;print the "2" first
|
|
JSR PrintChar
|
|
SWAP D0 ;then the "1"
|
|
JSR PrintChar
|
|
|
|
forever:
|
|
bra forever ;trap the program counter
|
|
|
|
UnpackNibbles8:
|
|
; INPUT: D0 = THE VALUE YOU WISH TO UNPACK.
|
|
; HIGH NIBBLE IN HIGH WORD OF D0, LOW NIBBLE IN LOW WORD. SWAP D0 TO GET THE OTHER HALF.
|
|
pushWord D1
|
|
CLR.W D1
|
|
MOVE.B D0,D1
|
|
CLR.L D0
|
|
MOVE.B D1,D0 ;now D0 = D1 = $000000II, where I = input
|
|
|
|
AND.B #$F0,D0 ;chop off bottom nibble
|
|
LSR.B #4,D0 ;downshift top nibble into bottom nibble of the word
|
|
SWAP D0 ;store in high word
|
|
AND.B #$0F,D1 ;chop off bottom nibble
|
|
MOVE.B D1,D0 ;store in low word
|
|
popWord D1
|
|
rts
|