Luanti logo

IRC log for #luanti, 2026-09-18

| Channels | #luanti index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
00:12 fling joined #luanti
00:16 fling joined #luanti
00:23 fling joined #luanti
00:30 cheapie 3336 lines of code to make a glowlight flash once per second has to be some kind of record
00:31 cheapie 3308 of that is Lua, the rest is RISC-V assembly
00:32 user333_ why do it in a simple way when you could do it like that?
00:33 cheapie FWIW this is the assembly part: https://gist.github.com/cheapie/45406dabdd7d031859caf6a1832a1675
00:33 * user333_ pretends to know RISC-V assembly
00:33 user333_ nice code
00:35 cheapie 1-4 set up the MMIO region and configure pins B and D as output (also turning the output on), 7-11 is hopefully self-explanatory, 12-13 waits for the blinky plant (on one of the other pins) to blink, 14 jumps back to 6 to restart the loop when it does
00:35 cheapie 17-19 load the current mesecons I/O values, toggle pins B and D, then write them back
00:36 user333_ ah
00:36 cheapie 25 does the sleeping between flashes (the ones where it's not waiting for the blinky plant), 26-27 make it run line 25 13 times (the 13 comes from line 23) before it returns
00:38 cheapie Lines 12-13 are the ones I'm most proud of - they're borrowed from my digital sign thing and are my favorite way to wait for a mesecons input to change on RVController, provided I don't care which input it is
00:38 PoochInquisitor joined #luanti
00:39 user333_ i assume assembly becomes much easier once you know all the keywords
00:39 cheapie The lr.w on line 12 is a "load reserved" from Zalrsc (part of A), it basically means "read the data from this memory address and then keep an eye on it to see if anyone else changes it". Normally you would pair it with an sc.w (store conditional), which is "write this data to this memory address, but ONLY if nobody touched it since the lr.w"
00:39 cheapie yes
00:40 user333_ otherwise it just looks like little clumps of letters
00:40 cheapie In this case I'm instead pairing the lr.w with a wrs.nto (wait for reservation set, no timeout), which is from Zawrs and means "halt until someone touches the memory I did an lr.w on"
00:42 user333_ makes me respect the work C compilers do to translate easily human-readable code into lower-level assembly
00:43 cheapie Really even just knowing what the instruction abbreviations expand to helps a lot. li = load immediate, csrw = CSR write, sh = store halfword, call = (take a guess), lr.w = load-reserved word, wrs.nto = wait on reservation set, no timeout, j = jump, lb = load byte, xori = XOR with immediate, sb = store byte, ret = return, pause = ...pause, addi = add immediate, bnez = branch if not equal to zero
00:45 cheapie li, csrw, call, j, ret, and bnez there are pseudoinstructions, most likely expanding in this case to: lui+addi, csrrw, jal, jal, jalr, and bne respectively
00:46 user333_ is there any real reason that assembly uses such abbreviated keywords?
00:47 cheapie Less tedious to type is probably the big one at this point
00:47 user333_ true
00:48 user333_ though not many people write assembly these days (aside from very low level stuff) so it doesn't matter *too* much
00:48 cheapie Like I'd much rather type "sh t1,0(s0)" as opposed to "storeHalfWord(temporaryRegister1,savedRegister0,0)"
00:50 cheapie Modern amd64 has instruction names like "VCVTTPD2UQQ", I'd really hate to have to type the full name of _that_ out
00:51 user333_ reminds me of when i picked up writing bash (well, POSIX shell usually), lots of unintuitive things
00:53 * cheapie gives user333_ https://www.cs.sfu.ca/~ashriram/Courses/CS295/assets/notebooks/RISCV/RISCV_CARD.pdf
00:54 cheapie RVController is RV32IMACB and therefore supports every instruction in there except for the F/D stuff on page 2 (and therefore also the corresponding pseudoinstructions on page 4)
03:12 SwissalpS joined #luanti
04:00 MTDiscord joined #luanti
04:25 YuGiOhJCJ joined #luanti
04:33 YuGiOhJCJ joined #luanti
05:23 fling_ joined #luanti
06:16 fling joined #luanti
06:30 potter joined #luanti
06:30 antitheus joined #luanti
06:56 dudz joined #luanti
07:27 fling joined #luanti
08:01 fling joined #luanti
08:03 Panquesito7_ joined #luanti
08:15 fling joined #luanti
08:16 fling joined #luanti
08:19 fling_ joined #luanti
09:04 fling joined #luanti
09:18 fling joined #luanti
09:20 [MatrxMT] joined #luanti
09:20 [MatrxMT] joined #luanti
09:23 fling joined #luanti
09:25 fling joined #luanti
09:39 est31 joined #luanti
10:02 est31 joined #luanti
10:04 fling joined #luanti
10:12 fling joined #luanti
10:14 est31 joined #luanti
10:15 fling joined #luanti
10:24 est31 joined #luanti
10:33 mrkubax10 joined #luanti
10:49 Unit193 joined #luanti
10:58 mrkubax10 joined #luanti
11:03 est31 joined #luanti
11:19 est31 joined #luanti
13:08 GNUHacker joined #luanti
13:27 PoochInquisitor joined #luanti
13:42 MinetestBot [git] CodingMantisUA -> luanti-org/luanti: HUD inventory: allow custom background per element (#17359) b4eb8b9 https://github.com/luanti-org/luanti/commit/b4eb8b91e611c3d83f7557c39b4f1caab9406e57 (2026-09-18T13:41:38Z)
14:56 jonadab joined #luanti
16:12 * cheapie hmms at https://www.reddit.com/r/StVO/comments/1goslcm/motor_abstellen/ for a bit, makes https://cheapiesystems.com/media/images/screenshot_20260918_111129.png
16:37 Panquesito7 joined #luanti
16:39 mrkubax10 joined #luanti
18:48 [MatrxMT] joined #luanti
18:50 kaylie joined #luanti
21:04 mrkubax10 joined #luanti
21:05 crabycowman123 joined #luanti
21:09 squeaktoy joined #luanti
21:10 crabycowman123 left #luanti
22:11 antitheus joined #luanti
23:21 CRISPR joined #luanti

| Channels | #luanti index | Today | | Google Search | Plaintext