forcing DM=1 (binary mode) here
DATA% = BITSET%(2,DATA%) ' SET BINARY MODE
so as it reads back as 1 that must be correct.
I forgot its a multiplexed bus which is confusing things as well

The INIT routine has
Code: Select all
'SET YEAR TO 20
POKEW (RTC_ADDRESS&),&B1111111100001001 ' SET ADDRESS 09H
POKEW (RTC_DATA_ADDRESS&),&B1111111100010100
Code: Select all
* Year (reg 9)
move.w #$FF09,(RTC_ADDR)
move.w (RTC_DATA),d0
sub.w #$FF00,d0
move.w d0,d7 ; save YR in d7
Code: Select all
* Year (reg 9)
move.w #$FF09,(RTC_ADDR)
clr.l d0
move.w (RTC_DATA),d0 ; save YR in d0
Code: Select all
* Year (reg 9)
move.w #$FF09,(RTC_ADDR)
clr.l d0
move.w (RTC_DATA),d0
andi.w #$00FF,d0 ; cut top byte values
Code: Select all
* Year (reg 9)
move.w #$FF09,(RTC_ADDR)
clr.l d0
move.w (RTC_DATA),d0
andi.w #$FF00,d0 ; cut bottom byte values


Code: Select all
* Year (reg 9)
move.w #$FF09,(RTC_ADDR)
clr.l d0
move.w (RTC_DATA),d0
andi.w #$FF00,d0 ; cut bottom byte values
Didn't see that one no.. but the year just comes back as zero ago..mrbombermillzy wrote: Mon Feb 09, 2026 8:21 pm Ok, apparently the year is stored in the high byte.
So try changing the 2nd attempt code again with:
Im not sure you tried this, as I was editing my post with failsafe test values when you answered. (Read the post 3 places up; I think this is the option you need).Code: Select all
* Year (reg 9) move.w #$FF09,(RTC_ADDR) clr.l d0 move.w (RTC_DATA),d0 andi.w #$FF00,d0 ; cut bottom byte values

Looks like its using GEMDOS function $09 PRINT LINE which converts numerical data into character data.exxos wrote: Mon Feb 09, 2026 8:31 pm The read of the year seems fine, its writing it to GEMDOS which seems where things go nuts.

Code: Select all
* PRINT_NUM: prints 0-99 as decimal string + CRLF (no leading zero)
PRINT_NUM:
movem.l d1/a1,-(sp)
lea BUFFER(PC),a1
cmpi.w #10,d0
bcs.s .one
clr.l d1 ; clear high word for clean dividend
move.w d0,d1
divu.w #10,d1
swap d1 ; remainder in low
addi.b #'0',d1
move.b d1,1(a1) ; units
swap d1 ; quotient in low
addi.b #'0',d1
move.b d1,(a1) ; tens
moveq #2,d1
bra.s .out
.one:
addi.b #'0',d0
move.b d0,(a1)
moveq #1,d1
.out:
clr.b (a1,d1.w)
pea (a1)
move.w #9,-(sp)
trap #1
addq.l #6,sp
pea CRLF(PC)
move.w #9,-(sp)
trap #1
addq.l #6,sp
movem.l (sp)+,d1/a1
rts