Page 1 of 4

Reading Kernal version

Posted: Wed Jul 21, 2021 6:50 pm
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.


Reading Kernal version

Posted: Wed Jul 21, 2021 8:00 pm
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

Reading Kernal version

Posted: Wed Jul 21, 2021 8:03 pm
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:

 


Reading Kernal version

Posted: Wed Jul 21, 2021 8:12 pm
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.


Reading Kernal version

Posted: Wed Jul 21, 2021 8:13 pm
by Yazwho


12 minutes ago, Lorin Millsap said:




There is no reason to support R38



R39 doesn’t have an official release yet.



...


Reading Kernal version

Posted: Wed Jul 21, 2021 8:24 pm
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

Reading Kernal version

Posted: Wed Jul 21, 2021 8:28 pm
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. 

 


Reading Kernal version

Posted: Wed Jul 21, 2021 8:30 pm
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.


Reading Kernal version

Posted: Wed Jul 21, 2021 8:45 pm
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


Reading Kernal version

Posted: Wed Jul 21, 2021 8:49 pm
by SlithyMatt

image.png.1ef2cbf9e3ea33620cf8c60b4b687eae.png