Live data from Hacker News

Paint16b: A 16 byte paint program written in 12 lines

sizecoding.org

51–60 of 70 posts

Re: Paint16b: A 16 byte paint program written in 12 lines

#52
post #4

Earlier quoted context omitted.

Is assembly not common knowledge anymore?

There is a significant portion of developers ( particular web and app ) and IT staff who never studied computer science in college but instead moved into programming/IT mid career. Most of them probably never heard of or seen assembly code. However, I would be shocked if anyone who went through a CS program wasn't aware of assembly programming.

CS tends to be algorithms not low level programming. Unlike say robotics or electronics.

Re: Paint16b: A 16 byte paint program written in 12 lines

#53
post #22

Earlier quoted context omitted.

Should they? Why? Look, I wrote assembly when I was a teen, went to school for CS twice and can't do squat with it today. I know it is ASM but beyond that it's not that interesting or exciting to me. This person's job is strictly to build frontend web apps. Knowledge of assembly is largely ornamental to that pursuit. I'm not even sure someone getting as BSCS and MSCS would spend enough time with it to care. It's impo…

I don’t think everyone who writes code needs to know how to write assembly, but I think it’s important to know that it exists and possibly what it looks like. Maybe not while you’re still learning to code, but once you’ve actually started working in the industry it’s a good thing to know, if only because it gives you a bit of context of how computers actually work.

1) No, you only need to know about assembly language if you go for deep microoptimizations.

2) Assembly is vastly more high level than modern hardware, so much that most of those CISC instructors are broken into tens to thousands micro operations. It's not even close to any kind of machine architecture course. You will need that kind of deep knowledge to write optimal compilers which probably take (extended) C and not assembly language.

Re: Paint16b: A 16 byte paint program written in 12 lines

#54

Earlier quoted context omitted.

Why? Serious question. Nothing about that bio says “this person should know about the existence of assembly” to me. And besides, with their question they’ve made an effort to learn about it so I don’t see any reason to criticize them for not knowing. It’s like the xkcd referenced says, every day there are a bunch of people hearing about something for the first time. We should be happy that they hear about it!

Really? A programmer of any stripe who doesn't recognize assembly just seems like a very wrong thing. One wonders what their mental model of the computer is like.

I imagine that most people abstract at the levels above and below assembly languages. E.g. they know about high level languages, and that a CPU cannot directly run that, but their view of the lower level probably does not include any human readable artifacts such as latin characters but rather binary and voltages.

Re: Paint16b: A 16 byte paint program written in 12 lines

#55

Not to poo-poo this (I think this is very impressive) but the reason why it is so small is that it just calls a bunch of bios and mouse driver routines. If those items didn’t already exist the program would surely be larger.

Not unique to Wintel, or this program. That's the reason programs were so small for the original Macintosh. Most of the essential routines, especially Quicktime, were in ROM.

Re: Paint16b: A 16 byte paint program written in 12 lines

#56
post #47

Earlier quoted context omitted.

The value of BX is however strictly undefined, but practically always 0. Potentially some DOS will load this register with a different value, but probably no version of MS-DOS.

But why not explicitly set the register to 1 rather than assume its 0 and increment it by 1?

Saves one byte, I assume. Register targets are typically encoded in the opcode while direct values follow the opcode byte.

Re: Paint16b: A 16 byte paint program written in 12 lines

#57
post #47

Earlier quoted context omitted.

The value of BX is however strictly undefined, but practically always 0. Potentially some DOS will load this register with a different value, but probably no version of MS-DOS.

But why not explicitly set the register to 1 rather than assume its 0 and increment it by 1?

On x86, some instructions are longer than others. Incrementing is a single byte. Setting the value 1 if you don’t assume anything is going to be 2 bytes (al, ah, bl, etc.) or 4 bytes for (ax, bx, etc.)

This online x86/x64 assembler is great: https://defuse.ca/online-x86-assembler.htm

Re: Paint16b: A 16 byte paint program written in 12 lines

#58

Earlier quoted context omitted.

There is a significant portion of developers ( particular web and app ) and IT staff who never studied computer science in college but instead moved into programming/IT mid career. Most of them probably never heard of or seen assembly code. However, I would be shocked if anyone who went through a CS program wasn't aware of assembly programming.

CS tends to be algorithms not low level programming. Unlike say robotics or electronics.

Even so, don't most CS departments have an assembly class? Or maybe get introduced to it in a Computer Architecture class?

Re: Paint16b: A 16 byte paint program written in 12 lines

#59
post #47

Earlier quoted context omitted.

The value of BX is however strictly undefined, but practically always 0. Potentially some DOS will load this register with a different value, but probably no version of MS-DOS.

But why not explicitly set the register to 1 rather than assume its 0 and increment it by 1?

Probably because (IIRC) mov is 2 bytes and inc is only 1 byte and they're optimizing for minimum size.

Re: Paint16b: A 16 byte paint program written in 12 lines

#60
post #4

Earlier quoted context omitted.

Is assembly not common knowledge anymore?

lots of 'programmers' don't even know what a debugger or a cpu is xD let's not talk about common knowledge in 2018 please its depressing :D

Last week I had to explain to an IT guy what a tractor feed printer is. He'd never heard of "tractor feed."
Post reply on HN