You will not be able to post if you are still using Microsoft email addresses such as Hotmail etc
See here for more information viewtopic.php?f=20&t=7296
BOOKMARK THIS PAGE !
https://www.exxosforum.co.uk:8085/IP_CHECK/
You can unban yourself if needed. It also sends me reports to investigate the ban.
DO NOT USE MOBILE / CGNAT DEVICES WHERE THE IP CHANGES CONSTANTLY!
At this time, it is unfortunately not possible to whitelist users when your IP changes constantly.
You may inadvertently get banned because a previous attack may have used the IP you are now on.
So I suggest people only use fixed IP address devices until I can think of a solution for this problem!

Converting HISOFT to 68K ASM "almost" works

News,announcements,programming,fixes,game patches & discussions.
User avatar
exxos
Site Admin
Site Admin
Posts: 28155
Joined: 16 Aug 2017 23:19
Location: UK

Re: Converting HISOFT to 68K ASM "almost" works

Post by exxos »

Theres another routine in the mix..

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 :roll:
User avatar
mrbombermillzy
Moderator
Moderator
Posts: 2266
Joined: 03 Jun 2018 19:37

Re: Converting HISOFT to 68K ASM "almost" works

Post by mrbombermillzy »

Ok, yes, guessing at the HS BASIC language constructs, that looks to be correct.

Can you find any references to register offset $09h?

(Probably called something else in BASIC or the assembly, but both must set the name with a reference to memory location Base address of RTC registers + $09h.)
User avatar
exxos
Site Admin
Site Admin
Posts: 28155
Joined: 16 Aug 2017 23:19
Location: UK

Re: Converting HISOFT to 68K ASM "almost" works

Post by exxos »

mrbombermillzy wrote: 09 Feb 2026 19:40 Can you find any references to register offset $09h?
The INIT routine has

Code: Select all

'SET YEAR TO 20
POKEW (RTC_ADDRESS&),&B1111111100001001    ' SET ADDRESS 09H
POKEW (RTC_DATA_ADDRESS&),&B1111111100010100
After that it takes the value the user sets in the clock setter program.

It reads and writes fine there, it shows all correct time and date.

The assembly program reads the correct value, but seems to somehow end up with 28 for the year in control panel.
User avatar
mrbombermillzy
Moderator
Moderator
Posts: 2266
Joined: 03 Jun 2018 19:37

Re: Converting HISOFT to 68K ASM "almost" works

Post by mrbombermillzy »

Ok, lets roll back to a good place to start. How about changing this:

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
to this:

Code: Select all

* Year (reg 9)
	move.w	#$FF09,(RTC_ADDR)
	clr.l	d0
	move.w	(RTC_DATA),d0  ; save YR in d0
In your 2nd code example just before my first reply on page 1.

As Im not sure what format GEM expects the answer, you might also have to try:

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 
Ive added some extra 'failsafe' instructions (namely possibly clearing any garbage data in d0) to the above routines just in case thats the bug.
User avatar
exxos
Site Admin
Site Admin
Posts: 28155
Joined: 16 Aug 2017 23:19
Location: UK

Re: Converting HISOFT to 68K ASM "almost" works

Post by exxos »

Its this code which is the "best" one

viewtopic.php?p=139538#p139538

I tried it again, and the year gets output as 26, but now CP is set to 42 as the year... :stars:

With your changes..

debug year shows 0, year in CP still shows 42 .

My brain hurts..
User avatar
mrbombermillzy
Moderator
Moderator
Posts: 2266
Joined: 03 Jun 2018 19:37

Re: Converting HISOFT to 68K ASM "almost" works

Post by mrbombermillzy »

Ok, it seems there is some sort of data transform/adjustment either somewhere else, or in the GEM end. Let me have a look...
User avatar
mrbombermillzy
Moderator
Moderator
Posts: 2266
Joined: 03 Jun 2018 19:37

Re: Converting HISOFT to 68K ASM "almost" works

Post by mrbombermillzy »

Ok, apparently the year is stored in the high byte.

So try changing the 2nd attempt code again with:

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 
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).
User avatar
exxos
Site Admin
Site Admin
Posts: 28155
Joined: 16 Aug 2017 23:19
Location: UK

Re: Converting HISOFT to 68K ASM "almost" works

Post by exxos »

mrbombermillzy wrote: 09 Feb 2026 20:21 Ok, apparently the year is stored in the high byte.

So try changing the 2nd attempt code again with:

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 
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).
Didn't see that one no.. but the year just comes back as zero ago..

The read of the year seems fine, its writing it to GEMDOS which seems where things go nuts.
User avatar
mrbombermillzy
Moderator
Moderator
Posts: 2266
Joined: 03 Jun 2018 19:37

Re: Converting HISOFT to 68K ASM "almost" works

Post by mrbombermillzy »

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

Im sure the routine that does the conversion needs further study then... :coffee:
User avatar
mrbombermillzy
Moderator
Moderator
Posts: 2266
Joined: 03 Jun 2018 19:37

Re: Converting HISOFT to 68K ASM "almost" works

Post by mrbombermillzy »

This then is that part of the code:

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
Im going to have to bail out in a minute (sorry), but I will see if I can quickly find anything obvious.

Return to “SOFTWARE PROGRAMMING & DISCUSSION”

Who is online

Users browsing this forum: CCBot and 11 guests