pouët.net

tiny "red" challenge (msdos)

category: code [glöplog]
Recent conversation with trixter had the following:

Quote:
Looking at the honoring sizecoding logo again, i remembered a recent finding:
When goblinish was doing his "red screen" in 14 bytes, i did the same for Msdos, but in 6 bytes
https://www.pouet.net/prod.php?which=78397#c838457

To my surprise, it's doable in *five* bytes, and being cleaner and more elegant at the same time.

So far i didn't "make use" of that trick ... can you spot it? ;)


The code for six bytes:
Code:X les cx,[si] inc sp stosb jmp short X+1

you can test it online here (just paste and hit "run")

So, can you do it in five? ;)
added on the 2020-09-13 19:27:55 by HellMood HellMood
Quote:
The code for six bytes:
Code:X les cx,[si] inc sp stosb jmp short X+1

Releasen, und den Release "Rot in Hell" nennen ;)
added on the 2020-09-13 20:42:52 by SiR SiR
Cool name =) but i won't release that ;)

Anyway, i'll spoil the SHA256 for the solution already ^^
Code:7841bf3816cec52b3df54621eacf03c31f4540bd4ac535b4486519ba1978080d
added on the 2020-09-13 21:01:31 by HellMood HellMood
I also made that a code-golf stackexchange challenge. I guess people over there are not exactly happy that it's restricted to DOS, but it is what it is ;)
added on the 2020-09-14 15:20:34 by HellMood HellMood
It's probably not really suitable for the code-golf format too because you have essentially restricted the number of valid answers to maybe... one? two? three?
Yes, that is probably true. I can't however open the challenge to other languages "just for fun" (so i have been told), in that case i would have to accept any 5 bytes answer as winner which i don't want. I just expect that otherwise a (new era code golf) language i never heard of does it in 1 or 2 bytes, just because these languages are specifically designed that way ... So, closed MSDOS challenge it is ^^
added on the 2020-09-14 15:33:17 by HellMood HellMood
for ZX Spectrum 7 bytes:

Code: ; to compile: pasmo --tapbas red.asm red.tap label.txt huj.txt --listing org #9012 start ld a,c;18 OUT ($FE), A X: ld (hl),c inc hl jr X END start


without red border - 5 bytes. In some cases - 4
added on the 2020-09-14 16:57:45 by g0blinish g0blinish
oops - 4 bytes
added on the 2020-09-14 17:25:39 by g0blinish g0blinish
Impressive, especially that you're pulverizing your own 14b with this ;)
What does "in some cases" mean?

What always bugs me a little is that "org..." term at the start
as far as i understand, that means you can inject your code
somewhere -arbitrarily- into the memory

If you leave that out, would the code still work? If not, wouldn't
that count towards the total byte count? ;)

And where are all the dos coders ^^ Is this too boring? Too hard?
added on the 2020-09-14 18:10:16 by HellMood HellMood
"some cases" - I've put another code
Code: org #fffc start ld (hl),$12;fffc inc hl ;fffe db $18 ;ffff END start


again, 4 bytes, but it doesn't work (

ORG is an old trick: after USR(Adr) BC=Adr
added on the 2020-09-14 18:16:29 by g0blinish g0blinish
wasn't too hard..
Code:PUSH SI LES AX,[SI] STOSW RET

if you like this kind of shit then you can play here:
http://golf.shinh.org/
not really demoscene related challenges :-|
And we have a winner =)
Nah, it wasn't too hard, but more fun to make it a challenge, right? ;)
I'm mostly interested to make DOS codes shorter,
and finding that the "split jump" (push si/ret) actually
is the solution to a problem was quite nice =)

For completeness, the solution that generates the SHA256
Code:les ax,[bx+si] push si stosb ret ;salt it good! ;40987rthfgzsi ;98vhsp0ycb373 ;29387fg27fb3b
added on the 2020-09-14 19:09:16 by HellMood HellMood
hey, stosb doesn't work, only stosw!
:-)
Not sure if you're kidding ^^ It works (first two instructions are exchanged!)

Also, waiting for g0blinish to crush us all with the 4 bytes version ^^
added on the 2020-09-14 19:15:20 by HellMood HellMood
(ok, at least in my code)
gosh, i forgot add post about stack xD
added on the 2020-09-14 19:40:53 by g0blinish g0blinish
maybe this link says more...
DOS challenges
Quote:
for ZX Spectrum [...] without red border - 5 bytes.

This is a solution for ZX Spectrum with red border in 5 bytes:
Code: ORG #9212 begin: out (#70),a x: EQU $-1 inc hl jr x
added on the 2020-09-15 00:41:08 by introspec introspec
BB Image

I give up. That moment then nuffing to add
added on the 2020-09-15 08:03:05 by g0blinish g0blinish
Quote:
Not sure if you're kidding ^^ It works (first two instructions are exchanged!)

Also, waiting for g0blinish to crush us all with the 4 bytes version ^^
Well, since my 5b solution for ZX Spectrum (with border) is simply an improvement on g0blinish's 7b solution, you can say that the equivalent solution WITHOUT border is kinda his too:
Code: ORG #9012 begin: x: ld (hl),c inc hl jr x
This is 4 bytes only.

I also wanted to make a remark regarding the use of ORG. You are correct that this trick feels a bit unfair, but this is the tradition that goes way back due to the lack of binary executable file format on ZX Spectrum.
added on the 2020-09-15 15:06:28 by introspec introspec
HellMood means x86 4bytes
added on the 2020-09-15 15:31:19 by g0blinish g0blinish
Code: ; Expects: AX 1010H ; BX color register to set (0-255) ; CH green value (00H-3fH) ; CL blue value (00H-3fH) ; DH red value (00H-3fH) ; Expects: AX 1012H ; BX first DAC register to set (0-00ffH) ; CX number of registers to set (0-00ffH) ; ES:DX addr of a table of R,G,B values (it will be CX*3 bytes long) mov ax,1010h int 10h ret


with ax=1010h I got blue background, with 1012h -black one. and again 6 bytes
added on the 2020-09-15 16:14:53 by g0blinish g0blinish
Actually I meant what goblinish was referring to: the possibility to inject code whereever you want on zx. that is quite a feat :) I welcome the 4 byte solution anyway :)

Anyway I would argue that the six bytes solution for DOS is actually also five bytes, RET is not required.
added on the 2020-09-15 16:47:34 by HellMood HellMood
6 byte Amstrad CPC BASIC version (no border and shows READY prompt over the red):

Code: 1?"\x0E\x03\x0C


(type the special chars with control N, control C, control L)
I tried to do this on the SNES, stripping to the bare necessities but failed :) I'll give it another whirl later.
added on the 2020-09-16 00:54:55 by superplek superplek

login