Skip to main content




Reading up on NES ROM programming.

For some reason, memory addresses 0x0000-0x07ff are mirrored three times (for a total of four identical regions of memory). In a system with such a small amount of addressable memory, why would anyone do that??

in reply to Jonathan Lamothe

Cheaper not to hook up a couple of the address lines; and unused addressing space is free if you aren't planning to use it anyway.


Wait, the 6502's stack pointer is eight bits? I knew it was resource constrained, but damn!
in reply to Jonathan Lamothe

The largest embedded assembly projects I wrote used about 20 bytes of stack at most. But I didn't use C or recursive functions, which would been an exponentially larger stack crasher
in reply to Jonathan Lamothe

@Jonathan Lamothe Depending on the specific system, complex asynchronous code via timer interrupts (or raster interrupts, or I/O interrupts) is possible, but only one "thread" should use the stack.

For example, by default the Commodore 64 has a timer interrupt to trigger code to handle keyboard scanning, blinking the cursor, and other stuff. It's a non-trivial amount of code, but it does not mess with the stack.






Content warning: mh: ADHD

#ADHD


Only in Stardew Valley does eating a jar of mayonnaise make you healthier.


A thing that's been stuck in my brain for a while:

A couple weeks ago, @Cory Doctorow wrote this blog post about how AI shouldn't be used to write code (edit: among other things). I agree with his rationale, but I can't help but be reminded of a (perhaps apocryphal) story I once heard about a similar argument being made against compilers in the early days of computing. The same kinds of arguments could've been made back then.



Building a small personal project in #Rust to teach myself the language. As I was looking over my code, I noticed a mistake I'd made that technically worked, but was kind of silly so I fixed it.

This got me to wondering if Rust had a linter (it does) because surely I'd made other similar rookie mistakes. I found the linter and ran it on my project. It came back with one result that I already knew about: a value in a struct that doesn't get read because I haven't written that code yet. That was it.

I was surprised. It's still a very small project, but perhaps I'm a more competent developer than I give myself credit for.

#rust

reshared this

in reply to Jonathan Lamothe

Clippy by default only flags some correctness things. Turn on pedantic mode if you want to see more suggestions. !#[warn(clippy::pedantic)] at the top of your main.rs or lib.rs
in reply to Dylan :heart_nb:

@Dylan :heart_nb: As it turns out, doing this introduced me to a couple language features I wasn't aware of, so thanks again. 🙂
in reply to Jonathan Lamothe

They add new lints with every new version of Rust, so it continues to help introduce me to newer features ☺️


Content warning: Rust question

#rust

reshared this

in reply to Jonathan Lamothe

Sorry, didn't get the ping.

Basically, environment variables are inherently thread-unsafe per the POSIX standard. Some operating systems voluntarily provide thread-safe implementations, and those OS's are exempted from the check. It's not anything Rust specific.

in reply to Jacob Pratt

@Jacob Pratt Good to know. In the meantime, I've worked around the issue by allowing a UtcOffset to be manually specified.


More musings on #Rust:

I wonder if it would be possible to write an #SNES #ROM in Rust. It seems like exactly the kind of resource-constrained system that would be a prime candidate for that sort of thing. Unfortunately, it seems that the SNES used a custom processor, so it's very possible that I won't be able to specify it as a compile target. A quick search reveals that many people have made SNES emulators in Rust, but at a glace, I see nothing about writing ROMS.

I believe the original NES used an off-the-shelf processor (6502 if memory serves?). Perhaps that's more likely to be supported, but that may be a little too resource constrained.

I shall have to dig deeper into this idea. I love the idea of building a custom ROM rather than just pirating something off the internet.

Has anyone done anything like this? Links to any relevant resources would be very much appreciated.

reshared this

in reply to Jonathan Lamothe

Looks like the SNES used a Ricoh 5A22, which apparently was based on the 6502? Perhaps this is possible after all... though I don't want to speak too soon.
in reply to Jonathan Lamothe

The SNES CPU is based on the WDC 65C816, which is indeed able to run 6502 code but it also has 16-bit mode instructions with much larger memory address space.

I think the only general purpose computer to use this CPU was the Apple IIGS, so maybe look around to see if there's any Rust port to Apple IIGS.

in reply to Jonathan Lamothe

this folks have ported llvm to MOS6502: https://llvm-mos.org/wiki/Welcome

You can try to link rustc to that fork and add a new rustc target.

It will be a very long journey, but it is possible.



When a security guard in a grocery store needs to have a bulletproof vest, we have failed as a society.


Newbie #Rust question time:

I wan to use the current_local_offset function from the time library, but I apparently need to import it into my project with the local-offset feature.

I assume I need to specify this in Cargo.toml but for the life of me, I can't figure out how. Can someone point me in the right direction?

#rust

reshared this

in reply to Jonathan Lamothe

Have you tried something like the following?

time = { version = "0.3.36", features = ["local-offset"] }

in reply to glyn

@underlap ^^ this is what is necessary (speaking as the maintainer)
@glyn





Story time:

I've been holed up in the (home) office for most of the day (not uncommon). I happened to look out the window and noticed that our building was surrounded by cops.

Interesting.

Turns out they arrested one of the downstairs neighbours... for what, I don't know.

Here's the interesting bit though: apparently, the landlord offered them the key to the apartment, but they couldn't legally use it because there was no warrant. I guess that makes sense, but while they weren't allowed to to that, they apparently were allowed to enter the apartment by prying a window open or kicking the door in. In what world does that make any sense?

reshared this

in reply to Jonathan Lamothe

@Jonathan Lamothe My actual guess is that it's easier to justify forcefully entering the apartment because there would be some "safety concern" if you actually entered forcefully.



People who don't like #Rust: why specifically don't you like it?

I'm in the process of learning it now. There are definitely some things about the language that I can see some as finding irritating (i.e.: the borrowing system). Personally though, I'd rather have a dozen complie-time errors than a single runtime error. This is the reason I tend to gravitate towards Haskell, for instance.

It's certainly not the right language for everything, but if you want better safety in code that needs to be highly efficient, it seems a reasonable alternative to C/C++.

#rust

reshared this

in reply to Jonathan Lamothe

the borrow checker is such a big part of the language it's not just slightly irritating, it's like having a non-consentual finger up the ass every time you open some Rust code in your editor

And the fact Rust is always staticallly linked and lacks any sort of reproducible builds don't help, even the compiler itself only compiles with an n-2 version of the compiler, if you skip updating the compiler for a while and want or have to keep using sources then have fun compiling every version since you last updated the compiler

Its type system is also like a borrow checker: non-consentual fist up the ass, want to add an u8 to an u32? Nope, can't, have to manually cast everything because that's why we do programming languages instead of writing Assembly, to do all the fucking busy work ourselves

Oh, and Cargo is its own can of rotten worms

in reply to Reid

@Reiddragon > And the fact Rust is always staticallly linked and lacks any sort of reproducible builds don't help

That is excusable in languages where source-only distribution is normal and expected. (Indeed, compilation should be a transparent caching step and artifacts of such shouldn't be commonly shared.)

That is not the case for Rust.

> even the compiler itself only compiles with an n-2 version of the compiler

That's also a problem, Rust's bootstrap story sucks.

Ada's might suck as much, I'm not sure, I have found a few interpreters when I last looked...

> I'd rather have a dozen complie-time errors than a single runtime error. This is the reason I tend to gravitate towards Haskell, for instance.

There should be no meaningful difference between runtime and dev-time for the majority of devs. Dead languages aren't necessary. And punchcard retrocompatibility can be preserved without prioritizing a development process that is optimized for that workflow.

As for typing static vs dynamic, there's a thing called "gradual typing", and it is very possible to tie the type-checker into a REPL.

@Reid
in reply to Jonathan Lamothe

I've got a few things with Rust that make me dislike it a bit -- note that that doesn't mean that I think it's generally a bad language. (They're all good langs, Brent.) But here we go:

Another single implementation standard-less language. No solid standard library, everything done by downloading the internet. Very un-Turbo-Pascal-ish compile times and memory usage. Annotations. BCPL-ish syntax with too much line noise (and hey, I used to program Perl). Tied a lot to the worst things in IT (browser engines, crypto). Fanatical community. Overly complex async to save me from writing threads. Both functional purists and micro-optimizers. The word "Rustaceans" alone.

It's not a language that I'd like to use recreationally, but I wouldn't quit jobs if I have to do more work with it at work.





Content warning: transphobia



Dear OpenBoard,

I have you set to English (UK) for a reason (because English (CA) isn't an option). Quit trying to autocorrect "colour" to "color".

Thanks.

in reply to Jonathan Lamothe

that's odd having to go with en-us because there is no en-gb option is the norm but then ob seems to have started in ch..







Taking another crack at learning #Rust (sorry @screwlisp ).

reshared this

in reply to Jonathan Lamothe

every time I said this I ended up regretting it within a week

screwlisp reshared this.

in reply to Reid

@Reiddragon
DJ UNK and I basically have a show that's just about what @me does.

BREAKING
GREEN TEA ADDED TO MENU AT PARADISE SUSHI

so according to classic Bell labs at worst jlamothe is a minor success ;p

in reply to Jonathan Lamothe

Just got to the section on Smart Pointers. As I recall, this is where things start to get particularly interesting/complicated.
in reply to Jonathan Lamothe

You don't often need smart pointers if you get the design of your code right. Similarly, there's not much need to use copy or clone if you work "with the grain" of the borrow checker. Adapting your designs and coding style in this way is, IMO, the key part of learning Rust.
in reply to Jonathan Lamothe

for me the hard part to stop making mistakes around was the difference between &str and String, but the hard part to actually understand is pinning. Smart pointers are pretty straightforward.


Diving into the #Veilid documentation... or what I can find of it.

I have an idea that may well turn out to be vapourware, but my brain won't let me drop it if I don't at least try to build it.

I've been itching to do something with Veilid since @The Gibson first announced it.

screwlisp reshared this.

in reply to Jonathan Lamothe

I honestly didn't think veilid managed to get anywhere, which was sad.
VeilidChat exists but I think that's the only productive/useful project.
Development on the repos has really slowed down post-announcement, which isn't inherently a bad thing, if it's "done", but I don't think it's done - instead it feels stalled.

Maybe it all moved on-network and to places I can't see? That'd be cool.




Fun fact: If you comment on a #Lemmy or #kbin post from #Friendica, it lets you see specifically who up/down voted you.

I wonder if people on those platforms know that their votes are not as "anonymous" as they are on #Reddit.



Just pushed two pull requests to #Friendica. I love that #FOSS gives me that option rather than just begging the vendor to fix something.


I've been thinking about the whole xz debacle. It's demonstrated to us once again that just because a project is open source, doesn't necessarily mean that project is trustworthy. Despite this, my stance remains the same: If you can't trust me with your source code, why the hell should I trust you with my data?


Dear spammers:

If you're going to create fake accounts, maybe don't choose a profile photo with an iStock watermark...

in reply to Jonathan Lamothe

They can put some effort into their profile pic 😜. Why they have to be this low effort 🙃 losers. But hey at least they are making it easier to be detected as a spam account 😂🤣.
in reply to Jonathan Lamothe

I was comming across these kinds of very obvious spam accounts a cople of times to. Usually these accounts only message one or two other obvious spam accounts and in some rare occasion they replay to some toots to say some reactionary things. Most of time nobady bothers to react to them, because most of the intent is tranparent enough, it's just low effort trolling.
This entry was edited (3 weeks ago)





Content warning: fediblock

reshared this

in reply to Jonathan Lamothe

Content warning: fediblock

This entry was edited (4 weeks ago)
in reply to Alex :autism: :neofox_flag_ace:

Content warning: fediblock





This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.