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

All times are UTC




Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Sat Jan 01, 2011 10:31 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Perhaps the NMI handler, upon detecting a '1' for the B bit, can take steps to invoke the BRK handler after it's done with its NMI duties, knowing definitively that a BRK has occurred as well.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 01, 2011 11:52 pm 
Offline

Joined: Fri Dec 31, 2010 5:05 am
Posts: 9
Debugged mine a bit more and it's now a basic and small Apple I emulator. Thanks for the help with debugging the interrupt flag!

The next trick is to get it running on an LPC1343 board... [Apple] 1-chip anybody? (initially USB serial, and then when I have access to my TV again I'll wire up an NTSC interface - with SPI it shouldn't eat up too much CPU even...)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 2:13 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Quote:
(initially USB serial, and then when I have access to my TV again I'll wire up an NTSC interface - with SPI it shouldn't eat up too much CPU even...)

happycube, since you're new (and BTW, welcome!), let me point you to the external peripheral bus we at 6502.org have devised to extend the usefulness of SPI (and similar interfaces) and to make it easier to share designs and perhaps even hardware in the future. We call it 65SIB, for 6502.org Serial Interface Bus. You'll find the current spec here. Nothing about it requires 6502-related hardware-- the "65" just credits this forum and website. The linked post is the result of 8 pages of development discussion, and it summarizes the design goals, benefits, connectors, pinouts, auto-addressing, optional intelligence and autoconfiguration, etc..


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 4:09 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
I think he means to use SPI as the video interface, where MOSI is used (through a resistor network) to drive the NTSC analog signal.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 4:14 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
What I don't understand is how the Apple I's video output worked. From what I can see, they used a 40-bit by 6 recirculating shift register to house one line of text on the screen. This means that the CPU would have to reload the shift register every 8 scan-lines to get a full 40x25 display. Yet, no interrupts for the purposes of synchronization exist (per the Replica 1 details, at least), and as far as I can see, the sole interface to the display hardware is a 7-bit parallel port.

What am I missing? I just don't see how it's possible without racing the electron beam.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 6:07 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Quote:
I think he means to use SPI as the video interface, where MOSI is used (through a resistor network) to drive the NTSC analog signal.

Anything like using the VIA's SR, shifting out free-running at the T2 rate and following it with an RC for a 9-level D/A converter (slightly better than 3-bit resolution)? (Tip of the Day, #5, at viewtopic.php?t=342 )


Top
 Profile  
Reply with quote  
 Post subject: apple1 video hardware
PostPosted: Sun Jan 02, 2011 7:27 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
kc5tja wrote:
What I don't understand is how the Apple I's video output worked. From what I can see, they used a 40-bit by 6 recirculating shift register to house one line of text on the screen. This means that the CPU would have to reload the shift register every 8 scan-lines to get a full 40x25 display. Yet, no interrupts for the purposes of synchronization exist (per the Replica 1 details, at least), and as far as I can see, the sole interface to the display hardware is a 7-bit parallel port.

What am I missing? I just don't see how it's possible without racing the electron beam.
Looks like the shift registers are 1k long (and 1 bit wide, but there are seven of them) - the whole screen of text fits in them (as characters not as pixels.) For writing into the shift registers, best to consult San Bergmans' page about the video circuit operation.

Here's the circuit, found on page 10 (or a supplementary page) in the apple 1 manual:
Image
RD1 to RD7 are inputs, from the B port of the PIA. The 8th bit of the B port is an input, connected to DA, which is the inverse of the PIA's CB2, used to ensure a written character has been accepted into the shift register before the next one is presented. Component D2 is the character generation ROM, with 6 bits of address input, either from 6 of the 2504 shift registers or from the B port.

I haven't yet digested this!

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 9:46 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
GARTHWILSON wrote:
Quote:
I think he means to use SPI as the video interface, where MOSI is used (through a resistor network) to drive the NTSC analog signal.

Anything like using the VIA's SR, shifting out free-running at the T2 rate and following it with an RC for a 9-level D/A converter (slightly better than 3-bit resolution)? (Tip of the Day, #5, at viewtopic.php?t=342 )


If you want 1/9th the horizontal resolution, sure. If all you care about is monochrome, then you can just use a voltage divider to bring +Vcc down to 0.7V at a 75-ohm impedance, and that'll drive a VGA monitor or NTSC input fine.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 9:47 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
The easiest way to digest the video circuitry may be to instantiate all the components in a HDL, and run it on a simulator.

Plus, you can then put it in an FPGA and try it out.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 02, 2011 9:49 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
BigEd wrote:
Looks like the shift registers are 1k long


I thought the 2519 was the recirculating shift register used. I wasn't even aware the 2504 chips were the main frame buffer.

See http://www.applefritter.com/node/8752


Last edited by kc5tja on Sun Jan 02, 2011 9:58 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 9:57 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Arlet wrote:
The easiest way to digest the video circuitry may be to instantiate all the components in a HDL, and run it on a simulator.

Plus, you can then put it in an FPGA and try it out.


This assumes you know what all the components actually do. I was completely unaware that the 2504 was a 1024-bit shift register, which was my missing piece of the puzzle.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 02, 2011 9:59 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
kc5tja wrote:
BigEd wrote:
Looks like the shift registers are 1k long


I find this a bit unbelievable; the Signetics data sheet for the recirculating shift register indicates it's shift registers are only 40 bits wide.

See http://www.applefritter.com/node/8752

Have a look instead at the datasheet for the 2504
Quote:
These Signetics 2500 Series 1024-bit multiplexed dynamic shift registers consist of enhancement mode P-channel MOS devices integrated on a single monolithic


Edit: Ah, Samuel saw his mistake and already corrected his post. For my part, I'd missed that the 2519 is also a shift register. The 40-bit depth is presumably a line of characters (character addresses for the character generator ROM)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 02, 2011 10:21 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Quote:
This assumes you know what all the components actually do. I was completely unaware that the 2504 was a 1024-bit shift register, which was my missing piece of the puzzle.


Correct. The old datasheets may be hard to find.

ETA: There's a .zip file with the datasheets of the 2504, 2513 and 2519 on the sb-projects download link: http://www.sbprojects.com/projects/apple1/download.htm


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 25, 2011 11:09 pm 
Offline

Joined: Wed Oct 27, 2010 1:28 pm
Posts: 25
Location: Valladolid (Spain)
happycube wrote:
I've been working on a logic-based emulator - with gcc -Os it compiles into less than 4K (not counting 'shell'), which means it'll be a good choice for running on an AVR or ARM Corrtex. In theory one could make a one-chip Apple I with this on a very cheap LPC 111x.

EDIT: I haven't commented it enough yet to make sense, but it's now an Apple I emulator and can run at least basic BASIC programs. The stripped -Os i386 a.out (including basic and woz mon) is ~14K.

Check it out here: http://code.google.com/p/chadslab/sourc ... nk%2Fm6502 (2-clause BSD licensed)

What I really want to do is make a tight Verilog version and see if I can make something smaller than even Arlet's core (EDIT: I doubt I can make one that's worth the effort, but I might look into optimizing Arlet's...)


While checking the emulator I found the following BASIC error:
Code:
E000R

E000: 4C
>10 FOR I=0 TO 100
10 FOR I=0 TO 100
>20 PRINT I
20 PRINT I
>30 NEXT I
30 NEXT I
>LIST
LIST
   10 FOR I=0 TO 100
   20 PRINT I
   30 NEXT I

>RUN
RUN
0
*** >32767 ERR
STOPPED AT 30


>32767 ERR means a BASIC overflow. Probably something is wrong with emulation (maybe V flag...). It seems to happen with every NEXT instruction.
BTW, the emulator was cross-compiled for ARM and ran on an x86 Linux box using qemu-arm (today we got so many MIPS to waste :))


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 26, 2011 8:17 am 
Offline

Joined: Fri Dec 31, 2010 5:05 am
Posts: 9
Fixed it (I think - it's hard to figure out how to handle V :) ) - the for/next loop runs now.

And yeah - we've got such an amazing amount of CPU power these days...


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 24 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: