REMINDER - Stay logged in for at least 2 hours a week to get whitelisted.
Also it helps build a picture where our "good traffic" is coming from for detection scripts.
:o)

Bus error handling problem

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

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


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:
You do not have the required permissions to view the files attached to this post.
User avatar
exxos
Site Admin
Site Admin
Posts: 28594
Joined: 16 Aug 2017 23:19
Location: UK

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

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

Re: Bus error handling problem

Post by mrbombermillzy »

Are we good now then?
User avatar
exxos
Site Admin
Site Admin
Posts: 28594
Joined: 16 Aug 2017 23:19
Location: UK

Re: Bus error handling problem

Post by exxos »

Sooo..

STEEM - no Flashyclock

1.PNG


Real hardware with FC

IMG_0588.JPG

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

:comp:


and proof..

Capture.PNG

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:
You do not have the required permissions to view the files attached to this post.
User avatar
Badwolf
Site sponsor
Site sponsor
Posts: 3057
Joined: 19 Nov 2019 12:09

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
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: 28594
Joined: 16 Aug 2017 23:19
Location: UK

Re: Bus error handling problem

Post by exxos »

Badwolf wrote: 17 May 2022 23:11 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:
User avatar
exxos
Site Admin
Site Admin
Posts: 28594
Joined: 16 Aug 2017 23:19
Location: UK

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

Re: Bus error handling problem

Post by exxos »

OK so doing

Code: Select all

move.w		(a1),d0	
Seems to work now..
User avatar
sporniket
Site sponsor
Site sponsor
Posts: 1169
Joined: 26 Sep 2020 21:12
Location: France

Re: Bus error handling problem

Post by sporniket »

It looks like accessing a1+2 does trigger the error handler then ?

Return to “SOFTWARE PROGRAMMING & DISCUSSION”

Who is online

Users browsing this forum: ClaudeBot and 6 guests