Bus error handling problem

News,announcements,programming,fixes,game patches & discussions.

Moderator: troed

User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Bus error handling problem

Post by exxos »

I honestly cannot remember who wrote this routine...

Code: Select all

*-----------------------------------------------------------------------------*
EXXOS_BusErrorTest:
*-----------------------------------------------------------------------------*
	move.l 		bas_params(pc),a0		; a0 = basic variable ptr
	move.l		(a0),a1				; a1 = basic variable (address to test)
	move.l		sp,d2				; d2 = old stack pointer
	move.l		$8,d1				; d1 = old berr handler

	move.w		#.berr-EXXOS_BusErrorTest,d3	; d3 = err handler offset
	lea		EXXOS_BusErrorTest(pc,d3.w),a2	; a2 = err handler absolute address
	move.l		a2,$8				; set new berr handler

	move.l		(a1),d0				; read from address
	move.l		d1,$8				; restore berr handler
	move.l		#1,(a0)				; return 1
	rts
.berr:
	move.l		d2,sp				; restore stack to before berr
	move.l		d1,$8				; restore berr handler
	move.l		#0,(a0)				; return 0
	rts
Maybe someone have some ideas as to what is going on with it. IIRC was working when I would test a RAM location, basically because that location is used to returned a value back to BASIC code.

So I did a test routine where I could return to separate values by doing this..

Code: Select all

	move.l 		bas_params(pc),a0		; a0 = basic variable ptr    6 ?
	move.l		(a0),a1				; a1 = basic variable (address to test) FF8964   
 	move.l		#1234,(a0)			; return 1234 in X&
	move.l		#5678,4(a0)			; return 5678 in Y&
	rts
And this correctly returns the value to BASIC.

Capture.PNG
Capture.PNG (5.94 KiB) Viewed 1637 times


So I make the assumption that return 1 and return 0 get changed from #0,(a0) TO #0,4(a0) as that is what worked in my test routine.

However something has broken in the bus error handler and I have no idea what. I thought it was down to those code changes but even if I comments them out the handler crashes :(

If I simply put a RTS the start of the code then things don't crash. So definitely wrong with that bus error handler routine somehow :shrug:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Bus error handling problem

Post by exxos »

When I call the routine I have been passing the actual address as a parameter EG:

Code: Select all

 t&=&HFF8964 
  Y&=66666
 call loc testcode&,EXXOS_BusErrorTest,t& ,varptr(Y&)
Which bomns out.


But passing the RAM pointer to the variable doesn't crash, but it returns 0 regardless of it the address is valid or not.

Code: Select all

 t&=&HFF8964 
  Y&=66666
 call loc testcode&,EXXOS_BusErrorTest,varptr(t&) ,varptr(Y&)

EDIT:

Must be something else broken somewhere as if I copy the working code into the BUSERROR routine and just RTS early, it doesn't return #1234 :WTF:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Bus error handling problem

Post by exxos »

FFS!

I used t& as a variable and it NEVER returned a value. I changed it to X& and now its starting to behave.. and t& isn't even used anywhere in the program :WTF: Feking bonkers faults again :pullhair: :headbang:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
mrbombermillzy
Posts: 1441
Joined: Sun Jun 03, 2018 7:37 pm

Re: Bus error handling problem

Post by mrbombermillzy »

Are we good now then?
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Bus error handling problem

Post by exxos »

Sooo..

STEEM - no Flashyclock

1.PNG
1.PNG (65.22 KiB) Viewed 1606 times


Real hardware with FC

IMG_0588.JPG
IMG_0588.JPG (32.43 KiB) Viewed 1606 times

So no feking idea why hisoft basic didn't like that variable name. I hate computers!

:comp:


and proof..

Capture.PNG
Capture.PNG (42 KiB) Viewed 1604 times

It's not just because its lower case either. Only possible thing is if t& is some internal thing :shrug: eitherway, waste 2 days just working that out :roll: :headbang:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
Badwolf
Posts: 2231
Joined: Tue Nov 19, 2019 12:09 pm

Re: Bus error handling problem

Post by Badwolf »

Glad you've got it sorted out.

Since you're doubtlessly feeling completely better and not at all sore about it any more, can we now go back to taking the Gipsy Kiss out of you for using a Noddy language?

Too soon..?

;)

BW
DFB1 Open source 50MHz 030 and TT-RAM accelerator for the Falcon
DSTB1 Open source 16Mhz 68k and AltRAM accelerator for the ST
Smalliermouse ST-optimised USB mouse adapter based on SmallyMouse2
FrontBench The Frontier: Elite 2 intro as a benchmark
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Bus error handling problem

Post by exxos »

Badwolf wrote: Tue May 17, 2022 11:11 pm Since you're doubtlessly feeling completely better and not at all sore about it any more, can we now go back to taking the Gipsy Kiss out of you for using a Noddy language?
:chairsmack:


It's always me which finds bonkers bugs in stuff regardless of what I use :roll: It's not like I even code much of anything :roll:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Bus error handling problem

Post by exxos »

There is still something odd going on :roll:

Would this code work for WORD or BYTE access ? I can peek a byte or word in STOS and I get a number back, but a LONG I get BERR. Fair enough. But this code looks like it deals with longs ? So would that screw up WORD access checks ?!

Code: Select all

	move.l 		bas_params(pc),a0		; a0 = basic variable ptr    6 ?
	move.l		(a0),a1				; a1 = basic variable (address to test) FF8964 
  
	move.l		sp,d2				; d2 = old stack pointer
	move.l		$8,d1				; d1 = old berr handler

	move.w		#.berr-EXXOS_BusErrorTest,d3	; d3 = err handler offset
	lea		EXXOS_BusErrorTest(pc,d3.w),a2	; a2 = err handler absolute address
	move.l		a2,$8				; set new berr handler

	move.l		(a1),d0				; read from address
	move.l		d1,$8				; restore berr handler

	move.l		#1,4(a0)				; return 1
	rts
.berr:
	move.l		d2,sp				; restore stack to before berr
	move.l		d1,$8				; restore berr handler

	move.l		#0,4(a0)				; return 0
	rts
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Bus error handling problem

Post by exxos »

OK so doing

Code: Select all

move.w		(a1),d0	
Seems to work now..
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
Post Reply

Return to “SOFTWARE PROGRAMMING & DISCUSSION”