Hacker Newsnew | past | comments | ask | show | jobs | submit | i_don_t_know's commentslogin

Chapter 9 and section 10.7 of this book show some interesting (and to me unexpected) uses of effects in Ocaml and how they compare to implementations based on monads:

https://lukstafi.github.io/curious-ocaml/new_book.html

The dscheck model-checker is another interesting application of effects: https://github.com/ocaml-multicore/dscheck


mdx[1] is another variation on this, also in the Ocaml ecosystem. It’s Ocaml’s version of documentation tests as in Elixir and Rust.

But it’s not limited to that. You can write tests in markdown files independently from your documentation. Use “dune test” to run the tests and review failures with “git diff”. Accept the changes if they are correct (changed behavior) with “dune promote”. Very nice workflow.

[1] https://github.com/realworldocaml/mdx


I'm seconding the recommendation to look at Rodnay Zack's books. For example, I really enjoyed Advanced 6502 Programming. It's a project-based tutorial for a custom 6502 machine. The design and schematics are in the book.

https://archive.org/details/Advanced_6502_Programming/mode/2...


WRT advanced 6502 programming texts, allow me plug my (free) book "EOR #$FF: 6502 Ponderables and Befuddlements". It's 64 assembly snippets to ponder, with explanations for each in the 2nd-half of the book: https://archive.org/details/eor6502


Seconded. I bought the first edition of "Programming the 6502" way back in the neolithic, and I enjoyed it greatly. I even read parts of it again now and then these days too, just because I like it. I used to write assembly on, at first, the AIM-65, and later the Apple II.


Is Programming the 6502 enough to learn Assembly on the Apple II ? But it doesn't explain the memory and screen management, right ? So how can we learn that ?


Someone can correct me if I'm wrong, but I believe the screen memory of the Commodore machines (ViC-20, Commodore 64) were the most straight-forward. As opposed to the more janky Apple II memory map.

You could do a lot worse than picking up a new Commodore 64 Ultimate [1]. They're a more or less faithful remake of the Commodore 64 but have an HDMI port, SD card instead of disk drive, etc. You could learn BASIC, should be able move to assembly as well—a quick search pulled up a YouTube course on 6502 assembly for the Commodore [2].

(I realize I am not contributing "books"—but others have done well in this regard. I did want to share what I think is a pragmatic way to learn 6502.)

[1] https://www.commodore.net

[2] https://youtube.com/playlist?list=PLU1o_YShTPgoA7_nZ0PutqaPD...


For that you'll need Apple II documentation - though that's device-specific information. It's easy to find online, e.g. https://nicole.express/2024/phasing-in-and-out-of-existence...., but there's lots more with various levels of info. This one, for example: https://www.kreativekorp.com/miscpages/a2info/memorymap.shtm...

For actual 6502 programming you'll need a dedicated 6502 assembly programming book, for example the aforementioned Rodney Zaks books.


Is the Apple II Reference Manual good for that ? Or anything specific to the Apple II, like "What's Where in the Apple" or "Understanding the Apple II" ?


All of those are quite useful.



I’m not sure the people in Eastern Ukraine who have been “relocated” to Russia agree with your idea of “nothing changes except for the government”. I don’t think the people across Europe and Asia during World War II would agree either.

Your new government does not and cannot trust you. You pledged allegiance to your old country. Are you still secretly fighting for it? Or have you pledged allegiance to your new country? Does that mean anything when you betrayed your old country to whom you had pledged allegiance too? You’re a potential enemy and your new government will act accordingly.


Well I am talking about before a military conflict erupts. I’m talking about what is in the interest of the people, when they are looking at a potential military conflict.

In the case of Ukraine, being peacefully “relocated” to Russia seems much better than what is happening now. Before the war the reputation of the Ukrainian government was not much different from the reputation of the Russian government. If it were me as a Ukrainian in that situation I would not be in favor of fighting.

Now Poles “relocating” to Germany without any conflict seems like it would not have ended well for them. Poles at that time violently resisting made sense. Refusing a land bridge agreement to avoid the need for violence, perhaps not, but resisting occupation, sure. But that is because the two governments at that time actually were very different, one being extremely ethno-centric. This does not really apply to America or Russia. If the Ukrainians were born in Russia nobody would notice, they are well within the ethnic cloud of the Russian state. Same with Canadians in America.

I don’t think allegiance to a nation means much these days. If anyone can move anywhere and not assimilate, who even really cares at that point? Should Canadians accept the human makeup of their nation changing quickly and drastically, no problem, but getting a different government is the end of the world? Doesn’t really make sense to me. Does make sense why governments put out propaganda to rile people up, though, since it is clearly in the interest of the government to resist in all such cases.


> Well I am talking about before a military conflict erupts. I’m talking about what is in the interest of the people, when they are looking at a potential military conflict.

When you’re looking at a potential military conflict, you’re looking at a hostile foreign government that’s openly threatening you. What reasons do you have to believe that they will be friendly and that life will go on as usual after you have surrendered?

The foreign government cares about your land, resources, industry, strategic location, etc. They do not care about you, the people. Otherwise they would encourage you to move to them.

> In the case of Ukraine, being peacefully “relocated” to Russia seems much better than what is happening now.

Would it be better though? The Ukrainian government was/is far from perfect. But it’s the government they chose, it’s not an authoritarian one (it tried to be which led to the Maidan protests). They chose to be an independent country and in control of their own destiny. They don’t want to subject themselves to an authoritarian foreign government and they consider that to be in their best interest.


> What reasons do you have to believe that they will be friendly

Why wouldn’t they be? Like in the case of Ukraine/Russia there is no large ethnic or cultural divide, and in America we don’t believe in that kind of thing mattering anyway, right?

The Russians have no reason for animosity towards the Ukrainian people as far as I can tell. Unlike, say, the Ottomans invading Europe. And especially if they signed a deal through negotiation prior to any violence.

I am not an expert in the area of Ukrainian/Russian history, so I base my position on all the arguments I have seen others make across the full spectrum, and I have seen zero people arguing from any such basis aside from vague allusions to nationalism. Like what makes the Ukrainians different from any of the bazillion other smaller groups that used to exist before they got smooshed into Russia? Is it rational to risk everything to not end up like them? Is where you ended up that much better? And anyway it’s not personal, your government has just gotten too friendly with the Americans, comrade. Etc. I don’t see any other argument for what is happening other than blind obedience to a government that is probably not being totally honest to the people about its motives (just think about how many times that happened during the world wars, that we concretely know about).


  What if the new government also imply that you have to change our religion? What if the new government does not believe in "free enterprise" and will TELL you which company you will work for. What if the new government change the sports teams you like? What if the new government change the language you speak. 

  See for the example https://en.wikipedia.org/wiki/Alsace#Timeline  . Notice how the official language suddenly changes when a new "government" from a different nation take over. Are you so sure that the French Canadians will not have a problem with suddenly English potentially been the official language?


My mother hosted and taught French to half a dozen eastern refugees over 20 years, from Chechnya, Georgia, Kazakhstan and a few Tatars from Russia. Russia is very ethnocentric. Not Nazi level ethnocentric, but what you would expect from a person from an empire from the last 19th century.


So much that is either wildly naive, or willfully disinforming, here.

> In the case of Ukraine, being peacefully “relocated” to Russia seems much better than what is happening now.

Provably false: People are risking their lives to avoid that.

No one outside of Russia (except perhaps you and Trump) ever believed Russia wouldn't pursue cultural genocide.

> Before the war the reputation of the Ukrainian government was not much different from the reputation of the Russian government.

What has the international reputation of a government got to do with... anything? "Oh well, no one can tell us apart from Russia, so we might as well sell our children and be sent to work camps voluntarily."

Also, that was dead wrong.


I remember seeing a Mandelbrot program for the C64 where half the image was computed on the floppy drive because it's basically the same computer as the main C64. I think it had a 6502 instead of a 6510 and different memory.

I believe the Apple II floppy drive was "dumb", that is, controlled by the 6502 of the Apple II, so the machine couldn't do anything/much while loading/saving data. But the C64 + floppy drive was essentially a two-node distributed system.


Yeah the Apple II floppy drive read and wrote the sectors using a tight loop of a couple assembly instructions. So yes couldn't do anything at all.


And yet it was like 1/10 the speed of the Apple II floppy drive.


That was because of the slow serial interface on the VIC and C64 side - IIRC, the UART required was removed from the 64 as a cost-cutting measure and it shipped having to bit-bang data to the drive. Overall, this is a very solid design idea.

With a little extra smarts, the drive could deal with ISAM tables as well as files and do processing inside the drive itself. Things like sorting and indexing tables in dBase II could be done in the drive itself while the computer was doing things like updating screens.

OTOH, on the Apple II, the drive was so deeply integrated into the computer that accelerator boards needed to slow down the clock back to 1MHz when IO operations were running. Even other versions of the 6502 would need to have the exact same timings if they wanted to be used by Apple.


The designers planned on using a shift register in the 6522 VIA chips to implement fast serial loading, but an undocumented bug in that chip forced them to fall back to the slow bit banging version that shipped


I don't know how many of you have seen a 1541 floppy drive in person either but it is massive, it's heavier and possibly bigger that an actual Commodore 64 and pretty expensive at the time too.

it's fun seeing c64 people on the defensive about it, a nice change from getting lectures from them about how their graphics were the pinnacle of 8-bit computing


Part of the size was the internal power supply. And that thing got hot, too. I used them at school, but at home only had the smaller 1541-II with an external power brick.

The Apple II disk drives, on the other hand, were not only cheap (Apple was different then!) and fast, but were powered by the ribbon cable connecting them to the computer.


Oh its MUCH better than that. Commodore did this because they had incompetent management. They shipped earlier products (VIC-20, 1540) with hardware defective 6522, but:

- C64 shipped with 6526, fixed version of 6522 without shift register bug

- C64 is incompatible with 1540 anyway

They crippled C64 and its floppies _for no reason_.


It was not for no reason. When adding a screw hole in the motherboard so it could be mounted in the case, they accidentally removed the high speed wire, dooming the C64 to the same slow data speed of the VIC-20 with it's faulty VIA.

The C64 data speed actually ended up being even slower than the VIC-20. You can read the full detailed here: https://imrannazar.com/articles/commodore-1541


ah yes, you're right, they did try to fix it in the C64, forgot that whole part of the story.

They finally got it right in the C128 though!


I haven't used LLVM in ages. I think it injects references to functions in the CRT when you do certain operations in your code. _fltused is one of them, and I think _ftol? or something like that for floating point numbers is another one. There was also a "security cookie" at some point in the MSVC libs. Unfortunately, I don't remember the linker flags to get rid of that reference, IIRC it had to do with runtime stack checking.

These references do not appear in the .ll file. They are injected when the .ll file is compiled to object files.

I think something in your code triggers a reference to one of the other injected functions and that pulls in the CRT.

Try compiling your test file into an .o or .obj, that is, without linking. Then dump the symbols in the object file to see what symbols are referenced. I suspect you'll see other references to symbols in CRT and you will have to replace those as well with stubs.

Unfortunately, I don't remember the linker flags to replace/suppress the default CRT libs. Well, actually, you might compile to .o / .obj and then manually link on your system. If you're using MSVC check the options to its "link" executable (I don't remember the exact name of the MSVC linker).


Possibly unhelpful for OP, but for MSVC try /NODEFAULTLIB for specific libraries, or IgnoreAllDefaultLibraries to remove everything not explicitly specified to the linker.

On x86 only, if you need to cast floats, try /QIfist (deprecated) to avoid hitting _ftol. Doesn't work for x64 or ARM.


I second this approach, also check with all the verbose flags enabled (eg. clang -v) to get a full list of the linking flags used.

One other thing you may want to try is writing a linker script manually. If you could provide the linker flags as mentioned elsewhere, that would be useful.


I'm German, I don't speak Dutch. But I was able to follow a Dutch tour guide in Den Haag just fine when she was explaining things in Dutch. She kindly repeated everything in English for my benefit (I was the only foreigner) even though I told her I understood her just fine in Dutch.

You have to "adjust your ears" a bit but I think if you know German and English then you can understand Dutch just fine if it's not slang.


It also depends on the particular dialect a German speaks. Dutch is effectively old German before all the various alterations and "reforms" to the German language that were instituted to create fragmentation between the germanic people of Europe, i.e., English, Dutch, Germans, Austrians, Swiss, Belgians throughout the ~16th-20th century by aristocrats driving wedges between peasants between kingdoms and dukedoms in order to define their own nations/ethnicities through language and culture so their royal families could rule over and would find it difficult to associate with each other. It is one of the things that also contributed to the fragmentation of Germany before unification, language barriers that even created unique cultures between sides of a valley that were in different dukedoms.

A similar thing has caused the tension between the germanic and Romance languages that followed the Roman border line N to S that separates Europe.


> Does it make sense to change direction at this point? I envy PhDs working on self-driving cars and rockets and AI.

You don’t need a PhD to work on rockets. Well, you might depending on what you want to do.

There are a lot of software opportunities at rocket companies from test systems, real-time measurements, operator interfaces, flight simulation, and various other internal supporting software.

You might be interested in and have the right experience for, for example, operator interfaces and various internal dashboards and database applications. That might be your entry into the field and you can try to branch out from there into other areas.


I'm having a lot of fun running Fedora in a VM with UTM on my MacBook (an old Intel one). You might try that if you already have an M1 MacBook.


I believe Kochenderfer et.al.'s book "Algorithms for decision making" is also about reinforcement learning and related approaches. Free PDFs are available at https://algorithmsbook.com


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: