I liked to remember my trig for programming like this:
"shiny cossacks"
x goes with cosine "cos x" -> "cossacks"
y goes with sin "sin y" -> "shiny"
and that made it easy to go to:
x = cos theta
y = sin theta
Saturday, March 26, 2016
Friday, March 25, 2016
The Day After Tomorrow
Somehow I missed "The Day After Tommorow" movie when it came out and just watched it now.
I think my head is going to explode from all of this cognitive dissonance. Global warming causes a global ice age... oh my goodness.
I would be embarrassed to have my name listed in the credits as the "Scientific Consultant" when the movie ignores basic physics and logic. I'd call it the "unscientific" consultant.
Sharknado could use an "unscientific" consultant.
It makes for good spectacle, but it doesn't make any sense. Kinda like a lot that's going on in the world today.
I think my head is going to explode from all of this cognitive dissonance. Global warming causes a global ice age... oh my goodness.
I would be embarrassed to have my name listed in the credits as the "Scientific Consultant" when the movie ignores basic physics and logic. I'd call it the "unscientific" consultant.
Sharknado could use an "unscientific" consultant.
It makes for good spectacle, but it doesn't make any sense. Kinda like a lot that's going on in the world today.
Thursday, March 24, 2016
Batman's Big Trak
I never knew that Batman had a big trak...(sorry that's Bat Machine)
http://www.toynerd.com/index.php/2010/06/14/how-to-control-the-dark-knight/
http://www.toynerd.com/index.php/2010/06/14/how-to-control-the-dark-knight/
Thursday, March 17, 2016
Power went out the other day
A couple of days ago the power went out for about 8 hours. It really makes you think about how much we rely on electricity for everything modern.
That really stops you dead in your tracks, sitting in a dark house. Good thing I had some flashlights handy.
I used to have UPS uninterruptible power supplies, but the batteries kept dying after a year or two so I got annoyed and didn't replace them. My desktops didn't make it through the outage, but my laptop (with its own battery) survived unscathed.
First world problems...
That really stops you dead in your tracks, sitting in a dark house. Good thing I had some flashlights handy.
I used to have UPS uninterruptible power supplies, but the batteries kept dying after a year or two so I got annoyed and didn't replace them. My desktops didn't make it through the outage, but my laptop (with its own battery) survived unscathed.
First world problems...
Danmere Backer - videotape backup
Years ago, I had a Danmere Backer that was sold by H45 technology. It was a device that attached to the parallel port (there was an ISA card version) and allowed you to save data to videotape by generating NTSC or PAL signals. A good idea in theory, but it had all of the problems that the old audio cassette tape had. For example, with cassette tape, random access to specific files was difficult.
The particular unit I had wouldn't generate "clean" NTSC video and would vertically roll the TV.
I think I only used it once. Recordable CD technology was faster, more easily verifiable, random access and less hassle. Especially when cds jumped from recording at 2x to 48x.
Still, it was a clever idea. It reminds me of Atari 2600 video, with all of the blocky scanlines.
There's an interesting webpage about linux drivers for the backer with screenshots.
http://linbacker.sourceforge.net/screenshots.html
I wonder if it would be possible to generate video signals from an old Amiga 500 that would allow data transfer with a backer.
Theoretically a 320x200 black and white screen could transfer 8k of data per video frame * 60fps = 480KB/sec.
This reminds me of the cauzin softstrip technology with data transfer over paper.
http://cauzin.com/
Or even data transfer over audio like Sofcast. There's an interesting article from PC Mag May 28, 1985.
https://www.google.com/search?q=software+takes+to+the+air+sofcast
Interesting ideas that never caught on.
The particular unit I had wouldn't generate "clean" NTSC video and would vertically roll the TV.
I think I only used it once. Recordable CD technology was faster, more easily verifiable, random access and less hassle. Especially when cds jumped from recording at 2x to 48x.
Still, it was a clever idea. It reminds me of Atari 2600 video, with all of the blocky scanlines.
There's an interesting webpage about linux drivers for the backer with screenshots.
http://linbacker.sourceforge.net/screenshots.html
I wonder if it would be possible to generate video signals from an old Amiga 500 that would allow data transfer with a backer.
Theoretically a 320x200 black and white screen could transfer 8k of data per video frame * 60fps = 480KB/sec.
This reminds me of the cauzin softstrip technology with data transfer over paper.
http://cauzin.com/
Or even data transfer over audio like Sofcast. There's an interesting article from PC Mag May 28, 1985.
https://www.google.com/search?q=software+takes+to+the+air+sofcast
Interesting ideas that never caught on.
Wednesday, March 16, 2016
Vizio M320SL
I got a TV the other day, a Vizio M320SL. It's not bad. I was trying to see how it works as a monitor and it works pretty well, except that it has that property where the brightness varies by the viewer's angle. So if you sit right in the very middle about arm's length, the brightness will vary and the edges of the monitor will look dark. It's kind of a weird effect.
Also it won't come out of standby. I figured out that if I turn the TV on, wait until it'll display "HDMI" on the on screen display, then move my mouse to wake up my ubuntu system out of standby, the computer will recognize that the monitor's there. Otherwise, I have to bring up the display settings to "reenable" the monitor.
Interestingly, the monitor has an owner's manual built-in. That's pretty cool.
I wanted to test it and found these neat online tools to calibrate your monitor.
http://www.makeuseof.com/tag/5-online-tools-calibrate-monitor/
My particular favorite of the group is http://www.lagom.nl/lcd-test/
Also it won't come out of standby. I figured out that if I turn the TV on, wait until it'll display "HDMI" on the on screen display, then move my mouse to wake up my ubuntu system out of standby, the computer will recognize that the monitor's there. Otherwise, I have to bring up the display settings to "reenable" the monitor.
Interestingly, the monitor has an owner's manual built-in. That's pretty cool.
I wanted to test it and found these neat online tools to calibrate your monitor.
http://www.makeuseof.com/tag/5-online-tools-calibrate-monitor/
My particular favorite of the group is http://www.lagom.nl/lcd-test/
Monday, March 7, 2016
This would have been so great back in the day
The Vampire 2 is so cool. 226 times an amiga 600.
http://www.kipper2k.com/video/x16.jpg
http://www.kipper2k.com/
Sunday, March 6, 2016
Sometimes windows just disappear offscreen - bring 'em back
If you have a bunch of windows open and you do the multimonitor thing, odds are that sometimes a window just might materialize off the visible screen when you change resolution or enable and disable monitors.
I had some windows that were fine, but after disabling some monitors (2 out of 4) the systems display dialog was offscreen and couldn't be seen.
I could use the ubuntu sidebar to select the window but it wouldn't bring it back.
Perusing all of the shortcuts that come up when you hold down the windows key, one caught my eye: Accessibility menu with Alt+Space.
Selecting the window, then typing alt+space and then choosing move and using the arrow keys, I was able to bring it back on screen.
Yay!
I had some windows that were fine, but after disabling some monitors (2 out of 4) the systems display dialog was offscreen and couldn't be seen.
I could use the ubuntu sidebar to select the window but it wouldn't bring it back.
Perusing all of the shortcuts that come up when you hold down the windows key, one caught my eye: Accessibility menu with Alt+Space.
Selecting the window, then typing alt+space and then choosing move and using the arrow keys, I was able to bring it back on screen.
Yay!
Making SDL allow the screensaver with the debugger
I've been leaving the mame debugger open and my computer hasn't been activating the screensaver under ubuntu.
A little searching and all I have to do is to
export SDL_VIDEO_ALLOW_SCREENSAVER=1
from the command line.
https://wiki.libsdl.org/FAQUsingSDL
A little searching and all I have to do is to
export SDL_VIDEO_ALLOW_SCREENSAVER=1
from the command line.
https://wiki.libsdl.org/FAQUsingSDL
Saturday, March 5, 2016
Changing the buzzer tone
Reading the upd7810 manual says that the upcounter (ECNT) is incremented every 12 cycles of the phi-12 clock (phi-12 is clock divided by 12) (1 microsecond when operating at 12 Mhz). But it looks like the ap2000 runs at 14.7 mhz.
static MACHINE_CONFIG_FRAGMENT( epson_lx810l )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", UPD7810, XTAL_14_7456MHz)
So if I want to generate a 1000hz tone, I'll have to fudge the delay a little bit.
The half cycle is 1000us/2=500us and we'll multiply that by (14.7/12) to make 500*(14.75/12) and we get around 615 which is 0x267.
One cycle should take (1/14.7e6*12)*615*2=0.00100408163 which is about right for 1000hz.
My debugger line looks like:
eom=b0;etm1=267;etmm=0c;gt 15
I like the gt 15 (gtime) as it won't drive you totally insane with the beeping.
eom=b0;etm1=4ce;etmm=0c;gt 15
for a bit lower tone (doubling the timer value)
I was actually trying to mimic the apple ii's beep tone, and this sounds similar with etm1=220 being pretty close
etm1=220;eom=b0;etmm=0c;gt 20
static MACHINE_CONFIG_FRAGMENT( epson_lx810l )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", UPD7810, XTAL_14_7456MHz)
So if I want to generate a 1000hz tone, I'll have to fudge the delay a little bit.
The half cycle is 1000us/2=500us and we'll multiply that by (14.7/12) to make 500*(14.75/12) and we get around 615 which is 0x267.
One cycle should take (1/14.7e6*12)*615*2=0.00100408163 which is about right for 1000hz.
My debugger line looks like:
eom=b0;etm1=267;etmm=0c;gt 15
I like the gt 15 (gtime) as it won't drive you totally insane with the beeping.
eom=b0;etm1=4ce;etmm=0c;gt 15
for a bit lower tone (doubling the timer value)
I was actually trying to mimic the apple ii's beep tone, and this sounds similar with etm1=220 being pretty close
etm1=220;eom=b0;etmm=0c;gt 20
Friday, March 4, 2016
Trying to figure out how the buzzer works
I wondered how the buzzer works, and I found some code that looks relevant.
The buzzer is on PC7 which is the C01 counter output.
If I send a $07 bel character the ap2000 will beep, executing the routine at $1057.
the action looks to happen with putting EOM=B0, ETM1=8C AND ETMM=0C
to shut it off it puts EOM=99
so for kicks if you run the ap2000 in the debugger and the ap2000 is waiting for input you can make it beep with the following debugger command line:
etm1=8c;eom=b0;etmm=0c
and to shut it off
eom=99
before you do this, you may want to turn your speakers down, it's really a terrible sound. heh heh
The buzzer is on PC7 which is the C01 counter output.
If I send a $07 bel character the ap2000 will beep, executing the routine at $1057.
debugger commands to make my trace log: WP 8000,1F00,w,1,{tracelog " WRITE addr=%x data=%x \n", wpaddr,wpdata;g} WP 8000,1F00,r,1,{tracelog " READ addr=%x data=%x \n", wpaddr,wpdata;g} WP FF00,100,w,1,{tracelog " WRITE addr=%x data=%x \n", wpaddr,wpdata;g} WP FF00,100,r,1,{tracelog " READ addr=%x data=%x \n", wpaddr,wpdata;g} WP 0000,8000,r,1,{tracelog " READROM addr=%x data=%x \n", wpaddr,wpdata;g} trace TRACEbeep.TXT,0,{tracelog "A=%02X EA=%04X HL=%04X DE=%04X BC=%04X SKIP=%1X | ",a,ea,hl,de,bc,(psw&0x20)!=0} 223 A=00 EA=9000 HL=13DA DE=8013 BC=FB00 SKIP=0 | 135C: ACI H,$00 224 A=00 EA=9000 HL=13DA DE=8013 BC=FB00 SKIP=0 | 135F: LDEAX (HL) 225 READROM addr=13DA data=57 226 READROM addr=13DB data=10 227 A=00 EA=1057 HL=13DA DE=8013 BC=FB00 SKIP=0 | 1361: JEA 228 A=00 EA=1057 HL=13DA DE=8013 BC=FB00 SKIP=0 | 1057: LXI HL,$0000 229 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 105A: ORIW VV:10,$04 230 READ addr=9810 data=0 231 WRITE addr=9810 data=4 232 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 105D: PUSH HL 233 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 105E: CALL $7BB1 234 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 7BB1: ONIW VV:0F,$C0 235 READ addr=980F data=0 236 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 7BB4: OFFIW VV:01,$30 237 READ addr=9801 data=8 238 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=1 | 7BB7: JR $7BA9 239 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 7BB8: RET 240 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 1061: POP HL 241 A=00 EA=1057 HL=0000 DE=8013 BC=FB00 SKIP=0 | 1062: DMOV EA,HL 242 A=00 EA=0000 HL=0000 DE=8013 BC=FB00 SKIP=0 | 1063: DMOV BC,EA 243 A=00 EA=0000 HL=0000 DE=8013 BC=0000 SKIP=0 | 1064: PUSH BC 244 A=00 EA=0000 HL=0000 DE=8013 BC=0000 SKIP=0 | 1065: PUSH BC 245 A=00 EA=0000 HL=0000 DE=8013 BC=0000 SKIP=0 | 1066: CALL $1084 246 A=00 EA=0000 HL=0000 DE=8013 BC=0000 SKIP=0 | 1084: MVI A,$00 247 A=00 EA=0000 HL=0000 DE=8013 BC=0000 SKIP=0 | 1086: MOV ETMM,A 248 A=00 EA=0000 HL=0000 DE=8013 BC=0000 SKIP=0 | 1088: MVI EOM,$B0 249 A=00 EA=0000 HL=0000 DE=8013 BC=0000 SKIP=0 | 108B: LXI EA,$008C 250 A=00 EA=008C HL=0000 DE=8013 BC=0000 SKIP=0 | 108E: DMOV ETM1,EA 251 A=00 EA=008C HL=0000 DE=8013 BC=0000 SKIP=0 | 1090: MVI A,$0C 252 A=0C EA=008C HL=0000 DE=8013 BC=0000 SKIP=0 | 1092: MOV ETMM,A 253 A=0C EA=008C HL=0000 DE=8013 BC=0000 SKIP=0 | 1094: MVI C,$3C 254 A=0C EA=008C HL=0000 DE=8013 BC=003C SKIP=0 | 1096: CALT ($0080) ... 341 342 (loops for 15827 instructions) 343 344 A=00 EA=0001 HL=0000 DE=8013 BC=FFFF SKIP=0 | 0030: JR $003D 345 A=00 EA=0001 HL=0000 DE=8013 BC=FFFF SKIP=0 | 003D: POP BC 346 A=00 EA=0001 HL=0000 DE=8013 BC=003C SKIP=0 | 003E: POP VA 347 A=0C EA=0001 HL=0000 DE=8013 BC=003C SKIP=0 | 003F: POP EA 348 A=0C EA=008C HL=0000 DE=8013 BC=003C SKIP=0 | 0040: RET 349 A=0C EA=008C HL=0000 DE=8013 BC=003C SKIP=0 | 1097: MVI EOM,$99 350 A=0C EA=008C HL=0000 DE=8013 BC=003C SKIP=0 | 109A: RET
the action looks to happen with putting EOM=B0, ETM1=8C AND ETMM=0C
to shut it off it puts EOM=99
so for kicks if you run the ap2000 in the debugger and the ap2000 is waiting for input you can make it beep with the following debugger command line:
etm1=8c;eom=b0;etmm=0c
and to shut it off
eom=99
before you do this, you may want to turn your speakers down, it's really a terrible sound. heh heh
Wednesday, March 2, 2016
Interrupt Vectors on ap2000
The ap2000 has its code in rom, so it uses a jump to redirect to a location in ram where it's put another JMP.
The most interesting ones for me to study right now are the JMP to $9817 and $981A.
at $016A we put 54 in 9817 with MOV ($9817),A to put the JMP opcode in place
Now to figure out what these interrupts do 8-)
00000000: 54 E0 00 JMP $00E0 00000003: 00 NOP NMI interrupt is at 0004 00000004: 54 2A 0C JMP $0C2A 00000007: 00 NOP INTT0 and INTT1 interrupts are at 0008 00000008: 11 EXX 00000009: 10 EXA 0000000A: 54 17 98 JMP $9817 0000000D: 00 NOP 0000000E: 00 NOP 0000000F: 00 NOP INT1 AND INT2 are at 0010 00000010: 00 NOP 00000011: 00 NOP 00000012: 00 NOP 00000013: 00 NOP 00000014: 00 NOP 00000015: 00 NOP 00000016: 00 NOP 00000017: 00 NOP INTE0 and INTE1 are at 0018 00000018: 11 EXX 00000019: 10 EXA 0000001A: 54 1A 98 JMP $981A 0000001D: 00 NOP 0000001E: 00 NOP 0000001F: 00 NOP INTEIN and INTAD are at 0020 00000020: 00 NOP 00000021: 00 NOP 00000022: 00 NOP 00000023: 00 NOP 00000024: 00 NOP 00000025: 00 NOP 00000026: 00 NOP 00000027: 00 NOP INTSR and INTST are at 0028 00000028: 54 CE 20 JMP $20CE
The most interesting ones for me to study right now are the JMP to $9817 and $981A.
at $016A we put 54 in 9817 with MOV ($9817),A to put the JMP opcode in place
0000016A: 69 54 MVI A,$54 0000016C: 70 79 17 98 MOV ($9817),A 00000170: 70 79 1A 98 MOV ($981A),A 00000174: 40 F7 0B CALL $0BF7 and the code at 0BF7 puts 0C0F into the address at $9818 to fix the address to make it JMP $0C0F. 00000BF7: 64 9D E0 ORI TMM,$E0 00000BFA: 48 42 SKIT FT1 00000BFC: 00 NOP 00000BFD: 69 26 MVI A,$26 00000BFF: 4D DB MOV TM1,A 00000C01: 34 0F 0C LXI HL,$0C0F 00000C04: 70 3E 18 98 SHLD $9818 00000C08: 64 8D 3F ANI TMM,$3F 00000C0B: 64 0F FB ANI MKL,$FB 00000C0E: B8 RET 00000C0F: 40 16 0C CALL $0C16 00000C12: 11 EXX 00000C13: 10 EXA 00000C14: AA EI 00000C15: 62 RETI There seem to be only a few routines for these two interrupt vectors. Using my good friend grep with -A (after) and -B (before) gives us ~/Downloads/mame$ grep -A 2 -B 2 '9818' ap2k_disasm 00000BFF: 4D DB MOV TM1,A 00000C01: 34 0F 0C LXI HL,$0C0F 00000C04: 70 3E 18 98 SHLD $9818 00000C08: 64 8D 3F ANI TMM,$3F 00000C0B: 64 0F FB ANI MKL,$FB -- 00001E52: 70 3E 1B 98 SHLD $981B 00001E56: 34 04 7A LXI HL,$7A04 00001E59: 70 3E 18 98 SHLD $9818 00001E5D: B8 RET 00001E5E: 55 10 02 OFFIW VV:10,$02 -- 00001EA7: 70 3E 1B 98 SHLD $981B 00001EAB: 34 5A 7A LXI HL,$7A5A 00001EAE: 70 3E 18 98 SHLD $9818 00001EB2: CE JR $1EC1 00001EB3: 34 E3 1D LXI HL,$1DE3 00001EB6: 70 3E 1B 98 SHLD $981B 00001EBA: 34 5A 7A LXI HL,$7A5A 00001EBD: 70 3E 18 98 SHLD $9818 00001EC1: 69 0C MVI A,$0C 00001EC3: 4D CC MOV ETMM,A -- 000079E9: 64 9D E0 ORI TMM,$E0 000079EC: 34 04 7A LXI HL,$7A04 000079EF: 70 3E 18 98 SHLD $9818 000079F3: 15 0F 01 ORIW VV:0F,$01 000079F6: 69 E6 MVI A,$E6 -- 00007A84: 99 CALT ($00B2) 00007A85: 34 04 7A LXI HL,$7A04 00007A88: 70 3E 18 98 SHLD $9818 00007A8C: 55 00 80 OFFIW VV:00,$80 00007A8F: 5E 00 BIT 6,VV:00 ~/Downloads/mame$ grep -A 2 -B 2 '981B' ap2k_disasm 00001E4C: 64 0F DF ANI MKL,$DF 00001E4F: 34 78 1E LXI HL,$1E78 00001E52: 70 3E 1B 98 SHLD $981B 00001E56: 34 04 7A LXI HL,$7A04 00001E59: 70 3E 18 98 SHLD $9818 -- 00001EA3: CF JR $1EB3 00001EA4: 34 85 1D LXI HL,$1D85 00001EA7: 70 3E 1B 98 SHLD $981B 00001EAB: 34 5A 7A LXI HL,$7A5A 00001EAE: 70 3E 18 98 SHLD $9818 00001EB2: CE JR $1EC1 00001EB3: 34 E3 1D LXI HL,$1DE3 00001EB6: 70 3E 1B 98 SHLD $981B 00001EBA: 34 5A 7A LXI HL,$7A5A 00001EBD: 70 3E 18 98 SHLD $9818 -- 0000319F: 48 D2 DMOV ETM0,EA 000031A1: 34 F5 31 LXI HL,$31F5 000031A4: 70 3E 1B 98 SHLD $981B 000031A8: 48 45 SKIT FE0 000031AA: 00 NOP
Now to figure out what these interrupts do 8-)
Subscribe to:
Posts (Atom)