BLUE
kissa.bsky.social
@kissa.bsky.social
Tomfoolery, nincompoopery, programming
37 followers374 following39 posts
kissa.bsky.social

That’s why it would only affect your followers — don’t follow people who broadcast wrong signals. I think subtle negative signals would be more useful than generally imagined, but textual medias rarely use them. TikTok can detect when people skip videos, but it’s harder in these Twitter clones

0
kissa.bsky.social

What if we made a social network where instead of liking, blocking and muting, you would “hush” and “boost” posts? Hushing would decrease visibility to your followers. Boosting would increase it. Who’s with me?

1
kissa.bsky.social

People in Bluesky vs. people in Place Previously Known As Twitter

Tweet by @heydonworks that sparked some controversy in 2019:

What do you like to do when you're not coding?
Vue-based developer: I am fond of cooking, getting stuck into a good graphic novel and—
React-based developer: WEIGHTS. BROING DOWN. MORE WEIGHTS. TRUMP. WEIGHTS. GUNS. THE FREE MARKET.
0
kissa.bsky.social

“Can you explain this gap in your resume?” Yes, child; that was when I carried you

0
kissa.bsky.social

Thank you! Kissa is a many-splendored thing

0
kissa.bsky.social

Now I need to take a break of few days, weeks, or months, depending on when I next manage to free up some time. This was a miserable week for writing code: I had planned 5 full working days and got some 11+ hours done. But such is life sometimes

0
kissa.bsky.social

Actually need to implement a bunch of arithmetic instructions and test them somehow efficiently. Here's a start.

List of test instructions that ChatGPT wrote me.

export const opcodes: { [key: number]: string } = {
	0b00000000: "add", // add <op1> <op2> <op3>  - op1 <- op2 + op3
	0b00000001: "sub", // sub <op1> <op2> <op3>  - op1 <- op2 - op3
	0b00000010: "mul", // mul <op1> <op2> <op3>  - op1 <- op2 * op3
	// etc, ending with 0b00001100: "mov"
	
	0b00010000: "adda", // add <op1> <op2>       - op1 <- op1 + op2
	0b00010001: "suba", // sub <op1> <op2>       - op1 <- op1 - op2
	0b00010010: "mula", // mul <op1> <op2>       - op1 <- op1 * op2
	// etc, ending with 0b00011100: "nop"
	
	0b11110000: "hlt", // hlt <?> <?> <?>         - halt program execution
	0b11110001: "hcf", // hcf <?> <?> <?>         - halt and catch fire
}
Implementation of first 3 arithmetic instructions:

	if (instr === "add") {
		writeOperand(op1, op2value + op3value)
	}
	if (instr === "sub") {
		writeOperand(op1, op2value - op3value)
	}
	if (instr === "mul") {
		writeOperand(op1, op2value * op3value)
	}
	if (instr === "hlt") {
		return false
	}
	if (instr === "hcf") {
		error("Machine caught fire")
	}
	return true
test("arithmetic instructions", () => {
	testArithmetic(instr.add, 0x1234, 0x2345, 0x3579)
	testArithmetic(instr.sub, 0x4131, 0x2121, 0x2010)
	testArithmetic(instr.mul, 111, 20, 2220)
	testArithmetic(instr.mul, -111, 20, -2220)
	testArithmetic(instr.mul, -1, -0x7fff, 0x7fff)
	// TODO should overflow probably
	// testArithmetic(instr.mul, -1, -0x8000, -0x8000)
})
1
kissa.bsky.social

Here's the whole set of immediate instructions. This makes me reconsider the design, not only because of the effort of testing all of that stuff but also because I don't want to type "SHLAB" when I just want to do a 1-bit left shift. Maybe it's time to write some programs first and reconsider this.

Previous picture, plus new stuff (8-bit immediate instructions)

// If bit 6 (immediate mode) is set, bit 7 sets "byte mode"
//
// Instruction names are postfixed with "b" for immediate.
// Arithmetic instructions with 8-bit immediate operand (96-111):
//
// addb op1, op2, imm8 ; op1 <- op2 + imm8     01100000
// subb
// mulb
// divb
// modb
// andb
// orb
// xorb
// shlb
// shrb
// add1b
// sub1b
// movb
//
// // Arithmetic instructions with 8-bit immediate operand, augmented assignment
// (112-127):
//
// addab op1, imm8     ; op1 <- op2 + imm8     01110000
// subab
// mulab
// divab
// modab
// andab
// orab
// xorab
// shlab
// shrab
// incab
// decab
// nopab
1
kissa.bsky.social

I'm deliberately making a 1:1 mapping between names and opcodes to make assembling and disassembling easier. I may have to walk back on this decision later. It makes more complex names for often used instructions: addai a, 1234 ; a: augmented assignment, b: immediate addab a, 10 ; b: byte immediate

1
kissa.bsky.social

Good two hours reserved for today, let's continue with immediate instructions. Since we have augmented mode too, there's quite a bunch of these. Instructions that logically take only 1 argument don't make sense, such as INC/DEC, and some potential ones like NEG, NOT, CLR. Except for MOV.

Immediate instructions with 16-bit operand (32-47), plus augmented ones (48-63)

(Details omitted due to space constraints)

addi op1, op2, imm16 ; op1 <- op2 + imm16   00100000
subi
muli
divi
modi
andi
ori
xori
shli
shri
add1i
sub1i
movi

addai op1, imm16     ; op1 <- op2 + imm16   00110000
subai
mulai
divai
modai
andai
orai
xorai
shlai
shrai
incai
decai
nopai
1
kissa.bsky.social
@kissa.bsky.social
Tomfoolery, nincompoopery, programming
37 followers374 following39 posts