6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 9:22 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Jun 11, 2020 11:47 pm 
Offline

Joined: Fri Nov 16, 2018 8:55 pm
Posts: 71
I'm continuing work on disassembling and commenting the code on a a game cartridge. It's slow going, because I'm filling gaps in my modest 6502 assembly language programming as I go.

One of the oddball things I noticed while looking at the code is this this:

Code:
      lda #$03      ;0x8025   2   a903   ; Likely a bit flag of %00000011
      sta $01       ;0x8027   2   8501   ; Write $03 (%00000011) to ZP $01, the cassette data line.


That looks like it's enabling writes to the cassette data line. But, I haven't spotted any writes to the cassette buffer. So, unless I've missed something there is no data actually being written to the cassette port itself.

Is this common in cartridge cold start routines? If so, why? Is it possible this is debug code intended to allow the cassette to be used as, well, something like a core dump target?


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 12, 2020 12:09 am 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
The 6510's "processor port" is not only used for the cassette interface. It also has some control lines that are used internally to the C64, particularly with respect to altering the memory map.

In particular, bits 0 and 1 (selected by a mask of #$03) control the /LORAM and /HIRAM lines.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 12, 2020 12:43 am 
Offline

Joined: Fri Nov 16, 2018 8:55 pm
Posts: 71
Chromatix wrote:
The 6510's "processor port" is not only used for the cassette interface. It also has some control lines that are used internally to the C64, particularly with respect to altering the memory map.

In particular, bits 0 and 1 (selected by a mask of #$03) control the /LORAM and /HIRAM lines.


Right, I follow that the "processor port" [pin] is used for lots of things. What I failed to account for was zero indexed bit-masking. As a consequence, I conflated $03 with setting bit-flag #3.

From Mapping the C64...

Quote:
Bit 0: LORAM signal. Selects ROM or RAM at 40960 ($A000). 1=BASIC, 0=RAM
Bit 1: HIRAM signal. Selects ROM or RAM at 57344 ($E000). 1=Kernal, 0=RAM
Bit 2: CHAREN signal. Selects character ROM or I/O devices. 1=I/O, 0=ROM
Bit 3: Cassette Data Output line.
Bit 4: Cassette Switch Sense. Reads 0 if a button is pressed, 1 if not.
Bit 5: Cassette Motor Switch Control. A 1 turns the motor on, 0 turns it off.
Bits 6–7: Not connected—no function presently defined.


So, $03 (%00000011) would set /LORAM =1 (True), /HIRAM=1 (True) as you say, and does nothing else. By contrast, if I the cassette port were really enabled in actual fact, the value $04 (%00000100) would have been sent to $01. This is obviously not the case.

Thanks for helping me clear the cobwebs on this one.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 12, 2020 1:02 am 
Offline

Joined: Tue Oct 02, 2018 4:22 am
Posts: 48
load81 wrote:
From Mapping the C64...

Quote:
Bit 0: LORAM signal. Selects ROM or RAM at 40960 ($A000). 1=BASIC, 0=RAM
Bit 1: HIRAM signal. Selects ROM or RAM at 57344 ($E000). 1=Kernal, 0=RAM
Bit 2: CHAREN signal. Selects character ROM or I/O devices. 1=I/O, 0=ROM
Bit 3: Cassette Data Output line.
Bit 4: Cassette Switch Sense. Reads 0 if a button is pressed, 1 if not.
Bit 5: Cassette Motor Switch Control. A 1 turns the motor on, 0 turns it off.
Bits 6–7: Not connected—no function presently defined.


So, $03 (%00000011) would set /LORAM =1 (True), /HIRAM=1 (True) as you say, and does nothing else. By contrast, if I the cassette port were really enabled in actual fact, the value $04 (%00000100) would have been sent to $01. This is obviously not the case.

Thanks for helping me clear the cobwebs on this one.


It looks like you're off by a bit. The Cassette Data Output line would be 00001000 = $08
$04 would be the CHAREN signal.

Doesn't matter for this discussion, but maybe prevent confusion in the future!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: