All the program has to do is repeatedly get the current mouse position and set the pixel there, and that's all it does. These two links should help make sense of it: http://stanislavs.org/helppc/int_33.html http://stanislavs.org/helppc/int_10.html The main loop contains an implicit state-machine that does multiple things on different iterations, which is partly responsible for the small size. Another thing that you c…
Paint16b: A 16 byte paint program written in 12 lines
31–40 of 70 posts
Re: Paint16b: A 16 byte paint program written in 12 lines
#32Earlier quoted context omitted.
Is assembly not common knowledge anymore?
In the parents defense 'assembly' isn't one thing. Every assembler has a different syntax, as does every chip family. The parent might be a master of 6502 ASM. And as that XKCD comic says. Everyone has to learn even the most obvious thing for the first time at some point.
Confusing Asm with early (GOTO-only) BASIC, on the other hand, would seem far more common to me.
Re: Paint16b: A 16 byte paint program written in 12 lines
#33pretty cool, but why not have it a tiny tiny bit longer code and not strt with 2 flat out assumptions? I mean im not familiar with dos deeply and if these will be true 100% of the time, but as it reads, it reads like silly code which might crash or work unexpectedly in certain situations. either way cool! :D
Re: Paint16b: A 16 byte paint program written in 12 lines
#34Earlier quoted context omitted.
This applies to general public but someone with Freelance Web developer based in Amsterdam. Mostly Node and React. in their bio should probably know what Assembly is...
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…
Re: Paint16b: A 16 byte paint program written in 12 lines
#35All the program has to do is repeatedly get the current mouse position and set the pixel there, and that's all it does. These two links should help make sense of it: http://stanislavs.org/helppc/int_33.html http://stanislavs.org/helppc/int_10.html The main loop contains an implicit state-machine that does multiple things on different iterations, which is partly responsible for the small size. Another thing that you c…
Why is the ret necessary? Is this not an infinite loop?
; allows exit if the mouse is leftmostRe: Paint16b: A 16 byte paint program written in 12 lines
#36Earlier quoted context omitted.
Why is the ret necessary? Is this not an infinite loop?
The loop instruction decrements CX, and then jumps if it is nonzero. Otherwise it "falls through". At that point CX contains the X coordinate of the cursor. Hence the comment: ; allows exit if the mouse is leftmost
Re: Paint16b: A 16 byte paint program written in 12 lines
#37Re: Paint16b: A 16 byte paint program written in 12 lines
#38Not 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.
Re: Paint16b: A 16 byte paint program written in 12 lines
#39Re: Paint16b: A 16 byte paint program written in 12 lines
#40> assume ah=0; assume bx=0 Hmm. So the second time this program is run, it will fail?
No, AFAIK MS-DOS always initialises it to zero before starting the program. I'm trying to find a better reference, but I think this[0] effectively explains what state the registers are in on entry to your program. Edit: I take that back. According to [1]: .COM-format executables begin running with the following register values: AL = 00h if first FCB has valid drive letter, FFh if not AH = 00h if second FCB has valid…