Hi folks,
A bunch of generous and smart people have managed to figure out how to control the LEDs on the Acer EasyStore H340 in Linux. To read more on this, please go here.
As a courtesy, I am hosting the current and possibly future code for leds-h340-0.2. Current version is 0.2. This is done with permission from the author Alexander Georg. I hope you’ll find this as useful as I do. It turns off the blinking “i” LED which was driving me nuts.
Usage (taken from the post above):
tar xzvf h340-leds-0.2.tar.gz
make
sudo insmod leds-h340.ko
Disable the blinking “i” with:
echo 0 > /sys/class/leds/h340:InfoLedBlue/brightness
echo 255 > /sys/class/leds/h340:InfoLedBlue/brightness
Turn the “i” red:
echo 0 > /sys/class/leds/h340:InfoLedRed/brightness
leds-h340-0.2.tar.gz
I haven’t posted in a little while but you should expect to see some reviews of the new Core i7 MacBook Pro, iPad and Acer 1810TZ laptop. Just gonna get set time to sit down and write my personal impressions on the subject.
Will also post how well Ubuntu 9.10 (Karmic Koala) works on the Acer 1810TZ right out of the box. Quite impressive. More on that later.
In the heydays of the mid-to-late 80’s, I had an Atari 800 XL. And considering that I spent most of my young adolescent days on it, I still have very fond memories of it.
When software emulators of the Atari came out, I wanted to know how it was done. Thinking more about how the CPU and the supporting sound and graphic chipsets gave me a geeky urge to write an emulator for the CPU used by those generation of 8-bit machines. The CPU used was the 6502. So folks, while this work is in progress, I wrote a very basic skeleton of an emulator written completely in Ruby. It does not very much, but I figure if anyone wanted to take a look at bad and unoptimized coding, I shouldn’t give them a reason to look elsewhere.
Download 6502.rb.bz2
Download test binary – displays alphabets from A to Z
#!/usr/bin/ruby
#Written by Farhan Yousaf - March 2010
class CPU6502
attr_accessor :cpu_instance, :cpus, :imagesize, :debug
def initialize
@debug = false
@ip = 0
@imagesize = 0
@pc = 0
@pc_off = 0
@ram = [ ] * 65536
@register = { :A => 0, :X => 0, :Y => 0, :SP => 0xFF, :SR => 0 }
@cpu_instance = 1
@cpus = @cpus.to_i+1
@inst = Array.new
@inst.push [ 0xA2, :immediate, 2, "LDX" ]
@inst.push [ 0xA9, :immediate, 2, "LDA" ]
@inst.push [ 0xA6, :zeropage, 2, "LDX" ]
@inst.push [ 0xB6, :zeropagey, 2, "LDX" ]
@inst.push [ 0xAE, :absolute, 2, "LDX" ]
@inst.push [ 0xBE, :absolutey, 2, "LDX" ]
@inst.push [ 0x8A, :implied, 1, "TXA" ]
@inst.push [ 0x20, :absolute, 3, "JSR" ]
@inst.push [ 0xE8, :absolute, 1, "INX" ]
@inst.push [ 0xE0, :absolute, 2, "CPX" ]
@inst.push [ 0xD0, :absolute, 2, "BNE" ]
@inst.push [ 0x00, :absolute, 2, "BRK" ]
@flag = { :S => 0, :V => 0, :B => 0, :D => 0, :I => 0, :Z =>0, :C => 0 }
@operand=Array.new(2)
end
def display_status
if (@debug)
#printf("PC=%04x SP=%04x A=%02x X=%02x Y=%02x S=%02x C=%d Z=%d\n\n", @pc,@register[:SP],@register[:A],@register[:X],@register[:Y],@flag[:S],@flag[:C]?1:0,@flag[:Z])
end
end
def push(oper1)
#display_status
@ram[@register[:SP]+0x100] = oper1
@register[:SP]-=1
end
def pull
@register[:SP]+=1
@ram[@register[:SP]+0x100]
end
def set_sign(accumulator)
@flag[:S] = accumulator & 0x80 #bit 7 of A
end
def set_zero(accumulator)
# @flag[:Z] = (accumulator==0) ? false:true
if accumulator == 0
@flag[:Z] = 0
else
@flag[:Z] = 1
end
end
def set_carry(accumulator)
@flag[:C] = accumulator
end
def loadi(filen)
@prog = File.open(filen, "rb") { |io| io.read }
@imagesize = @prog.size
end
def runop(opcode, oper1, oper2)
# display_status
case opcode
when 0xA2 #LDX
@register[:X] = oper1
@pc+=2
set_sign(@register[:X])
set_zero(@register[:X])
when 0x8A #TXA
@register[:A] = @register[:X]
@pc+=1
when 0x20 #JSR
@pc = @pc + 3 - 1 #was +3
push((@pc >> 8) & 0xff)
push(@pc & 0xff)
tmp_addr = (oper1 << 8) | oper2
if tmp_addr == 0xFFEE
putc(@register[:A])
@pc = tmp_addr
else
@pc = tmp_addr
end
display_status
@pc = pull
@pc |= (pull << 8) @pc=@pc+1 when 0xE8 #INX @register[:X] = (@register[:X]+1) & 0xff set_sign(@register[:X]) set_zero(@register[:X]) @pc+=1 when 0xE0 #CPX tmp = @register[:X] - oper1 set_carry(@register[:X] >= oper1) #was < 0x100 set_sign(tmp) if (tmp == 0) set_zero(1) else set_zero(0) end @pc+=2 when 0xD0 #BNE display_status @pc+=1 if (@flag[:Z] == 0) if (oper1 > 0x7F)
@pc = @pc - (~(oper1) & 0x00FF)
else
@pc = @pc + (oper1 & 0x00FF)
end
else
@pc=@pc+1
end
when 0xA9 #LDA
set_sign(oper1)
set_zero(oper1)
@register[:A] = oper1
@pc+=2
when 00 #BRK
#puts "************** IN BREAK **************"
@pc+1
exit 0
end
display_status
end
def readmem(pc)
@prog[pc]
end
def decode
@pc=0
while @pc <= (@pc_off + @prog.size)
#puts "inside decode loop - #{@pc} #{@prog.size}"
opcode=readmem(@pc)
@inst.find do |opc,mode,bytes,desc|
if opc == opcode
case bytes
when 2
@operand[0] = readmem(@pc+1)
printf("%04X\t%s #%02X\t\t # %02X%02X -- (%d)\n", @pc,desc, @operand[0], opc, @operand[0], bytes) if @debug
runop(opcode, @operand[0], @operand[1])
when 1
printf("%04X\t%s \t\t #%02X -- (%d)\n", @pc,desc, opc, bytes) if @debug
runop(opcode, @operand[0], @operand[1])
when 3
@operand[0] = readmem(@pc+2)
@operand[1] = readmem(@pc+1)
printf("%04X\t%s $%02X%02X\t\t # %02X%02X%02X -- (%d)\n", @pc,desc, @operand[0], @operand[1], opc, @operand[0],@operand[1], bytes) if @debug
runop(opcode, @operand[0], @operand[1])
end
end
end
end
end
end
if ARGV.empty?
puts "Usage: 6502.rb [image] -d | disassemble"
puts " 6502.rb [image] -r | run"
exit 0
end
myCPU = CPU6502.new
myCPU.loadi(ARGV[0])
myCPU.debug = true if ARGV.find { |a| a == "-d" }
printf("Image length: %d\n", myCPU.imagesize)
myCPU.decode if ARGV.find { |a| a == "-r" }
Comments welcome, but please be gentle. :)
Finally got my transparent bridge up and running. It’s sole purpose in life is to provide QoS (Quality of Service) based prioritization of my VoIP traffic. An added bonus is to provide a snappier web surfing experience if there is other traffic running in the background. All this is being done using the very excellent pfSense. It rocks!
If you want to set one up as well, go here. But to read up more on it, refer to this excellent article.
For the new version of Fonera+ that includes firmware v1.1.0+, attached below is a very simple Python script to enter into RedBoot so you can flash it to the firmware of your choice. The script basically attempts to telnet to 192.168.1.1 which is the IP address during the first few seconds of boot up. During this time, the router is accessible via telnet port 9000. I was having a heck of a time trying to manually telnet and press Ctrl-C, but I thought there might be an easier way. There was, and is.
import socket
import getpass
import sys
import telnetlib
HOST = "192.168.1.1"
while 1:
try:
print "Attempting to connect to", HOST
tn = telnetlib.Telnet(HOST, 9000)
break
except:
print "Host could not be found... Yet."
print "Seem to be connected."
tn.write(chr(3))
tn.interact()
Note, I suck at Python. If you can create a proper version of above. I’d like to know. Thanks!
I just built a new PC server from an old AMD XP+ 1800 (running at 1.5GHz). It has an old Seagate Barracuda 80GB hard drive. Apart from this server, I have a custom built workhorse with tons of memory, Linux software RAID and other stuff. If you’re wondering how this compares in terms of raw performance here it is:
Server 1 - CRUISE
aaron@cruise:~$ sudo hdparm -tT /dev/md0
/dev/md0:
Timing cached reads: 1672 MB in 2.00 seconds = 836.31 MB/sec
Timing buffered disk reads: 338 MB in 3.01 seconds = 112.34 MB/sec
Server 2 - BLASPHEMY
[root@blasphemy ~]# hdparm -tT /dev/hda
/dev/hda:
Timing cached reads: 1028 MB in 2.01 seconds = 512.45 MB/sec
Timing buffered disk reads: 120 MB in 3.04 seconds = 39.48 MB/sec
Server 1 specs:
AMD 2.1GHz
2GB DDR 800 RAM
Ubuntu 7.10
Linux software RAID – 2×500GB Seagate SATA drives
Server 2 specs:
AMD 1.5GHz
512MB RAM
ClarkConnect 4.1 SP1
Seagate Barracuda 80GB HD
As you can see from the numbers. There is quite a performance difference. Power management is active on Server 1, so the numbers can potentially be higher. It most runs in 1GHz which is fine, to lower electricity costs.
Not sure if anyone is old enough to remember .D00 / .D01 files from the 90’s, but I just found a stash of these files from my old hard drive. The archive linked has a DOS player in it as well. You’ll need DOSBox to play it, however. Let me know how it goes.
Download
If you ever wondered how fast is Aurora cable in real life, then, wonder no more:

Excellent article on how to deal with abusive people. Worth reading it in its entirety as well as the comments that follow.
I have recently acquired the Sony LocationFree base station. It decided in favour of it to be able to watch TV in my upstairs bedroom since there is no COAX connection available. I had thought that using my PS3, I may be able to get stream via the PS3. But my lack of research resulted in that dream being shattered.
Nonetheless, there is a Mac player for it but it costs extra money and does not come with the device. The Mac software is actually quite good, so no complaints there. It also is compatible with Leopard.
Let’s hope that Sony updates PS3 to support LocationFree, until then, the true value of this device is somewhat limited.