I'd read that the ZX81 print routine for floating-point numbers (ie all numbers) was slow, but I didn't realise how slow till I used the very good VB81 emulator to compare a 1-to-100 FOR loop which (a) uses PRINT to print each number, (b) uses a subroutine to calculate the digits and print them as characters, or (c) calls the ROM routine at 0A98 to print numbers between 0 and 9999.
Timings per iteration:
(a) 460 ms
(b) 280 ms
(c) 100 ms
That includes the loop mechanism and various extra BASIC code, but it's interesting to see that the standard number routine is considerably slower than a BASIC subroutine with a lot of division and multiplication, and far slower than the dedicated ROM routine.
Separate handling for integers would have speeded ZX BASIC up no end.
I wish I'd known about the routine at 0A98 at the time, it would have been dead useful for showing scores in machine code games. I only found out about it this week after re-reading Understanding Your ZX81 ROM which I found up in my loft.
Update: The 0A98 routine explains why Electric Pencil's Asteroids game crashed when your score got to 99990. Pity, because otherwise it was the best ZX81 Asteroids implementation by miles.
Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )
Friday, June 14, 2013
polipo as a transparent proxy
Successfully used this config file
proxyAddress = "0.0.0.0"
allowedClients = 127.0.0.1, <ip-of-gateway>
maxAge = 0
maxExpiresAge = 0
to set up a transparent proxy on an in-firewall machine to whose port 3183 I'm tunnelling from my PC via <gateway>. The idea being to let me view web stuff from home which I can only view from the in-firewall machine.
allowedClients = 127.0.0.1, <ip-of-gateway>
maxAge = 0
maxExpiresAge = 0
to set up a transparent proxy on an in-firewall machine to whose port 3183 I'm tunnelling from my PC via <gateway>. The idea being to let me view web stuff from home which I can only view from the in-firewall machine.
Friday, June 7, 2013
pos
Perl pos does, helpfully, return an index 1 greater than the index of the last character in the string if the last match 'left off matching' after the end of the string.
Just to be clear, suppose you have an 11-character string whose last index is, Perl being 0-based, 10. If the last character of the last match in the string is the last character in the string, pos will return 11 after the last match.
Saturday, June 1, 2013
Fixing Firefox
Settings that have to be made to make Firefox work properly
browser.sessionstore.resume_from_crash = false (bug means that session restore always happens, without prompting; this setting turns this off)
dom.ipc.plugins.enabled.npswf32.dll = false (stops plugin-container.exe for Flash. There are other settings if you have Silverlight, Quicktime etc plugins. You may have to create these settings yourself in later versions)
browser.chrome.site_icons and browser.chrome.favicons = false (otherwise wastes time loading site icons)
browser.tabs.animate = false (otherwise get distracting animation when opening tab)
browser.urlbar.trimURLS = false (otherwise http:// protocol bit hidden in location)
layout.spellcheckDefault = 0 (otherwise get distracting red lines in text boxes)
browser.tabs.onTop = false (otherwise tabs appear above URL instead of below)
app.update.enabled = false }
extensions.update.enabled = false } otherwise add-ons update without prompting you
plugins.hide_infobar_for_outdated_plugin (otherwise constant prompts to update Flash etc for minor version changes)
greasemonkey.fileIsGreaseable (otherwise Greasemonkey won't run on local pages)
browser.download.manager.scanWhenDone = false (otherwise FF will, bizarrely, use the Internet Explorer security settings, which generally mean that your downloads get deleted as soon as they complete). You should check this setting before any important download (or use Opera), as I've caught FF setting it back to true more than once. Take note Mozilla, if I wanted to use IE, I'd use IE. I'm guessing that, unless you want the same thing to happen with your add-on downloads, you should set services.sync.prefs.sync.browser.download.manager.scanWhenDone to false too.
Missing status bar: unfixed bug. Missing New Tab button: it won't be on the panel of available buttons when you click Customise, it'll be on the tab bar at the far right. Drag it into place from there.
Having to turn off this whole raft of crap every time there's a new version really puts me off upgrading.
browser.sessionstore.resume_from_crash = false (bug means that session restore always happens, without prompting; this setting turns this off)
dom.ipc.plugins.enabled.npswf32.dll = false (stops plugin-container.exe for Flash. There are other settings if you have Silverlight, Quicktime etc plugins. You may have to create these settings yourself in later versions)
browser.chrome.site_icons and browser.chrome.favicons = false (otherwise wastes time loading site icons)
browser.tabs.animate = false (otherwise get distracting animation when opening tab)
browser.urlbar.trimURLS = false (otherwise http:// protocol bit hidden in location)
layout.spellcheckDefault = 0 (otherwise get distracting red lines in text boxes)
browser.tabs.onTop = false (otherwise tabs appear above URL instead of below)
app.update.enabled = false }
extensions.update.enabled = false } otherwise add-ons update without prompting you
plugins.hide_infobar_for_outdated_plugin (otherwise constant prompts to update Flash etc for minor version changes)
greasemonkey.fileIsGreaseable (otherwise Greasemonkey won't run on local pages)
browser.download.manager.scanWhenDone = false (otherwise FF will, bizarrely, use the Internet Explorer security settings, which generally mean that your downloads get deleted as soon as they complete). You should check this setting before any important download (or use Opera), as I've caught FF setting it back to true more than once. Take note Mozilla, if I wanted to use IE, I'd use IE. I'm guessing that, unless you want the same thing to happen with your add-on downloads, you should set services.sync.prefs.sync.browser.download.manager.scanWhenDone to false too.
Missing status bar: unfixed bug. Missing New Tab button: it won't be on the panel of available buttons when you click Customise, it'll be on the tab bar at the far right. Drag it into place from there.
Having to turn off this whole raft of crap every time there's a new version really puts me off upgrading.
Update: most of these settings are preserved across upgrades. However some crucial ones are not:
- browser.sessionstore.resumefromcrash
- browser.download.manager.scanWhenDone
- services.sync.prefs.sync.browser.download.manager.scanWhenDone
Subscribe to:
Comments (Atom)