Author Topic: switchable UltraCIC II for legacy ED64  (Read 90680 times)

0 Members and 1 Guest are viewing this topic.

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
switchable UltraCIC II for legacy ED64
« on: September 25, 2015, 05:57 PM »
switchable UltraCIC II for legacy ED64

EDIT:
you can modify your ed64 with this ultracic patch, so it doesn't need cracks for 6105 games.
that's why i renamed it to UltraCIC II, so there will be less confusion. ^^


This is my switch patch for jesgdevs UltraCIC.
The source has been modified to work with avra



The Maskrom is directed to the back of the console.
The switch is in NTSC mode, if PIN3 connected to VDD and in PAL mode on GND.


N64 CIC Pinout


UltraCIC Pinout (ATtiny25)
PIN3 connects to the switch between vcc and gnd



patching
UltracCIC.asm has to be in the same directory
Code: [Select]
patch < UltraCIC_II_avra_switch_ed64.patch
compiling
Code: [Select]
avra UltraCIC.asm
flashing
low fuse 0xc0 high fuse 0xdf
Code: [Select]
avrdude -p t25 -P /dev/ttyS0 -c ponyser -U lfuse:w:0xc0:m -U hfuse:w:0xdf:m -U flash:w:UltraCIC.hex
UltraCIC_II_avra_switch_ed64.patch
Code: [Select]
--- online/UltraCIC/UltraCIC.asm 2015-02-18 21:07:10.000000000 +0100
+++ UltraCIC_fix.asm 2015-10-30 16:48:58.893381510 +0100
@@ -1,56 +1,10 @@
-/*
-UltraCIC.asm
-N64 CIC clone!
-ATtiny25
-
-Author: jesgdev
-Credits:
- ccsfp221-kammerstetter.pdf - Thanks to those authors!
- KRIKzz - 710x dumps and testing.
-
-Pinout(references(direct, pad,  etc..) refer to the CIC footprint on a typical cart board).
-1: Reset, this is the actual /RST pin of AVR.  Pad is VCC so need to cut or lift.  Jump to 9(cic pinout)
-2: CLKIN, unused pad, jumper to 11(cic pinout), cart edge #19
-3: ??, unused pad  TODO: Use this pin to read in the CIC_TYPE
-4: GND, unused pad, jump to nearby pad(last 3 in row are GND)
-5: CICPIN2_2, direct, tied to GND(always?)
-6: CICPIN2_1, direct, cart edge #43 (Data Clock)
-7: CICPIN2_0, direct, cart edge #18 (Data I/O)
-8: VCC, direct
-
-1 cic clock = 2 AVR clocks.  Clocks given in code are avr clocks.
-
-Programming the AVR:
-Fuses:
-/Reset enabled
-Disable debug wire
-disable watchdog
-disable bod(probably doesn't matter?)
-No clock div(default is div8, make sure to disable!)
-Fastest startup, external clock
-SUT=00
-CKSEL=0000
-
-
-CIC_TYPE:
-4bit value to select cic type.
-bit3=region
- 0: 610x mode
- 1: 710x mode
-bit2=x105 mode(6105/7105).
- 0: not x105(use bit1:0 for cic type)
- 1: 6105/7105
-bit1:0
- 00: 6102/7101
- 01: 6103/7103
- 10: 6106/7106
- 11: 6101/7102
-*/
+
+.include "/usr/share/avra/includes/tn45def.inc"
 
 ;------------------------------------------------
 ;Choose CIC_TYPE(pick one):
 ;------------------------------------------------
-.equ CIC_TYPE=0b0000 ;6102
+;.equ CIC_TYPE=0b0000 ;6102
 ;.equ CIC_TYPE=0b0001 ;6103
 ;.equ CIC_TYPE=0b0010 ;6106
 ;.equ CIC_TYPE=0b0011 ;6101
@@ -58,7 +12,7 @@
 ;.equ CIC_TYPE=0b0101 ;6105
 ;.equ CIC_TYPE=0b0110 ;6105
 ;.equ CIC_TYPE=0b0111 ;6105
-;.equ CIC_TYPE=0b1000 ;7101
+.equ CIC_TYPE=0b1000 ;7101
 ;.equ CIC_TYPE=0b1001 ;7103
 ;.equ CIC_TYPE=0b1010 ;7106
 ;.equ CIC_TYPE=0b1011 ;7102
@@ -90,6 +44,7 @@
 .equ CICPIN0=PINB2 ;cic port2 pin0
 .equ CICPIN1=PINB1 ;cic port2 pin1
 .equ CICPIN2=PINB0 ;cic port2 pin2
+.equ CICPIN3=PINB4 ;cic port2 pin3 ;switch pin
 
 ;Flags(bit location of flag in flags register,  do not change these values)
 .equ FLAG_x105_MODE=0 ;0=x10x, 1=x105
@@ -112,7 +67,8 @@
  out PRR, scr0 ;power reduction
  ldi scr0, 0x80
  out ACSR, scr0 ;comparator disable
- ldi scr0, LOW(RAMEND) ;STACK!  Make sure SPH is not needed for the part
+; ldi scr0, LOW(RAMEND) ;STACK!  Make sure SPH is not needed for the part
+ ldi scr0, 0xDF ;STACK! attiny25 offset when using tn45def.inc
  out SPL, scr0
  nop
  nop
@@ -146,10 +102,11 @@
  ;66 ticks elasped
 
  ;setup flags and key address
- andi scr0, 0x0F
- sbrc scr0, 3
+ andi scr0, 0x0F
+ ;sbrc scr0, 3 ;deactive old config check - saturnu
+ sbis CICPINS, CICPIN3 ; replace with a pal/ntsc switch - saturnu
  sbr flags, (1 << FLAG_710x_MODE)
- sbrc scr0, 2
+ ;sbrc scr0, 2 ; mix up cic6102 with x105 mode - saturnu
  sbr flags, (1 << FLAG_x105_MODE)
     andi scr0, 0x07
  lsl scr0
@@ -261,24 +218,6 @@
 
  ;06:00 - 06:1A(392clk)
 cic_ram_init:
- /*
- 0:0 = Leftover counter value, probably not important
- 0:1 = ??, will be provided by console
- 0:2-0:F = Seed from 04:00 area(PAT instruction) LSB
- 1:0 = Unitialized
- 1:1 = Set to 0xB but will be provided by console
- 1:2-1:F = Seed from 04:00 area(PAT instruction) MSB
- 2:0-3:F = Unitialized(will be set to zero)
- RAM(610x): E09A185A13E10DEC
-    0B14F8B57CD61E98
-        0000000000000000
-        0000000000000000
-    
- RAM(710x): E04F51217198575A
-    0B123F827198115C
-    0000000000000000
-        0000000000000000
- */
  sbrc flags, FLAG_710x_MODE
  rjmp cic_ram_init_710x
  ldi ZH, HIGH(CIC_INITIAL_RAM_610x * 2)
@@ -305,7 +244,6 @@
  nop
  nop
 
- //06:1B - 06:21(14clk)
 cic_ram_init_2:
  nop
  rcall m0200
@@ -944,4 +882,4 @@
 
 CIC_INITIAL_RAM_710x:
  .dw 0x4FE0, 0x2151, 0x9871, 0x5A57, 0x120B, 0x823F, 0x9871, 0x5C11
-
\ No newline at end of file
+

original thread with sources:
http://assemblergames.com/l/threads/n64-cic-looking-for-710x-series-info.55237/

greetings,
saturnu

Here is an archive, that helps you to patch and create the flash binary. ^^
i've included avrdude, but you can use whatever you want
maybe there are some ponyprog fanboys here?
http://www.lancos.com/prog.html


Download:
https://a.pomf.cat/bxtstz.zip



1. put the UltraCIC.asm from the assemblergames thread in here
2. click on step1_create.bat

Flashing with avrdude and usbasp:



3. install the libusb0 driver http://sourceforge.net/p/libusb-win32/wiki/Home/
4. click on step2_flash_usb.bat if you are using an usbasp programmer


if you flash a new attiny, the internal osciallator is active and after the first ultracic flash it's fused to external clock.
depending on your programmer you need to clock the attiny on pin2 for reflashing.


UPDATE:
USBasp wiring

avr isp6pin header


USBasp isp10pin header



if you don't have a banjo tooie or jet force gemini rom, you can now use this testrom, to test your ultracic installation.

Testrom


Download:
https://d.maxfile.ro/fjystxpjkp.v64
« Last Edit: September 24, 2016, 10:37 AM by saturnu »

Offline GreatFunky

  • Full Member
  • ***
  • Posts: 185
  • Karma: +14/-0
    • View Profile

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #2 on: September 25, 2015, 07:57 PM »
I know that they are buyable since quite some time, but it was an open source project by jesgdevs and you guys should at least have the option to build one by yourself. ^^
...and patching assembler code isn't everyones darling. :D

Offline GreatFunky

  • Full Member
  • ***
  • Posts: 185
  • Karma: +14/-0
    • View Profile
Re: switchable UltraCIC for legacy ED64
« Reply #3 on: September 25, 2015, 08:08 PM »
I was surprised when i discovered these chips last week ... The Chinese don't waste their time!

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #4 on: October 30, 2015, 06:09 PM »
very cheap usbasp programmer:
http://www.ebay.com/itm/USBASP-USBISP-AVR-Programmer-Adapter-10-Pin-Cable-USB-ATMEGA8-ATMEGA128-Arduino-/310506909410
http://www.aliexpress.com/item/Hot-1pcs-USB-ISP-Programmer-for-ATMEL-AVR-ATMega-ATTiny-51-AVR-Board-ISP-Downloader/953484051.html?ws_ab_test=201556_2,201527_1_71_72_73_74_75,201409_3

Code: [Select]
avrdude -p t25  -c usbasp -U lfuse:w:0xc0:m -U hfuse:w:0xdf:m -U flash:w:UltraCIC.hex
attiny 25
http://www.ebay.com/itm/ATtiny25-20PU-ATMEL-AVR-RISC-C-20MHz-ATtiny-DIP8-/360277411925


keep in mind, that if you want to reflash an existing ultracic, it needs to be clocked.
so you have to add an external clock or flash it in circuit while the n64 is running. :D
« Last Edit: October 30, 2015, 06:11 PM by saturnu »

Offline GreatFunky

  • Full Member
  • ***
  • Posts: 185
  • Karma: +14/-0
    • View Profile
Re: switchable UltraCIC for legacy ED64
« Reply #5 on: October 30, 2015, 07:30 PM »
Hmmm saturnu , with your new update .....  I feel suddenly people more attracted by attiny 's programming  than buying the Chinese one... lol  ;D

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #6 on: October 30, 2015, 08:34 PM »
btw. there is a pic based ultracic, too ^^
https://github.com/mikeryan/UltraCIC

if someone needs to get this puppy runnig, there is some dau protection in the code ^^
feel free to ask here, if you have problems with that

Offline rafaelalvesals

  • Hue Hue BR BR
  • Sr. Member
  • ****
  • Posts: 359
  • Karma: +19/-0
    • View Profile
Re: switchable UltraCIC for legacy ED64
« Reply #7 on: October 30, 2015, 08:57 PM »
Could you make a step by step with pic or a vid pls? I'm trying hard to understand all this, but its sounds like greek to me  :-[ (i dont know if this expression makes sense in other countries than not brazil, sorry if dont)

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #8 on: October 30, 2015, 09:52 PM »
sure ^^

Offline skaman

  • Full Member
  • ***
  • Posts: 108
  • Karma: +13/-0
    • View Profile
Re: switchable UltraCIC for legacy ED64
« Reply #9 on: October 31, 2015, 07:50 AM »
I get "Hunk #1 FAILED at 1." when trying to patch UltraCIC.asm.

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #10 on: October 31, 2015, 08:20 AM »
hm i have to boot into windows to check it myself, maybe i patched against another Ultracic.asm ^^

if you are trying to overwrite an existing ultracic, you should definitely take a look closer to check if it's really an attiny25 ^^
e.g. if it's an attiny45 you have to alter the stack offset. :D

and i don't know if the switch is labeled in reverse afterwards :>

Offline phoenixdownita

  • Sr. Member
  • ****
  • Posts: 439
  • Karma: +36/-7
    • View Profile
Re: switchable UltraCIC for legacy ED64
« Reply #11 on: October 31, 2015, 08:21 AM »
I will really rock if Krikzz would offer this ultracic with adapter for sale separately so we can all use them and be done with patching and all the nonsense.

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #12 on: October 31, 2015, 08:33 AM »
hm, the ultracic everdrives have smd packages, so it's easier to reflash them instead of swapping the chip.

the older ones need to be resoldered and i think everyone who can swap a chip on a pcb can flash a micro, too. ^^

but sure, it would be a nice service to be able to buy prepared and tested chips.

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #13 on: October 31, 2015, 09:38 AM »
EDIT:
i moved this post to bottom of the first post, to keep the thread tidy. ^^
« Last Edit: November 01, 2015, 11:07 AM by saturnu »

Offline saturnu

  • ヽ(^o^)丿
  • Hero Member
  • *****
  • Posts: 1182
  • Karma: +156/-0
    • View Profile
    • :D
Re: switchable UltraCIC for legacy ED64
« Reply #14 on: October 31, 2015, 10:59 AM »
here is my ultracic adapter, i was using while testing :D
it's not really necessary to desolder the old cic, you can just disable it, too
(if you are unable to desolder for some reasons or missing tools)