Lunduke
News • Science & Tech
Make Computers Fun Again - Linux, UNIX, Alternative Operating Systems, Computer History, and Retro Computing. Also dad jokes.
Interested? Want to learn more about the community?
January 04, 2023

First post for 8 bit week, I'll talk about a bug. An 8 bit bug.

I recently made a post about anonymous functions in NovaForth: you can surround some code with braces and it'll compile it and leave the address to it on the stack. For example: "{ 5 + }" will leave on the stack a pointer to some code that adds five to things. I have tests for all of this of course so I know it works.

Except it didn't: "execute" is a word that takes a pointer to a function and calls it. So, "{ 3 5 } execute" should be, create a function that pushes 3 and 5 to the stack, then call that function. But doing that in the NovaForth console ( http://sevendral.com/repl/ ) today did not work! It cleared the stack instead, which usually means that the thing crashed and called "quit". So, a conundrum: I know that brace functions work because they're tested all to hell, therefore the problem is in "execute," but "execute" isn't something that can really have a problem. Here's the entire source to that function:

jmp

A single jump with no arguments. Which is a single byte of code in Vulcan, byte 0x5c as a matter of fact. Like I said, it's an 8-bit bug. :) How can one byte have a bug in it?

The story here is that execute takes the pointer given it, calls it, and returns the result. But the pointer it's given is already on the stack, so we just need to call and return, and that's a tail call of course so we can just omit the extra stack frame and let what we're calling return for us, so, it's a jmp. Great, but, how can one instruction have a bug?

Well turns out it was a little bit trickier: I wanted brace functions to not take up space unnecessarily, so, if you make one from interpret mode it sticks it on the heap but doesn't increment the heap: as long as you're not compiling anything it'll be fine, and it means you can do things like "{ foo blah } 10 do-times" (if you were to write a word that takes a function pointer like that). Brace words written this way failed but brace words nested inside functions, even other brace words, worked great. More of a conundrum!

I'm proud that I figured this out without a debugger, although I do need to write a debugger: the answer was that more than just brace functions get built "temporarily" on the heap. As it turns out, a lot more: words being parsed use the heap as temporary storage, so my "execute" was getting written on top of the newly-compiler temporary function and then I was jumping into it. I've since fixed that but found a couple more things that cannot follow a brace function. I need to rearrange things to either use a separate internal scratch buffer for that stuff, or a separate internal scratch buffer for brace functions, I suppose...

Interested? Want to learn more about the community?
What else you may like…
Videos
Podcasts
Posts
Articles
November 19, 2024
The Pokemon Go Spying Conspiracy Theory? Yeah. It's Verified.

Pokemon Go using your phone camera to build a CIA-backed 3D Map AI system.

It sounds like an insane movie plot. But it's real.

In 2016, this was "Lunduke's crazy conspiracy theory about Pokemon Go being used to spy on everyone, backed by the CIA". Now, in 2024, Niantic Labs (the makers of Pokemon Go), proudly brags about using Pokemon Go to spy on you... and using that covertly obtained information to build a massive, 3D artificial intelligence mapping system of private spaces.

"We receive about 1 million fresh scans each week, each containing hundreds of discrete images."

In other words: Lunduke was right.

The CIA, NSA, and Pokémon Go:
https://lunduke.locals.com/post/5756204/the-cia-nsa-and-pok-mon-go

Building a Large Geospatial Model to Achieve Spatial Intelligence:
https://nianticlabs.com/news/largegeospatialmodel

00:19:04
November 19, 2024
DOJ: Google Must Sell Off Chrome

And that's only one impact of Google being officially ruled a monopoly.

00:15:13
November 18, 2024
Mozilla's "Dreams" Do Not Include Firefox ... or Even Web Browsing

A survey about Mozilla's future doesn't mention Firefox... but it does have 8 gender options.

The "What Is Your Dream for Mozilla?" Survey: https://mozillafoundation.tfaforms.net/101

00:15:34
November 22, 2023
The futility of Ad-Blockers

Ads are filling the entirety of the Web -- websites, podcasts, YouTube videos, etc. -- at an increasing rate. Prices for those ad placements are plummeting. Consumers are desperate to use ad-blockers to make the web palatable. Google (and others) are desperate to break and block ad-blockers. All of which results in... more ads and lower pay for creators.

It's a fascinatingly annoying cycle. And there's only one viable way out of it.

Looking for the Podcast RSS feed or other links? Check here:
https://lunduke.locals.com/post/4619051/lunduke-journal-link-central-tm

Give the gift of The Lunduke Journal:
https://lunduke.locals.com/post/4898317/give-the-gift-of-the-lunduke-journal

The futility of Ad-Blockers
November 21, 2023
openSUSE says "No Lunduke allowed!"

Those in power with openSUSE make it clear they will not allow me anywhere near anything related to the openSUSE project. Ever. For any reason.

Well, that settles that, then! Guess I won't be contributing to openSUSE! 🤣

Looking for the Podcast RSS feed or other links?
https://lunduke.locals.com/post/4619051/lunduke-journal-link-central-tm

Give the gift of The Lunduke Journal:
https://lunduke.locals.com/post/4898317/give-the-gift-of-the-lunduke-journal

openSUSE says "No Lunduke allowed!"
September 13, 2023
"Andreas Kling creator of Serenity OS & Ladybird Web Browser" - Lunduke’s Big Tech Show - September 13th, 2023 - Ep 044

This episode is free for all to enjoy and share.

Be sure to subscribe here at Lunduke.Locals.com to get all shows & articles (including interviews with other amazing nerds).

"Andreas Kling creator of Serenity OS & Ladybird Web Browser" - Lunduke’s Big Tech Show - September 13th, 2023 - Ep 044
November 20, 2024
Lunduke's Quest - November 20, 2024
Read full Article
November 12, 2024
post photo preview
Last week at The Lunduke Journal (Nov 3 - Nov 9, 2024)
Gimp 3.0! NOTEPAD.EXE AI! Mozilla Layoffs!

There was some interesting news this week in the world of computing.

But the only one I can think about is NOTEPAD.EXE getting Artificial Intelligence.

I mean.  What the fart?!

The Shows

The Articles

Read full Article
November 09, 2024
post photo preview
Funny Programming Pictures Part LXIII
Now with 14% more Unicode jokes!

My favorite picture this week is the one thaNO CARRIER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Read full Article
See More
Available on mobile and TV devices
google store google store app store app store
google store google store app tv store app tv store amazon store amazon store roku store roku store
Powered by Locals