From 5742e1f66c4e70151865de7092547223898bbf6b Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sun, 18 Apr 2021 16:00:54 -0700 Subject: Support a proper PDP-8 assembler. --- pll.rb | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100755 pll.rb (limited to 'pll.rb') diff --git a/pll.rb b/pll.rb deleted file mode 100755 index 49464d4..0000000 --- a/pll.rb +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/ruby -w - -TARGET_FREQ = ARGV.shift.to_f -NATIVE_FREQ = 50.0 - -CLOCK_WIDTH = 5 - -best = nil -best_mult = nil -best_div = nil -1.upto(2**CLOCK_WIDTH) do | mult | - 1.upto(2**CLOCK_WIDTH) do | div | - new = NATIVE_FREQ * mult / div - if not best or (new - TARGET_FREQ).abs < (best - TARGET_FREQ).abs or ((new - TARGET_FREQ).abs == (best - TARGET_FREQ).abs and (mult + div) < (best_mult + best_div)) - best = new - best_mult = mult - best_div = div - end - end -end - -error = (best - TARGET_FREQ).abs / TARGET_FREQ -$stdout.write("Closest I can get is #{best}: *#{best_mult} /#{best_div} (#{(error * 100).round}% error)\n") -- cgit v1.2.3