Let's see if we can capture a "real" picture from our webcam and get it to load:

Using v4l2 on ubuntu with my LifeCam VX-6000:

lsusb reports:
Bus 001 Device 014: ID 045e:00f4 Microsoft Corp. LifeCam VX-6000 (SN9C20x + OV9650)

v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=frame.jpg --stream-count=1 --set-fmt-video=width=640,height=480,pixelformat=JPEG
and then convert frame.jpg to a raw RGBA using imagemagick:

convert -resize 280x192\! frame.jpg -size 280x192 -depth 8 -modulate 200,0 -brightness-contrast 0x50 RGBA:myframe.data

I had to put the exclamation mark after the resize or imagemagick would set it to the original aspect ratio and I'd get a 256x192 image instead of 280x192.

The modulate takes away all of the color and I thought I'd ramp up the contrast a bit:

and then load it into the buffer, though it's a good idea to do this once the computer has booted, since it treats the controller button 2 as one of the open apple keys
and it goes into a self test.

a=f:read("*a") f:close() print(#a) 
quick = emu.items()["Apple //e/:/0/m_computereyescapturebuffer"] print(quick)
for i=0,280*192-1 do emu.item(quick):write(i,a:byte(1+i*4)) end  -- just grab the red component to make it simple

Taking a picture of something handy nearby and then passing it to the Apple //e double-hi res capture program:

[Linked Image from i.imgur.com][Linked Image from i.imgur.com]

I also found a c64 computereyes capture program that will do greys (5 levels of grey though only 2 levels per 8x8 block)


It will do a LOW-CONT capture or a HIGH-CONT capture in addition to the regular B/W dithering.

But it puts its routines in a different location so my hacky code that checks the PC needs modifying, The accesses for $DD01 that are important use the BIT opcode so we'll look for a BIT opcode then. Hacky, but it seems to work.

READ8_MEMBER( c64_state::cia2_pb_r )

int threshold = ((m_portb_write & (1<<2)) ? 128 : 0) +      // bit 2 = threshold bit 7
                ((m_portb_write & (1<<1)) ? 64  : 0) +      // bit 1 = threshold bit 6
                ((m_portb_write & (1<<0)) ? 32  : 0) ;      // bit 0 = threshold bit 5

int valtoreturn = m_computereyescapturebuffer[std::min(m_cey,199)][std::min(m_cex,319)]>threshold ? 0x40:0;  // return capture in bit 6, sync is bit 7
if (m_ram->pointer()[m_maincpu->pc()]==0x2c)  // 0x2c == BIT opcode, looking for BIT $DD01 
if(m_cey>199) {m_cey=0; m_cex=m_cex+1;}

return valtoreturn;  

and we just convert it to 320x200 with imagemagick:
convert -resize 320x200\! frame.jpg -size 320x200 -depth 8 -modulate 200,0 -brightness-contrast 0x50 RGBA:myframe.data
[Linked Image from i.imgur.com][Linked Image from i.imgur.com]

Last edited by Golden Child; 05/02/19 04:31 AM.