flat assembler
Message board for the users of flat assembler.

Index > DOS > fast graphics routines

Author
Thread Post new topic Reply to topic
moile



Joined: 04 Feb 2005
Posts: 16
Location: nothing
moile 04 Feb 2005, 20:17
hello!
I am programming an OS

for the moment i only develop its routines

here is the routine of clearscreen

;needs mode13h and es at video buffer
Code:
buffer rb 64000
colcls db ?
db 'debut cls'
clearscreen:
               mov edi,[buffer]
               mov dl,[colcls]
@@:
               mov [edi],dl
               inc edi
               cmp edi,colcls
               jne @b
               ret
db 'fin cls'
    


and now routine colorbox
Code:
buffer rb 64000
x1 rd 1
y1 rd 1
xleng rd 1
yleng rd 1
xmax dd 320
color db ?
db 'debut colorbox'
colorbox:
               mov edi,[y1]
               shl edi,2
               add edi,[y1]
               add edi,[x1]
               add edi,buffer
               mov eax,[xleng]
               mov ebx,[yleng]
               mov dl,[color]
@@:            
               mov [edi],dl
               inc edi
               dec eax
               jne @b
               mov eax,[xleng]
               sub edi,eax
               add edi,[xmax]
               dec ebx
               jne @b
               ret
db 'fin colorbox'
    


i need help to use all the memory
dos dont accept code more than 640000 byte and i need all the memory for my buffers
if somebody know something thanks for
i wrote many routines
i promisse that i'll give you these


Last edited by moile on 19 Dec 2007, 04:47; edited 1 time in total
Post 04 Feb 2005, 20:17
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 05 Feb 2005, 10:25
well, they arent THAT fast...

anyway look for keyword "flat real mode", "unreal mode", "XMS", "EMS", "DPMI" (i quess the last three, especially the last one will be little too much for now)
Post 05 Feb 2005, 10:25
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog 05 Feb 2005, 10:59
CLS13h: ; proc, call with ES=0xA000, AL=color, & Vmode 13h set
MOV CX,320*200 ; =64000 & no buffer needed
XOR DI,DI ; zero out DI=offset
REPZ STOSB ;write AL to the screen seg
RET
// you don't need a buffer, do you ?
RB = Reserve Byte means that the original data remains at that location
and if you move it to the sreen seg as pixels, you git gibberish? don't you?
You can speeed up my code by STOSW or STOSD (CX=32 or 16 thousand)
-----------------
I've had a couple drinks tonight, (on foose ball night),
so I don't really understand your COLOR-BOX code,
but it looks like a double loop that paints a box in screen SEG.
A simple LOOP in a LOOP is the cure to that.

proc, call with, ES:DI=screen SEG:OFFSET, AL color, CX=height, DX=width
PAINTbox:
PUSH CX
MOV CX,DX ;do width
PUSH DI
REPZ STOSB
POP DI
ADD DI,320 ; next line down
POP CX
LOOP PAINTbox
RET

;it's kinda simple to paint a box, but makin it complicated is the hard part.
I sometimes make a proc that has a calling macro below.
The macro is used to call the proc
and give it input, kinda like this.

macro PBOXm SCRNoff,COLOR,HEIGHT,WIDTH {
MOV DI,SCRNoff
MOV AL,COLOR
MOV CX,HEIGHT
MOV CX,WIDTH
CALL PAINTbox
}

with this macro, I can paint a box any where on the screen & anywhere in my code, like this:

PBOXm 1290,4,20,30

Makes a box on line 4 (320*4=1280)
indented 10 pixels ( +10)
which is 20 pixels high & 30 pixels wide.

The above is untested code,
but you can mess around with it & maybe git it to werk for ya.
It looks like you've been taught by someone who wants to look intelegunt
more than he wants to help you.

Your memory moves in a loop is slow code,
& declaring a memory buffer of 64000 bytes of all
the same color value to move to screen seg is bloat ware.

Although my code is 8086 (8 bit code basicly)
it can be altered to WORD or Dword
SHR CX ; divides the WIDTH loop count x2
MOV AH,AL ; sets up for a word move (color x2)
REPZ STOSW ; moves a word at a time

The trade off of space & time is:
THE SPACE/size, of the code includes the SHR & MOV = a few bytes
THE SPEED/time, is cut in half (basicly).

Alot of the math can be done by the great FASM assembler.
Using the macro above, math can be used as an input.
PBOXm (320*4)+10,0404h,20,30/2
so the offset is computed by the assembler,
color 4 input is preset into AH & AL
width is cut in half because AH & AL is a WORD write using STOSW. etc.

If you're rendering a blem/pic use MOVSB in PAINTbox: ; proc,
& data at DS:SI gits moved to ES:DI screen seg:off quik.

I hope that helps some how.
Bitdog (AAA = alcoholic asm animal)
Post 05 Feb 2005, 10:59
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 07 Feb 2005, 17:42
hello, maeby you are interested in these:
Some simple VGA Routines (FAST!)
Dos Faq
Post 07 Feb 2005, 17:42
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4347
Location: Now
edfed 23 Feb 2007, 17:28
i want to rebecome moile is this possible

i've forgot my password and tryed to remake moile login but impossible
so i'm edfed
but i want to have moile login again
Post 23 Feb 2007, 17:28
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 24 Feb 2007, 01:32
Quote:
I am programming an OS
dos dont accept


You wouldn't need DOS if you really coded an OS Laughing

Quote:
code more than 640000 byte and i need all the memory
for my buffers if somebody know something


Use DPMI. http://board.flatassembler.net/topic.php?t=6311

XMS would do the job also (but worse).

Quote:
i want to rebecome moile is this possible
i've forgot my password and tryed to remake moile login but impossible
so i'm edfed
but i want to have moile login again


http://board.flatassembler.net/forum.php?f=7

Contact moderators.

Hint: use [co.de] and [/co.de] in your next post.

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 24 Feb 2007, 01:32
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 Feb 2007, 01:54
edfed wrote:
i want to rebecome moile is this possible

i've forgot my password and tryed to remake moile login but impossible
so i'm edfed
but i want to have moile login again


i believe there is some "request new password", which should work for you if you entered valid e-mail. Otherwise you need to contact tomasz.

Also, if you want just to change your name, it's enough to tell Tomasz to change it in database
Post 24 Feb 2007, 01:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 24 Feb 2007, 15:43
This demo may help, it will let you do what you want, it include code to use vesa, but also let you go from pmode to realmode for using some bios int (including mode 13h).
http://www.dex4u.com/tuts/DemoVesa.zip

Note: I was called ASHLEY4 when i made it. It bootable from a floppy or can run from Dos (only tested on MS-Dos).
Post 24 Feb 2007, 15:43
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.