Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > The meaning of C0 ?!?!?
2021-06-19 12:39
Count Zero

Registered: Jan 2003
Posts: 1821
The meaning of C0 ?!?!?

*SCNR* on the topic but the thread shouldn't be about me but rather about the evil nazi Zeropage $C0 :)

http://unusedino.de/ec64/technical/aay/c64/zpc0.htm

While wandering through cartridge binaries and the kernal I found a piece of code on all Action Replay versions (Action, CyberpunX ofc, Nordic Power, etc) likely originating from "Disk Mate". Funny enough the Freeze Frame series took that part over as well and now I wonder WHY?

This is done pretty early during a reset powerup (after timer handling, vector setup, some cosmetics usually):

LDA #$37
STA $01
STA $C0

Menu printing/handling (or other things, doesnt really matter) following the code invoke the standard system IRQ and $C0 is killed (Motor Off) right away then.

Ideas on why that STA $C0 is there? Maybe even to control something external as Datel was known for their weird dev systems?

Tape people tell me more!
2021-06-20 00:23
AlexC

Registered: Jan 2008
Posts: 293
No idea why it is in all AR roms, but apparently similar code can be found in different tape transfer and irq loader routines. Would also like to learn more about this case.
2021-06-20 05:13
chancer

Registered: Apr 2003
Posts: 342
maybe I'm not the only one , it's more confusing why you don't know Mr CZ :) . as I know you know the AR well vs the rest of us ;-)
2021-06-20 08:48
Count Zero

Registered: Jan 2003
Posts: 1821
I would of course understand the "Turn Motor on" being on tape transfer software - somehow I would even EXPECT it :)

I just don't get why one would enable it for a moment (1-2 frames only) as the kernal (or as I found some RAM Reset routine also) disables it right away. (Didn't look much further but with a modified kernal it could even never be reset and the tape keeps running, hehe.)

As said - Datel had some weird things for sale including battery backupped storage on the expansion port and they _WERE_ developing stuff on Commodore machines. Wouldn't explain it on Freeze Frame (apart from theft! :) ) or elsewhere though. That it serves as a signal to an external device or is there to straighten possibly inserted tapes when the PLAY-button is pressed - sounds far fetched :)
2021-06-20 09:04
Martin Piper

Registered: Nov 2007
Posts: 634
The coder might have assumed $c0 is a backup of the $01 register. If whomever created the code made a mistake tracing the branch in the kernal code:

EA71: A5 C0 LDA $C0
EA73: D0 06 BNE $EA7B <--- Read it as $ea79 by mistake?
EA79: 85 01 STA $01



Or an alternative is that they were just copying the kernal, thinking it was "standard":

F8AB: A5 01 LDA $01 ; 6510 On-chip 8-bit Input/Output Register
F8AD: 29 1F AND #$1F
F8AF: 85 01 STA $01 ; 6510 On-chip 8-bit Input/Output Register
F8B1: 85 C0 STA $C0 ; Tape Motor Switch
2021-06-20 12:11
TheRyk

Registered: Mar 2009
Posts: 2070
what Martin sez, i.e. someone copying stuff from KERNAL and either due to sloppiness or laziness or lack of knowledge just keeping that $C0 write ain't unlikely
2021-06-20 19:31
Count Zero

Registered: Jan 2003
Posts: 1821
Freeze Frame started using the STA $C0 code with MK2b and kept it from there (wiki dump broken! - anyone?!?). MK3b is not too well emulated so I didnt hit that code piece easily and also didnt investigate that monitor mess much further.

The EA7b misreading could be an explanation but would also mean that whoever misread it also ignored all the context from EA61 on, no?

The F8AB is intriguing as that code (lda $01 to sta $c0) is also used on Final Cartridge Internal and PLUS (no further) and Magic Formel 1.x carts.

It is however used on init routines over the place and that doesn't make sense to me.

Tape People? Make a demo about it?! :)
2021-06-24 11:57
Danzig

Registered: Jun 2002
Posts: 429
Silly idea #1: Emulate the behaviour on startup?

Silly idea #2: Users swaps the tape, "AR" asumes it's completly rewinded, the tape-motor toggling would decrease the upcoming tape-search-time (skip the transparent part of the tape :-D )
2021-06-24 13:05
Count Zero

Registered: Jan 2003
Posts: 1821
Silly answer #1: Been there - done that :)

x64sc -default -cartcrt ar5.crt -> enter monitor

(C:$8807) break store 00c0 if A==$37
WATCH: 1 C:$00c0 (Stop on store)
Setting checkpoint 1 condition to: A == $37
(C:$8807) x

# RESET

#1 (Stop on store 00c0) 127/$07f, 1/$01
.C:80a6 85 C0 STA $C0 - A:37 X:FF Y:00 SP:ff ..-..... 125938
.C:80a8 AE 00 02 LDX $0200 - A:37 X:FF Y:00 SP:ff ..-..... 125938
(C:$80a8) break store 00c0
WATCH: 2 C:$00c0 (Stop on store)
(C:$80a8) x

#2 (Stop on store 00c0) 2/$002, 15/$0f
.C:ea69 84 C0 STY $C0 - A:10 X:FF Y:00 SP:f5 ..-..IZC 137733
.C:ea6b A5 01 LDA $01 - A:10 X:FF Y:00 SP:f5 ..-..IZC 137733

Cycle count to the right is not even close to a frame, so


Silly question on idea #2: How many tape meters does a speedy 1531 do in that time frame?

Silly question on #2 (for Tape People):
- IF one would freeze a game utilising Novaload or alike which stopped the motor at the title screen, gets "backupped" and "subsequent parts" transferred by a utility being run 1-2 resets after the freeze - would a very small "PLAY"-step on the tape make a difference to a resulting transfer? As such loaders still find files and don't rely on a real bitstream PLUS a parameter copier involvement (as Action Replay offers with Extensions) would break the protection there anyhow. But thats just a silly assumption by me - pls enlighten! :)
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
CA$H/TRiAD
deetsay
New Design/Excess
Guests online: 120
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Antitrack  (9.8)
4 Mr Zero Page  (9.8)
5 OTD  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.054 sec.