Yes, you are right. PINx is for reading only and PORTx is commonly used for writing values to your port.
Also, Serial.print prints an ASCII character by default, so I would either have to use:

Serial.print(PINB, BYTE);
or
Serial.write(PINB);

Good catch pal.

uXe wrote:
Jazzmarazz wrote:

Thats pretty neat, but you utilize port manipulation?

Of course - jump to Chapter 9 on GPIOs:

http://www.st.com/st-web-ui/static/acti … 171190.pdf

or even program in assembly if you like:

http://www.st.com/st-web-ui/static/acti … 228163.pdf

Excellent and I love assembly, but until I exhaust the option on-hand, I will set aside the maple mini for now.

rvan wrote:
Jazzmarazz wrote:

Also worth mentioning, I am working with a 16MHz arduino pro mini so I have to focus on sketch streamlining. The reason I set aside my Teensy is because they are expensive and anyone wanting to build this into a GB will be put off by the Teensy's price and size. I also think that the CPP to machine code conversion for the Teensy's CPU is worse than that of the atmega168.

I suspect you're right that Arduino code will be more efficient that Teensyduino code, but I have to agree with friendofmegaman that you're going to be very pushed for cycles, especially using an interrupt and doing a serial write straight away.

Yeah, it will be a challenge but I must try. Worse case scenario, I can try something like:

loop() 
{
Serial.print(PORTB); // where port B = 0, 0, 0, CLK, H, V, D1, D0
}

And then edit the PC-side program to process clock changes, Hsync and Vsync. Actually, its not a bad idea to be honest...

rvan wrote:
Jazzmarazz wrote:

Speaking of which, it mag be economical to test a serially clocked parallel-in, serial-out shift register and process all five pins on the PC.

Do you mean converting CLK, D0, D1, HS, and VS to serial data?  Do you plan to send this data to a microcontroller, or are you connecting the DMG to the PC through something else?

The 74HC165 is a Parallel-In, Serial-Out shift register... however I think that it may not be connected directly to a USB cable. lol
Maybe an RS232 cable, but not directly USB... it was a wild idea any way. The thought was to have no microcontroller to reduce size and cost.

rvan wrote:
Jazzmarazz wrote:

I have to go grocery shopping before I can sit down and modify friendofmegaman's PC-side code...

You might want to use this version of the display code which I've modified to use Pygame instead of Pylab.  Pylab was extremely slow here...

#!/usr/bin/python
#author: friendofmegaman, rvan
#Display captured frame data on the PC.  Expects a 0x1E00 header and four
#pixels per byte.  Uses pygame, which is faster than pylab's scatter.

import pygame
from pygame.locals import *

upscale = 2

width = 160
height = 144

grey = []
grey.append((224,248,208))
grey.append((136,192,112))
grey.append((52, 104, 86))
grey.append((8, 24, 32))

fd = open('/path/to/screen.bin', 'rb')
data = fd.read()
fd.close()

frames = data.split('\x1E\x00')
print len(frames), 'frames'

class Pixel:
    x = 0;
    y = 0;
    def __call__(self, col):
        for upy in range(upscale):
            for upx in range(upscale):
                window.set_at(((self.x)*upscale+upx,
                               (self.y)*upscale+upy), grey[col])
    
        self.x +=1
        if self.x==160:
            self.x = 0
            self.y +=1

pixel = Pixel()
window = pygame.display.set_mode((width*upscale, height*upscale))

for frame in frames:
    # First and last frames can be smaller than that (because there's small
    # chance we start capture right at the beginning of the frame)
    if len(frame)!=5760:
        continue

    for y in range(144):
        for x in range(160):
            bit_offset = y*320+x*2
            array_offset = bit_offset/8
            byte_offset = bit_offset%8

            byte = ord(frame[array_offset])
            px = (byte>>byte_offset)&0b11
            pixel(px)

pygame.display.update()

quit = False
while not quit:
    event = pygame.event.wait()
    if event.type == pygame.QUIT or event.type == KEYDOWN and \
    event.key == K_ESCAPE:
        quit = True

I will have a look! I may need to modify it to accommodate my arduino code, but we'll see when I get to that point.
Cheers

755

(43 replies, posted in Nintendo Consoles)

DBOYD wrote:

Sorry if this is a totally n00by question, but is it possible to back up .sav files from Pulsar onto your computer, in at least a similar method to LSDJ? Being the "LSDJ of the NES" and all, wanted to see if it's possible, and how to go about doing it. I'm using a Mac.

That's probably the only thing that's stopping me from yelling SHUT UP AND TAKE MY MONEY, at this point.

Yes, but not as eaily as LSDj. The SRAM in any NES cart may be accessed via the cart edge and there are many hardware solutions for backing up software. Solutions such as:
Retrode: (sold out)
CopyNES: http://www.retrousb.com/product_info.ph … ucts_id=36
DIY: http://www.neogaf.com/forum/showthread.php?p=72806661

However, DSC's carts contain a secondary battery holder in parallel with the first battery. This allows for two things 1. hot swapping batteries without the loss of save files or 2. installing 2 batteries at once for double the lifespan.

Finally back from the damn store. (I hate shopping)
Soldered in some new wires to an old project:



NOW ... I cannot find a female parallel plug. lol ... I'll breadboard this out as soon as I find a plug ... I have so many boxes of junk around here ... sad

Speaking of which, it mag be economical to test a serially clocked parallel-in, serial-out shift register and process all five pins on the PC. I think I have one such IC on hand .... But still grocery shopping. tongue

Because it's written to be so simple, that its stupid. Basically it does nothing but forward the data pins out the serial port. I'll detail my results once I get home and test it out.

Well, I was in the process of moving when this thread started and then I got a new job ... and more than a month later, I have my home office mostly set up. I can finally dedicate some time and effort into this project.

Now, what I am doing is going back to the basics. For the time being I am ignoring Hsync and Vsync and just focusing on clock and data. That means if I get a picture, it will be skewed, but at this point, all I care about is a picture! Any picture! Also worth mentioning, I am working with a 16MHz arduino pro mini so I have to focus on sketch streamlining. The reason I set aside my Teensy is because they are expensive and anyone wanting to build this into a GB will be put off by the Teensy's price and size. I also think that the CPP to machine code conversion for the Teensy's CPU is worse than that of the atmega168.

I have to go grocery shopping before I can sit down and modify friendofmegaman's PC-side code but I have a simple fast program for the arduino:
1. wait for clock interrupt
2. Serial.print(PORTB)
3. repeat

PORTB is just a byte with data0 and data1 at the farthest right bits. The PC is going to do the horizontal counting for me, at least until I get a legit picture. Once I get that picture, I will implement Vsync. Hsync may remain as a simple counter on the PC-side.

Future goal: implement composite video output without the help of a PC.

brb

uXe wrote:
rvan wrote:

Reading the Freescale Reference Manual, it turns out that the Teensy's chip does have two SPI ports.  We may yet be in luck...

...are those pins available on the board though? and is there software library support for two SPI ports?

Another option which does have support for two SPI ports is the good old Maple Mini, and it looks like they can be found pretty cheaply on eBay...

Thats pretty neat, but you utilize port manipulation?

761

(24 replies, posted in Nintendo Handhelds)

I'll sell you a blank board for like $4, or maybe a complete if you can convince me to order more parts:
http://jazz-disassemblies.blogspot.com/ … noboy.html

I'll take the Genesis 3. PM'ing now...

763

(26 replies, posted in Other Hardware)

That's what she said.

764

(24 replies, posted in Nintendo Handhelds)

Super dope!

kineticturtle wrote:

I believe Nick Maynard also built a DMG-07 modded so that one of the gameboys powers the arduino/teensy, and the others are passive. It should just be a matter of some somewhat tedious trace-tracing to figure out which pins to jumper - nothing that katsumbhong isn't capable of. smile

Yeah, I did that too. Its very easy as long as you don't cross the voltage terminals. You can see it in action here, but don't judge. tongue
https://www.youtube.com/watch?v=xeU0BQKhXqs

Same question here. I had a scheme drawn of something similar based on the 68000 rather than a z80, but had to drop it for more pressing things. We should talk.

767

(3 replies, posted in Releases)

yay and boo... I'll still listen to whatever you record! wink

768

(9 replies, posted in Nintendo Handhelds)

Heat shrink wrap ur shit giuz! lol