Friday, February 12, 2016

Grep is your friend

I like to use grep to find strings in the disassembly.

./unidasm roms/ap2k.ic3c -arch upd7810 >ap2k_disasm

cat ap2k_disasm | grep '9911'
00002023: 34 11 99 LXI HL,$9911
000020AC: 70 2F 11 99 LDED $9911
000020B3: 70 2E 11 99 SDED $9911
000020DE: 70 2F 11 99 LDED $9911
000020E4: 70 2E 11 99 SDED $9911

cat ap2k_disasm | grep 'C004'
00000125: 70 79 04 C0 MOV ($C004),A
00000C3F: 70 79 04 C0 MOV ($C004),A
00000FB3: 34 04 C0 LXI HL,$C004
0000109B: 34 04 C0 LXI HL,$C004
000010A1: 34 04 C0 LXI HL,$C004
00002FBD: 70 69 04 C0 MOV A,($C004)
00002FC3: 70 79 04 C0 MOV ($C004),A
00002FFC: 70 69 04 C0 MOV A,($C004)
00003002: 70 79 04 C0 MOV ($C004),A

Fun fun fun...I'll figure out how this code works eventually.

Thursday, February 11, 2016

Mame debugger is cool

I've been trying to figure out the upd7810 processor and the ap2000 driver with the aid of the mame debugger. I would *never* be able to do this without it. It's got so many neat features.

I must have about 10 different windows open, multiple disassemblies, multiple memory windows, watchpoints and breakpoints. It's really slick.

Perusing the debugcmd.cpp file gives a bunch of useful commands like:

history (interestingly, the history is printed out most recent statement first, oldest statement last)
trackmem
trackpc

I particularly like the ability to right click on a memory location and see what the PC was when it was last written.

Great stuff and it makes it fun to watch the cpu work.

Wednesday, February 10, 2016

Those little eureka moments

I live for the little eureka moments when I figure stuff out.

Yesterday I wondered where Mame builds the tools like unidasm. So perusing the makefile all I had to do was uncomment the hash # TOOLS=1 and do a make and bob's your uncle.

Just today I discovered that rolling the mousewheel over the sidebar taskbar icons in Ubuntu would cycle through the windows for that application.

Not huge discoveries but it makes me happy.

Tuesday, February 9, 2016

Not enough USB bandwidth for two usb webcams

Just for fun I thought I'd try to get 2 webcams running at the same time with Ubuntu. After figuring out how to launch VLC twice, I asked it to play /dev/video0 in one window, and /dev/video1 in the other. One at a time worked well, but I couldn't get both to work simultaneously.

Then it hit me: there isn't enough usb bandwidth for both. So ratcheting the resolution down to 320x240 for each one, it works!

Tuesday, February 2, 2016

Skipping along with upd7810

I'm fascinated by the ap2000 driver in mess and was trying to wrap my head around the "skippy" nature of the cpu. If the skip flag is set, skip the current instruction.

So let's trace in the mess debugger.

trace mytrace.tr,0,{tracelog "PSW_SKIP= %02X ",psw&0x20}

creates this trace log:

PSW_SKIP= 00 2C4F: CALT ($00B2)
PSW_SKIP= 00 0050: CALB
PSW_SKIP= 00 0FE4: CALL $0FBF
PSW_SKIP= 00 0FBF: MOV A,PA
PSW_SKIP= 00 0FC1: MOV B,A
PSW_SKIP= 00 0FC2: MOV A,PA
PSW_SKIP= 00 0FC4: EQA A,B
PSW_SKIP= 20 0FC6: JR $0FBF
PSW_SKIP= 00 0FC7: RET
PSW_SKIP= 00 0FE7: ONI A,$40
PSW_SKIP= 20 0FE9: RETS
PSW_SKIP= 00 0FEA: RET
PSW_SKIP= 00 0052: RETS
PSW_SKIP= 20 2C50: CALL $2C79
PSW_SKIP= 00 2C53: LXI BC,$0FEB
PSW_SKIP= 00 2C56: CALT ($00B2)
PSW_SKIP= 00 0050: CALB
PSW_SKIP= 00 0FEB: CALL $0FBF

(loops for 6 instructions)


Ah. Much better.

Sunday, January 31, 2016

Compiling mame 170 on ubuntu 14.04

After a little break I thought I'd download mame 170 and compile it. I was able to get 168 to compile fine, but 170 now wants gcc 4.9 or better. So I found a couple of webpages to help.

http://maxolasersquad.blogspot.com/2015/12/compiling-mame-on-ubuntu-1404-trusty.html

After getting gcc 4.9 installed, I was getting some error with some QT "moc" thing.

http://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=103366

It appears that switching to QT5 was necessary. After doing a "export QT_SELECT=5" and "make clean" everything was wonderful.

Sometimes it's easier to just install a bunch of stuff with "sudo apt-get install libqt5-*" to get things rolling along.

http://www.linuxfromscratch.org/blfs/view/7.4/general/qtchooser.html

Thursday, January 21, 2016

LG Smart TV - can't get my pictures out

A family member's got an LG Smart TV, one of the LA8600 models that has a built-in camera on top. They've taken a lot of pictures using the camera at family get-togethers and now they want to copy the pictures out. Only you can't copy the pictures out. There just isn't any easy way. In fact, there isn't any way that I can see. I even asked LG's technical support and they said no, you can't.

I don't think I've ever seen a camera where you can view the pictures, but you can't get them out of the internal memory.

It'd be an easy thing to add if they were interested...