Wikipedia:Reference desk/Archives/Computing/2011 October 15

= October 15 =

Assemble all these .PNGs into a single vertical image file
Hello! Here's the scenario: I've got a folder full of .PNG screen shots of the same dimensions. They are all ordered (1.png, 2.png, 3.png ...). I'd like to know what to type in at the command line for Imagemagick (or any other command-line image program) that will take these ordered PNGs and place them in a single file vertically aligned, i.e. 1.png above 2.png, 2.png above 3.png, etc. To give another example: say I have a group of photos on my desk. I take photo 2 and put its top at the bottom of photo 1, then photo 3's top at the bottom of photo 2 (etc.) and then I apply adhesive tape to connect them creating a vertical collage. I want to do this in digital form (I'm running Windows with Cygwin installed). Thank you!--el Aprel (facta-facienda) 05:16, 15 October 2011 (UTC)


 * ¦ Reisio (talk) 08:00, 15 October 2011 (UTC)


 * This works great. Much appreciated, Reisio.--el Aprel (facta-facienda) 03:38, 16 October 2011 (UTC)

Question About 6502 Processor Hardware Detail
I'm reading about the 6502 processor's instruction set from the many links at 6502.org, and one tutorial states: "The stack pointer (S) points to a byte on Page 1, that is, to a byte whose address is from 0100 to 01FF, where the last two digits are supplied by S. When a byte is pushed on the stack, it is written at the address in S, and then S is decremented." The S register is 1 byte, so it obviously holds a value from 00 to FF, but since it decrements upon pushes, when nothing has yet been pushed on, it must start at FF. Does the physical hardware (transistors) in the chip set all the bits in that register to '1' when the chip gets its first breath of power? I just like to know the low-level details.Peter Michner (talk) 22:45, 15 October 2011 (UTC)


 * I can't tell you what the hardware does, but I can tell you that the C64 KERNAL does not assume any default value for SP. When the 6510 boots it calls indirectly through the RESET vector at $FFFC; in the C64's KERNAL ROM overlay that sends it to $FCE2. This disassembly from $FCE2 shows the first instructions it calls are to load X with $FF, then disable interrupts (I dunno why it doesn't do SEI first) and then it does TXS to copy that $FF from X to SP. Thenceforth SP will behave as you describe. In general, this kind of thing is quite common - many processors start with all kinds of garbage in registers and other on-die stores, and rely on the software to set things up in a given order. -- Finlay McWalterჷTalk 00:16, 16 October 2011 (UTC)


 * And on thinking about how Chuck Peddle and a handful of guys built the 6501 family, which consisted of crawling around on big bits of paper drawing transistors onto the masks with markers, and given that they had no microcode and no design tools bar their gigantic brains, it'd be a big ask to have the RESET circuit do anything fancier than fetch $FFFC and store that in PC. -- Finlay McWalterჷTalk 00:40, 16 October 2011 (UTC)


 * This makes me wonder, if you have pins D0 through D7 wired to your volatile chip memory, of course if that just got power, it's not going to have all the interrupt vectors up in high memory and definitely no setup code down at $FFFC. This is a novice question, but how are volatile chip memory and ROM firmware both wired to the processor? — Preceding unsigned comment added by Peter Michner (talk • contribs) 12:35, 16 October 2011 (UTC)


 * I guess by "volatile chip memory" you mean RAM? On the C64 RAM fills the entire address space, and is overlaid by the KERNAL, CHAR, BASIC and (optionally) CART ROMs, which are common wired across the address and data buses (as are the memory images of the SID, VIC, and both CIAs). Which is read or written to depends on how the address decode logic sets the appropriate chip select lines. Whether it elects to do so depends in part on the values of a bit (per chip) in a register which is initialised externally (by the HIRAM and LORAM lines) by pulldown resistors. When the C64 starts HIRAM is pulled low so a fetch in the top pages will chip select for the KERNAL ROM, which means the RESET vector and reset handler code will be executed.  The IVT in the 0 page is in non-overlaid RAM, and will come up with garbage.  That's why I was slightly surprised that they wait until the 2nd instruction to disable interrupts - I figure that leaves a 2 cycle interval in which, should an interrupt occur, it would be serviced by a garbage vector. I imagine they're confident that all the actual sources of interrupts will start in a quiescent mode so that doesn't happen. -- Finlay McWalterჷTalk 13:29, 16 October 2011 (UTC)


 * And to be clear: RESET does not depend on the IVT in page0, and works fine even though the IVT isn't initialised. -- Finlay McWalterჷTalk 13:35, 16 October 2011 (UTC)


 * Regarding the question of grabbing from different physical locations for different memory addresses, this tells of how the Atari 2600 (which uses a 6507, which is a 6502 with a little less memory addresses reachable) connects to the TIA for memory addresses $0000-$007F, RAM for the 128 bytes from $0080-$00FF, the RIOT registers for $0200-$02FF, and out to the cartridge ROM for $1000-$1FFF. This is of course achieved by the design of the 2600's circuit board and has nothing specific to do with the processor chip.20.137.18.53 (talk) 13:02, 18 October 2011 (UTC)


 * The value in S after a reset is undefined according to this thread. I don't see how the start value of S actually matters, since all stack operations happen modulo 256. The stack might as well grow from 131 to 132 as from 1FF to 100. -- BenRG (talk) 06:59, 16 October 2011 (UTC)


 * Interrupts are disabled by reset anyway so I can't see the point of the SEI. Of course the reset button can bounce so the start of the reset code gets done a few times anyway as it ignores if interrupts are disables. Dmcq (talk) 15:17, 17 October 2011 (UTC)