flat assembler
Message board for the users of flat assembler.

Index > DOS > 17 byte demo!

Goto page 1, 2, 3  Next
Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Code:
use16
org 0x100
mov ax,0x13
int 0x10
push word 0xA000
pop es
paint:
adc ax, cx
stosb
loop paint
inc ax
jmp paint    


EDIT by DOS386 2014-May-22 : check out http://board.flatassembler.net/topic.php?t=9174 http://board.flatassembler.net/topic.php?t=16699 too
Post 31 Aug 2008, 08:55
View user's profile Send private message Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Whoa!
Now that is some self-organizing property.
Post 31 Aug 2008, 12:44
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Think you can shave a few bytes off it Question
Post 31 Aug 2008, 12:58
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
nice!
Post 31 Aug 2008, 14:26
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Well the obvious "mov ax,0x13" > "mov al,0x13" creates a 16-byte executable. But I'm unsure if AX is guaranteed to be zero at entry point though.
Post 31 Aug 2008, 15:43
View user's profile Send private message Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat
AL and BL will be 00 if the first FCB filename passed to the program has either no drive letter or a valid drive letter, or FF if it has an invalid drive letter. AH and BH are set the same way, but from the second FCB filename.

command.com sets the FCB filenames according to the command line. So for example, if you start a program as just "program" it will have AX = BX = 0000, but start it as "program Z:file" and it will have AX = BX = 00FF (assuming there is no Z: drive), and start it as "program C:file Z:file" and it will have AX = BX = FF00.
Post 31 Aug 2008, 18:49
View user's profile Send private message Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 294
Alphonso
Well if your willing to be dirty, what about
Code:
use16
org 0x100 
mov al,0x13
int 0x10
les ax,[bx]
paint:
adc ax, cx
stosb
loop paint
inc ax
jmp paint    
14bytes. Should work for most people although you will probably lose a few pixels. Also assuming ax=bx=0.


Last edited by Alphonso on 01 Sep 2008, 02:42; edited 1 time in total
Post 31 Aug 2008, 20:56
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
the same, 14 bytes, but moving.
Code:
org 100h
mov al,13h
int 10h
les ax,[bx] 
paint: 
adc ax, cx
stosb 
loop paint 
inc ax
loop paint
              


[edit], what is very strange is that it will draw perfect circles, into a square dimension."without any sincos".
Post 31 Aug 2008, 21:44
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
That's pretty cool edfed!
Post 01 Sep 2008, 01:51
View user's profile Send private message Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 294
Alphonso
12 Bytes, but not as nice looking
Code:
org 100h

 mov al,13h
 int 10h
 les ax,[bx]
paint:
 sbb ax,di
 stosb
 inc di
 jmp paint    
Post 01 Sep 2008, 21:47
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
Alphonso wrote:
12 Bytes, but not as nice looking
Code:
org 100h

 mov al,13h
 int 10h
 les ax,[bx]
paint:
 sbb ax,di
 stosb
 inc di
 jmp paint    


but 12 bytes.
Wink

[edit]

just an idea, but what about an executable format with a " stack & registers" header?
something to assume value to registers and stack, use less memory than the initialisation code. hte routine thats preload the regs is in the os, while file loading.
Code:
format as .prexe
.eax dd 0
.ebx dd 0
.ecx dd 64000
.edx dd 2008
.edi dd 0
.esi dd mainentry
.esp dd 57AC4h
.ebp dd 1000h
.cs dd 1000h
.ds dd 0
.etc etc 

    


.exe is still likt this but it don't have general registers init table.
Post 01 Sep 2008, 23:14
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
Anyone care to explain what it does to a person under 64-bit environment. 16-bit isn't my cup of tea (I imagined simulating it in my head).
Post 02 Sep 2008, 16:18
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
That person could use DOSBox Wink

Image
Post 02 Sep 2008, 17:33
View user's profile Send private message Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville
Here's a VESA LFB version of bitshifter's 17-byte demo.

It assumes you're in Flat Real mode because in most VESA Bios's the linear buffer maps to the top few MB of the 4GB address space. It also assumes your Bios supports VESA LFB - no checks. I've added exit code so you can run it in pure DOS without crashing.

Despite the higher resolution, it runs very fast - so the colours look a bit washed out because they're changing so fast.

Code:
;assemble with FASM (66 bytes + 256-byte VESA buffer)
   ORG     0100H
       MOV     AX,4F01H
    MOV     CX,101H 
    MOV     DI,VESABUF
  INT     10H
 MOV     ECX,[DI+28H]    ;save LFB address
   MOV     AX,4F02H
    MOV     BX,4101H        ;linear 640x480x8-bit mode
  INT     10H
 PUSH    0000
        POP     DS
  MOV     EBX,ECX         ;LFB address
PAINT0: XOR ESI,ESI
     XOR     CX,CX
PAINT:     ADC     AX,CX
       MOV     [EBX+ESI],AL    ;write pixel
        INC     ESI
 LOOP    PAINT
       INC     AX
  PUSH    AX
  MOV     AH,1
        INT     16H
 POP     AX
  JNZ     QUIT
        CMP     ESI,50000H      ;>full screen?
   JZ      PAINT0          ; -y, back to top
   JMP     PAINT   
QUIT:   INT     20H
VESABUF:                     ;256 bytes not initialised          

_________________
FAMOS - the first memory operating system
Post 05 Sep 2008, 07:45
View user's profile Send private message Visit poster's website Reply with quote
asmdude



Joined: 01 Sep 2008
Posts: 2
asmdude
What does this do:
Code:
les ax,[bx]    

?
Post 05 Sep 2008, 19:36
View user's profile Send private message Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 294
Alphonso
loads es:ax from memory location [bx]

So if BX=0 this points to DS:0000 which is the start of the PSP for a .com file.

Register AX will get loaded with the first two bytes, normally CD20h

Segment register ES will get loaded with the next two bytes which should be the available memory to DOS in paragraphs (1 paragraph = 16 bytes). This will probably be a little under 640k or A000h, ie 9Fxx.
Post 05 Sep 2008, 20:05
View user's profile Send private message Reply with quote
asmdude



Joined: 01 Sep 2008
Posts: 2
asmdude
Thanks! Smile
Post 05 Sep 2008, 20:16
View user's profile Send private message Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville
Can anybody write a paged VESA version of my linear VESA code above in less than 66 bytes? I don't expect it to run faster, just smaller code Exclamation

_________________
FAMOS - the first memory operating system
Post 05 Sep 2008, 20:46
View user's profile Send private message Visit poster's website Reply with quote
Chewie RFC



Joined: 25 Oct 2008
Posts: 3
Location: California
Chewie RFC
Alphonso wrote:
loads es:ax from memory location [bx]

So if BX=0 this points to DS:0000 which is the start of the PSP for a .com file.

Register AX will get loaded with the first two bytes, normally CD20h

Segment register ES will get loaded with the next two bytes which should be the available memory to DOS in paragraphs (1 paragraph = 16 bytes). This will probably be a little under 640k or A000h, ie 9Fxx.


But WHY does this work? VGA RAM starts at A000. The segment 9FFF (or whatever it happens to load) is still part of DOS memory. I can't figure out why this is writing pixels to the screen when ES is not pointed to the video RAM. Any help?
Post 25 Oct 2008, 07:08
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
Debug with dos debug and you will understand Smile
First you must to be an Hacker ,then programmer Razz

_________________
Nil Volentibus Arduum Razz
Post 25 Oct 2008, 08:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.