Reading Kernal version

Chat about anything CX16 related that doesn't fit elsewhere
Stefan
Posts: 456
Joined: Thu Aug 20, 2020 8:59 am

Reading Kernal version

Post by Stefan »


Hi,

I was struggling a bit with reading the Kernal version number in an assembly program that is to support both R38 and R39.

As is apparent from the PRG, the Kernal version is stored in ROM bank 0/$ff80.

The problem I had was that you are not in ROM bank 0 when starting an assembly program from BASIC. Reading $ff80 in the BASIC ROM bank does not give you the version number.

And to change ROM bank you need to know what version is used. Almost like "catch 22".

I found a solution using the Kernal function FETVEC ($ff74) that is callable from the BASIC ROM bank, getting the version number like this:

lda #$80

sta $22

lda #$ff

sta $23

ldx #$00

lda #$22

jsr $ff74

And then you have the version number in A.

Lorin Millsap
Posts: 193
Joined: Wed Apr 29, 2020 6:46 pm

Reading Kernal version

Post by Lorin Millsap »

There is no reason to support R38 as R38 doesn’t reflect the real hardware. You should shift your code to R39 or have separate binaries as R39 doesn’t have an official release yet.


Sent from my iPhone using Tapatalk
ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Reading Kernal version

Post by ZeroByte »


Isn't there an IO address to ask the emu what version it is?

Another idea might be to do something like

stz $00

stz $bfff

lda #1

sta $00

sta $bfff

stz $00

cmp $bfff

beq R39

.R38:

 

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Reading Kernal version

Post by ZeroByte »



4 minutes ago, Lorin Millsap said:




There is no reason to support R38 as R38 doesn’t reflect the real hardware. You should shift your code to R39 or have separate binaries as R39 doesn’t have an official release yet.



I'm sure there are lots of behind-the-scenes reasons why this hasn't happened, but would it be possible to get someone to push the "R39 = official" button on the Github repo? My R39 workarounds include doing some manual things because cc65 gets broken on R39, and there are other tool chain projects like Prog8 etc which are also in limbo until this major revision gets officially blessed. I'm intentionally keeping my tools frozen as long as R38 is the official version, and I've read posts here and elsewhere by those who are ready to merge updates into cc65, etc.

User avatar
Yazwho
Posts: 169
Joined: Fri Feb 19, 2021 2:59 pm
Contact:

Reading Kernal version

Post by Yazwho »



12 minutes ago, Lorin Millsap said:




There is no reason to support R38



R39 doesn’t have an official release yet.



...

Lorin Millsap
Posts: 193
Joined: Wed Apr 29, 2020 6:46 pm

Reading Kernal version

Post by Lorin Millsap »

I'm sure there are lots of behind-the-scenes reasons why this hasn't happened, but would it be possible to get someone to push the "R39 = official" button on the Github repo? My R39 workarounds include doing some manual things because cc65 gets broken on R39, and there are other tool chain projects like Prog8 etc which are also in limbo until this major revision gets officially blessed. I'm intentionally keeping my tools frozen as long as R38 is the official version, and I've read posts here and elsewhere by those who are ready to merge updates into cc65, etc.

The reason it hasn’t been pushed is there are some hardware things having to do with keyboard and mouse handling which haven’t been tested on real hardware yet. However the R39 is there and can be compiled, and so long as you are using Kernal routines it should work. Personally I think R39 should be pushed and if it turns out we need to make some hardware changes we can push out an R40 release.


Sent from my iPhone using Tapatalk
TomXP411
Posts: 1785
Joined: Tue May 19, 2020 8:49 pm

Reading Kernal version

Post by TomXP411 »



21 minutes ago, Lorin Millsap said:






The reason it hasn’t been pushed is there are some hardware things having to do with keyboard and mouse handling which haven’t been tested on real hardware yet. However the R39 is there and can be compiled, and so long as you are using Kernal routines it should work. Personally I think R39 should be pushed and if it turns out we need to make some hardware changes we can push out an R40 release.



Thank you.

The change to the bank registers alone is more than enough reason to publish R39. We all know and accept that the hardware will not perfectly match the emulator, but I think it's still important to stay up to date with the latest ROM changes and hardware changes we do know about. Combined with the other changes, it's more important at this point to have the latest code than the "best" code, IMO. 

 

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Reading Kernal version

Post by ZeroByte »



5 minutes ago, Lorin Millsap said:




Personally I think R39 should be pushed and if it turns out we need to make some hardware changes we can push out an R40 release.



I couldn't agree more.

Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Reading Kernal version

Post by Scott Robison »



21 minutes ago, Lorin Millsap said:




Personally I think R39 should be pushed and if it turns out we need to make some hardware changes we can push out an R40 release.



+1

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

Reading Kernal version

Post by SlithyMatt »


image.png.1ef2cbf9e3ea33620cf8c60b4b687eae.png

Post Reply