flat assembler
Message board for the users of flat assembler.

Index > DOS > 17 byte demo!

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
Chewie RFC



Joined: 25 Oct 2008
Posts: 3
Location: California
Chewie RFC 25 Oct 2008, 16:47
DJ Mauretto wrote:
Debug with dos debug and you will understand Smile
First you must to be an Hacker ,then programmer Razz


I have, ES always points to 9FFF, never to A000.
Post 25 Oct 2008, 16:47
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 25 Oct 2008, 17:51
Quote:

I have, ES always points to 9FFF, never to A000.

Right, but remember that addressing in real mode is calculated as segment*16 + offset, then, for example, 9FFF:0010 = A000:0000
Post 25 Oct 2008, 17:51
View user's profile Send private message Reply with quote
Chewie RFC



Joined: 25 Oct 2008
Posts: 3
Location: California
Chewie RFC 25 Oct 2008, 18:03
LocoDelAssembly wrote:
Quote:

I have, ES always points to 9FFF, never to A000.

Right, but remember that addressing in real mode is calculated as segment*16 + offset, then, for example, 9FFF:0010 = A000:0000


Fvck me... thanks dude, I appreciate it. Makes sense now! But what prevents it from writing to 9FFF:0000-9FFF:000F? It seems like eventually it'd get there and that's DOS memory.
Post 25 Oct 2008, 18:03
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 25 Oct 2008, 19:15
A very fatal scenario Smile It is not as safe as using the original code but maybe it is very unlikely that the last paragraph of memory is allocated before running the code. However those quasi-TSR that are loaded at boot time (by a boot loader) would probably suffer serious consequences because it is very common to allocate memory by reducing in N KBs the conventional memory and placing the code+data at the end of the conventional memory.

I let the real DOS programmers comment more about this now Razz
Post 25 Oct 2008, 19:15
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 794
Location: Adelaide
sinsi 05 Nov 2008, 05:04
neville wrote:
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

33 bytes?
Code:
format binary as 'com'
org 100h
mov ax,4f02h
mov bx,101h
int 10h
push 0a000h
pop es
sub bx,bx
paint:
adc ax,cx
stosb
loop paint
mov ax,4f05h
int 10h
add dl,16 ;assumes 4K granularity - use inc dl for 64K
loop paint
ret
    



[rant]
How does centrelink expect me to apply for jobs 5 days a week/7 hours a day ? there are only so many jobs advertised each day. wow I am seriously b o r e d here.
[/rant]
Post 05 Nov 2008, 05:04
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 05 Nov 2008, 14:26
^that assembles to 30 bytes and doesn't run on my computer.
Post 05 Nov 2008, 14:26
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 794
Location: Adelaide
sinsi 05 Nov 2008, 22:19
It was programmed on an old P100 with a cirrus logic 5436 (?) and nt4.
Changing "add dl,16" to
Code:
  inc dl
  and dl,0fh    

makes it work on a q6600/8800gt
Post 05 Nov 2008, 22:19
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 05 Nov 2008, 23:13
assemble in many bytes, but don't use keyboard bios or dos interrupt.

Code:
        org 100h
        call newint9
        mov ax,13h
        int 10h
        les ax,[bx]
@@:
        sbb ax,di
        pushf
        cmp byte[key+key.cur],key.echap
        je @f
        popf
        stosb
        inc di
        jmp @b
@@:
        call oldint9
        ret
include 'int9/int9/int9.inc'








    
Post 05 Nov 2008, 23:13
View user's profile Send private message Visit poster's website Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 06 Nov 2008, 02:31
I would suggest replacing the "ret" in the above code with
Code:
mov ax,04C00h
int 21h    

because with ret it just crashed on quit for me.....also for the mentioned int9.inc you should tell people where to get it. You have it included in the download IN THIS THREAD.

_________________
----> * <---- My star, won HERE
Post 06 Nov 2008, 02:31
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 06 Nov 2008, 18:07
my dear windwakr, int 21h is a dos interrupt and i never use any dos interrupt since i've wrote my own int9.
why have i wrote my own int9? because it have a special feature, it will put the last scancode in a pipeline, and set the byte corresponding to the key ( up to 256 keys) and then, you just have to read the value of the key in the keymap.

why don't i use mox ax,04C00H int 21h?
because a simple ret combined with optional mov ax,3, int 10h before is enough for me and don't depend on dos ints.

you can use any of the int9 folders i've uploaded.
or use this one specially made for 16bits


Description: it can be set as resident under dos, but MS command.com will not work, and any dos program cannot use this.
Download
Filename: int9.zip
Filesize: 4.56 KB
Downloaded: 631 Time(s)

Post 06 Nov 2008, 18:07
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 06 Nov 2008, 18:47
edfed,

ret depends on stack being balanced and int 0x20 @ cs:0 (usually comes from PSP:0). And you're proclaiming that you
edfed wrote:
never use any dos interrupt since i've wrote my own int9.
Good shot, bad aim. Wink

As to int9.zip sources: definitely comments are scarce. It's much easier to disassemble int9.bin with IDA (for xrefs and such). By the way, handler is stateless? It accepts any of the six bytes for "Pause" key in the similar manner, without check?
Post 06 Nov 2008, 18:47
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 06 Nov 2008, 19:44
i recognise, i have some problems to find an efficient way to understand pause.
i will use the mode3 one day, and it will be simpler.

mode1, the one used by all pc, bios & my int9 Sad
mode2, a littel like mode1, but better.
mode3, the best, and less documented, why???

in mode 3, it is logic, only one code / key.
one scancode if make, two if break( breakcode+ scancode).
then, translate all thecodes in a logical way, escape = 1, f1 = 2, f2 = 3 etc etc.
then, it will be much simpler and LOGIC.

about the coments, i putted labels, it is not for fun, it is the comments.
if you want to understand the code, read it.
Post 06 Nov 2008, 19:44
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 06 Nov 2008, 20:44
edfed,

Bitmap the pressed keys, queue their interpretation. Make the interpretation configurable. Once upon a time I'd programmed NumLock as another shift (remember IBM PC 83-key 'board?).

The only use for alternate modes is to make keys non-typematic. WASD in first-person shooters generate too much unnecessary traffic (and interrupts, that's the point Wink
Post 06 Nov 2008, 20:44
View user's profile Send private message Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 21 Jan 2009, 22:45
Can Some one explain what this dose? I was able to compile it, And see it
but Im new at anything but C.

use16
org 0x100
mov ax,0x13
int 0x10
push word 0xA000
pop es
paint:
adc ax, cx
stosb
loop paint
inc ax
jmp paint

Please Surprised
Post 21 Jan 2009, 22:45
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4227
Location: vpcmpistri
bitRAKE 22 Jan 2009, 05:03
Code:
; tell FASM we doing the 16-bit thing
use16
; tell FASM where IP and code/data are located in memory
org 0x100
; tell BIOS we want graphics mode 
mov ax,0x13 
int 0x10
; this is where the screen memory is for gfx
push word 0xA000 
pop es 
; endless loop writing to screen memory
paint: 
adc ax, cx 
stosb ; write to ES:DI
loop paint 
inc ax 
jmp paint    
Post 22 Jan 2009, 05:03
View user's profile Send private message Visit poster's website Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 22 Jan 2009, 11:39
oh, that realy helps, thanks Smile
Post 22 Jan 2009, 11:39
View user's profile Send private message Visit poster's website Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 19 Apr 2009, 20:32
I wonder If there is a way to rewrite it from 17 bytes and use alot more
Hex to make it smaller Confused Before I try it, do you think it is posible?
Post 19 Apr 2009, 20:32
View user's profile Send private message Visit poster's website Reply with quote
asmdemon



Joined: 18 Jan 2004
Posts: 97
Location: Virginia Beach, VA
asmdemon 20 Apr 2009, 01:04
Here is my compo entry for EFnet's ASM compo #9. Very similar program. The actual entry, hell, won that competition. I modified it one day to include exit on keypress.


Description: Hell is original entry. Rain is a modification of Hell.
Download
Filename: compo.zip
Filesize: 2.05 KB
Downloaded: 599 Time(s)


_________________
It is better to be on the right side of the devil than in his path.
Post 20 Apr 2009, 01:04
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20627
Location: In your JS exploiting you and your system
revolution 20 Apr 2009, 02:00
Coddy41 wrote:
I wonder If there is a way to rewrite it from 17 bytes and use alot more
Hex to make it smaller Confused Before I try it, do you think it is posible?
Putting things in hex won't help you. You're just making yourself into a human compiler. Why do that when the software can do it faster and without mistakes?
Post 20 Apr 2009, 02:00
View user's profile Send private message Visit poster's website Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 20 Apr 2009, 17:26
oh, yeah, good point... well right now it is at 12 bytes and is cut into 4
sections on the screen, If it only used 1 section could it use less bytes?

@asmdemon: I like the one titled "Hell" it is very mezmorizing @_@
Post 20 Apr 2009, 17:26
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.