a0 (08FA000C), jsr (a0), pc -> 00FA000C ?

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
aag
Atari maniac
Atari maniac
Posts: 83
Joined: Wed May 09, 2007 9:20 pm
Location: West Yorkshire, UK
Contact:

a0 (08FA000C), jsr (a0), pc -> 00FA000C ?

Post by aag »

Hi - any explanations as to what actually happening here?

(Using steem boiler to look at TOS booting of rom cartidge).

As screenshot show
Steem.JPG
A0 has 08FA000C
about to execute jsr (a0)
the PC gets sets to 00FA000C

What happened to the 08?

The motorola manual M68000PRM.pdf says ": Pushes the long-word address of the instruction immediately following the JSR instruction onto the system stack."

That should be the full 32 bits? I don't really understand - can anyone help explain?

Thanks

PS If this is tied to

CA_INIT being defined as 4 bytes - with the highest byte (bits 24..31 being the "trigger for execution) - IF that byte doesn't make it into the PC.


My asm is below - but trying to marry this back to the docs (as main aim is to create some c code/custom linker script/startup code)


CARTRIDGE APPLICATION HEADER
+-----------------------+
| CA_NEXT | 0 ->next header
| |
+-----------------------+
| CA_INIT | 4 ->init code
| |
+-----------------------+
| CA_RUN | 8 ->run code
| |
+-----------------------+
| CA_TIME | $c DOS time
+-----------------------+
| CA_DATE | $e DOS date
+-----------------------+
| CA_SIZE | $10 "size" of appl.
| |
+-----------------------+
| CA_NAME | $14 asciz name
| | (NNNNNNNN.EEE\0)
| |
| |
+-----------------------+



ORG $FA0000
START
dc.l $ABCDEF42


CA_NEXT
dc.l 0
CA_RUN
dc.l $08000000+(ROOTBOOT)

ROOTBOOT
PEA helwtxt
MOVE.W #9,-(A7)
TRAP #1
ADDQ.L #6,A7

JMP ROOTBOOT

helwtxt
dc.b 'Hello World!',$0D,$0A,$00
DS 0

END START
You do not have the required permissions to view the files attached to this post.
Zippy
Atari Super Hero
Atari Super Hero
Posts: 532
Joined: Sun Feb 01, 2004 1:58 am

Re: a0 (08FA000C), jsr (a0), pc -> 00FA000C ?

Post by Zippy »

The address registers are 32 bits wide but the address bus is only 24 bits.
czietz
Hardware Guru
Hardware Guru
Posts: 2573
Joined: Tue May 24, 2016 6:47 pm

Re: a0 (08FA000C), jsr (a0), pc -> 00FA000C ?

Post by czietz »

Zippy wrote: Sat Feb 24, 2024 7:36 pm The address registers are 32 bits wide but the address bus is only 24 bits.
Still PC is 32 bits, too, and a JSR 0x08FA000C will in fact put 0x08FA000C into PC. Maybe the Steem version of the OP gets it wrong. Steem SSE 4.1.2 does it correctly, though:
steem.png
(EDIT: So does Hatari.)
You do not have the required permissions to view the files attached to this post.
ijor
Hardware Guru
Hardware Guru
Posts: 4625
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: a0 (08FA000C), jsr (a0), pc -> 00FA000C ?

Post by ijor »

I suspect this is just a cosmetic buglet in the Boiler. Steem always processed the 32 bits in the PC, otherwise lot of code would break (even some TOS versions, IIRC).
Fx Cast: Atari St cycle accurate fpga core
aag
Atari maniac
Atari maniac
Posts: 83
Joined: Wed May 09, 2007 9:20 pm
Location: West Yorkshire, UK
Contact:

Re: a0 (08FA000C), jsr (a0), pc -> 00FA000C ?

Post by aag »

Thanks all.

Last time I looked at this (I was looking at "tos3x" sources - which explicitly removed the top byte

move.l 4(a0),d0 /* d0 = address of cartridge init */
and.l #$00ffffff,d0 /* make it 24-bit clean */
movea.l d0,a0
jsr (a0) /* execute app in cartridge */

Whereas I was on my other machine/with Steem using tos 1.02 (which doesn't clear the top byte clear), and the UI was showing 1 thing and I kinda forgot about the 24 bit on plain 68000.

Yep - makes sense/thanks!
Post Reply

Return to “680x0”