flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
sinsi 29 Jul 2008, 14:33
Here's something I've played with on and off...no comments, no error checking, assumes vesa is there etc, but it's a start
hmmm...no attachment - try again (doesn't like .fasm
|
|||||||||||
![]() |
|
Shahada 29 Jul 2008, 16:27
Thanks sinsi I'll look at it. Seem very good for my begin with VESA programming.
|
|||
![]() |
|
DOS386 23 Aug 2008, 07:28
> begginer in assembler and I want learn code banked VESA. I read VBE2.pdf but I dunno optimize.
VBE2 just introduced the LFB ![]() > Has you VESA banked code for FASM or anather assembler for example? NO. But what's your card ? There are some drivers around ![]() I don't use bancrupted VESA ... but probably trivial, just set mode and write into VGA RAM. When you have it, find out how to switch the banks. Evil note 1 : the bank size is not fixed ![]() Evil note 2 : with 24bpp one pixel can sit in 2 banks ![]() Summary: banked VESA is CRAP ![]() Last edited by DOS386 on 26 Aug 2008, 04:23; edited 1 time in total |
|||
![]() |
|
vid 23 Aug 2008, 07:46
Quote: Summary: banked VESA is CRAP but is the only crap present on many computers without card-specific coding |
|||
![]() |
|
DOS386 23 Aug 2008, 07:48
> present on many computers without card-specific
AFAIK there are drivers bringing VESA 2.0 ![]() |
|||
![]() |
|
sinsi 23 Aug 2008, 07:59
linear is for tinkerbells...only works in PM or flatreal.
understand banked mode, understand more about video... latest nvidia cards are vbe3 (my 8800gt) latest ati cards are vbe2 (my old 9600pro) I associate vbe1.2 with the days of cirrus/diamond et al I still managed my dos programs using vesa1.0 |
|||
![]() |
|
Shahada 24 Aug 2008, 07:36
DOS386 wrote: AFAIK there are drivers bringing VESA 2.0 My card is Trident ISA with 2MB VRAM. UNIVBE enable VESA 3.0, but when I run games the screen flashes horribly, they look much better without UNIVBE, using only banked VESA, and are almost as fast, so even if LFB is easier to program, I prefer banked. |
|||
![]() |
|
neville 25 Aug 2008, 19:07
In the next couple of days I'll post my code for a DOS program which displays a 256-colour Windows bitmap image using banked/paged VESA programming in video mode 101 (640 x 480). It will be based on the code I have used in FAMOS which I developed from scratch using a trial amd error technique
![]() ![]() _________________ FAMOS - the first memory operating system |
|||
![]() |
|
DOS386 26 Aug 2008, 04:22
> My card is Trident ISA with 2MB VRAM. UNIVBE enable VESA 3.0
Maybe 2.0 only ? As suspected ![]() > but when I run games the screen flashes horribly, they look much better without UNIVBE Sad ![]() > I read VBE2.pdf but Too much ![]() Download now : http://board.flatassembler.net/download.php?id=3913 VESA spec | 580 KiB http://board.flatassembler.net/download.php?id=3915 VESA code, uses LFB only | 46 KiB |
|||
![]() |
|
Shahada 26 Aug 2008, 05:30
DOS386 wrote: Maybe 2.0 only ? As suspected No, VESA 3.0. But is option in UNIVBE to desable VESA 3.0 extension and have just 2.0, but it no work better. DOS386 wrote: Sad Plain DOS, very good card even if old, lastest UNIVBE. |
|||
![]() |
|
vid 26 Aug 2008, 08:22
sinsi wrote: I associate vbe1.2 with the days of cirrus/diamond et al Card on my notebook (Intel something) only has vesa1.0. Maybe UNIVBE would do the trick, but maybe not... |
|||
![]() |
|
Shahada 26 Aug 2008, 13:06
@neville
Thanks. I want to know if you have put horizontal line of color for 24bit per pixel banked modes. Put bitmap line is easier for that modes, is like in the others banked modes, and put pixel of color is not hard even if you have to test for bank change and change the bank sometime. But I not find still good looking fast 24bit per pixel horizontal line of color code for banked VESA. |
|||
![]() |
|
Dex4u 26 Aug 2008, 15:24
See here for simple vesa bank switching example
http://board.flatassembler.net/topic.php?t=6032 |
|||
![]() |
|
Shahada 27 Aug 2008, 06:53
Thanks Dex4u, but still no banked 24bit per pixel horizontal line of color
![]() |
|||
![]() |
|
vid 27 Aug 2008, 07:40
What's the deal with banked/nonbanked??? Everything real uses at least one backbuffer anyway, and copying backbuffer to banked buffer is primitively easy.
|
|||
![]() |
|
Shahada 27 Aug 2008, 07:53
@vid
Maybe you say true vid, but for learn purpose I want to see a 24bit per pixel horizontal line directly to screen in case of banked modes. I think is tricky to do it as fast as it can be and I want to see what ideas are for this. |
|||
![]() |
|
neville 28 Aug 2008, 11:51
Here's my paged VESA demo program to display 8-bit Windows bitmaps in DOS, based on my Flat-Real FAMOS code. I haven't used any string instructions because in FR mode it's a pain to set up the required segments in DS and ES.
The attached file is an executable version which displays a well-known image. Its an EXE but "not allowed" so extension renamed to ZIP ![]() Bitmaps should be 640x480 or less in size, and must be Windows bitmaps, not OS/2. Sometimes the bitmaps are displayed on a slant. I've never figured out why - does anybody know? The slant can be corrected by changing the image width stored in the BMP header, so I've added 'W' and 'w' commands to increase and decrease the image width while the image is being displayed - see the source code below. Code: ;--------------------------------------------------------------------------- ; W A T K I N T E C H N O L O G Y S o f t w a r e D i v i s i o n ;--------------------------------------------------------------------------- ; PROGRAM: Paged VESA Demo Mode 101 (640 x 480 x 8bit) - DOS Bitmap Viewer ; VERSION: 1.0 PLATFORM: IBM PC ; PROJECT: FAMOS Memory Operating System FILE: VESADEMO.ASM ; AUTHOR: Neville Watkin DATE: 28 Aug 2008 ;--------------------------------------------------------------------------- ; Revision History ; ;28.08.08 Port to DOS from FAMOS (INT21/09 for string display, no PCA etc.) ;--------------------------------------------------------------------------- ; ORG 0100H ;flat real COM can be >64K, but FORMAT MZ ;need DOS .EXE for embedded BMPs >64K PUSH CS PUSH CS POP DS ;make EXE like COM... POP ES ;(but let DOS set stack) MOV AX,4F01H MOV DI,VESABUF MOV CX,101H ;check mode 101 INT 10H CMP AL,4FH JNZ BADVESA XOR EAX,EAX MOV AX,WORD[ES:DI+4] ;get video Page Granularity MOV DX,AX ;save it MOV CX,1 GETPGSH: INC CX SHR AX,1 JNC GETPGSH ;Page Gran. shift = log2(PGran) + 2 MOV WORD[PGSHFT],CX ;save PageShift factor MOV AX,DX ;restore PGran SHL EAX,0AH ;multiply by 1K DEC EAX ;-1 = video page offset mask MOV DWORD[VMASK],EAX ;save it TRYAGAIN: MOV ESI,IMAGE MOV AL,BYTE[ESI+1CH] CMP AL,08H JZ DRAW BADVESA: MOV AX,3 INT 10H MOV DX,ERRMSG MOV AH,9 INT 21H CALL WAITKEY JMP EXIT BADDATA: MOV AX,3 INT 10H MOV DX,ERRMSG1 MOV AH,9 INT 21H CALL WAITKEY JMP EXIT DRAW: CALL INIT101 ;set video mode ADD ESI,36H MOV CX,100H ;256 palettes CALL PALPROG ;set palettes MOV ESI,IMAGE CALL DIM256 CALL WAITKEY CMP AL,"W" ;this code often displays bitmaps JZ INCWIDTH ;slanting to right or left. Correct CMP AL,"w" ;by pressing W or w as many times as JZ DECWIDTH ;needed... EXIT: MOV AX,0003 ;restore video mode INT 10H MOV AH,4CH INT 21H INCWIDTH: MOV EDX,DWORD[ESI+12H] ;corrects image slanting to right CMP EDX,0FFFFFFFEH ;by increasing the width in the JA TRYAGAIN ;bitmap header INC EDX MOV DWORD[ESI+12H],EDX JMP TRYAGAIN DECWIDTH: MOV EDX,DWORD[ESI+12H] ;corrects image slanting to left CMP EDX,0 ;by decreasing the width in the JZ TRYAGAIN ;bitmap header DEC EDX MOV DWORD[ESI+12H],EDX JMP TRYAGAIN ERRMSG: DB 10," The video card in this computer does not support VESA 101$",13,10 ERRMSG1: DB 10," Sorry, the data format is invalid - press any key to exit...$",13,10 ;---------------------------------------------------------------------------- ; INITIALIZE VESA MODE 101 ;---------------------------------------------------------------------------- INIT101: MOV AX,4F02H ;select 640x480 SVGA video mode MOV BX,0101H ;using PAGED memory model INT 10H RET ;---------------------------------------------------------------------------- ; PALETTE PROGRAMMING ;---------------------------------------------------------------------------- ;direct CRT controller register access ;enter with ESI pointing to 4-byte palette data B G R 0, CX=no. palettes PALPROG: CLI PUSH ESI MOV DX,3C8H XOR AL,AL OUT DX,AL PROG: MOV AL,[ESI+2] SHR AL,2 MOV DX,3C9H OUT DX,AL ;set red MOV AL,[ESI+1] SHR AL,2 OUT DX,AL ;set green MOV AL,[ESI] SHR AL,2 OUT DX,AL ;set blue ADD ESI,4 LOOP PROG POP ESI STI RET ;---------------------------------------------------------------------------- ; DISPLAY IMAGE (256-colour BMP) ;---------------------------------------------------------------------------- ;enter with DS=0,ESI=image source DIM256: PUSH ESI ;save image source MOV EDI,4AD80H ;screen line 479+hor 0 XOR EAX,EAX MOV AX,WORD[ESI+8H] ;get vert offset XOR EBX,EBX MOV BX,640 MUL EBX ;calc adj for vert offset SUB EDI,EAX ;apply vert offset XOR EAX,EAX MOV AX,WORD[ESI+6H] ;get horiz offset ADD EDI,EAX ;add horiz offset MOV EAX,EDI MOV CL,BYTE[PGSHFT] ;PageShift factor SHR EAX,CL ;AH=current vRAM page XOR DX,DX MOV DL,AH ;get page into DX XOR BX,BX ;set window 0 PUSH AX ;save current page MOV AX,4F05H ;set initial page INT 10H POP AX ;restore current page MOV ECX,[ESI+16H] ;bmp vert height at 0016H MOV EBX,[ESI+12H] ;bmp width at 0012H ADD ESI,[ESI+0AH] ;bmp image data at 000AH MOV EBP,DWORD[VMASK] ;offset mask for video page NEXTLINE: CALL DLINE ;display a line of image data SUB EDI,280H ;go to next line up (280H=scr width) SUB EDI,EBX ;reset to LHS (EBX=img wdth) LOOP NEXTLINE POP ESI ;restore image source RET ;---------------------------------------------------------------------------- ; DISPLAY ONE HORIZONTAL LINE OF PIXELS (VESA Mode 101) ;---------------------------------------------------------------------------- ;enter with vRAM offset (was dest) addr = 0:EDI, BMP image data addr = 0:ESI ;bmp height in ECX, bmp width in EBX, AH=current vRAM page, EBP=offset mask DLINE: PUSH ECX ;save height PUSH EBX ;save width for next line MOV CL,BYTE[PGSHFT] ;PageShift factor DLINE1: MOV EDX,EDI ;save EDI SHR EDX,CL ;AH=current vRAM page XOR DL,DL XCHG DH,DL ;get VRAM page in DX (DL) CMP AH,DL ;same as current page? JZ SAMEPAGE ; -yes, don't change it PUSH BX MOV AX,4F05H ; -no, change the page ("window") XOR BX,BX ;ready to "set Window 0" (fn 4F05) INT 10H MOV AH,DL ;update current page POP BX SAMEPAGE: MOV EDX,EDI ;save EDI again AND EDI,EBP ;remove page bits => 16-bit offset ADD EDI,0A0000H ;add vRAM "segment" => 32-bit addr MOV AL,[ESI] ;get image palette PUSH 0000 POP DS MOV [EDI],AL ;write palette to vRAM PUSH CS POP DS MOV EDI,EDX ;restore EDI (32-bit offset) INC ESI INC EDI DEC BX ;next pixel (could use EBX) JNZ DLINE1 POP EBX POP ECX RET ;---------------------------------------------------------------------------- ; WAIT FOR KEYPRESS (DEBOUNCED) ;---------------------------------------------------------------------------- WAITKEY: MOV AH,01 INT 16H ;get keyboard status MOV AH,00 ;select Wait for Key service JZ GOTKEY ;when key gone, go get it INT 16H ;else flush the buffer JMP WAITKEY ;and wait for it again GOTKEY: INT 16H ;read key from keyboard buffer RET ;---------------------------------------------------------------------------- ; DATA ;---------------------------------------------------------------------------- ALIGN 2 PGSHFT: DW 0 ;Page Granularity Shift factor (byte only used) VMASK: DD 0 ;video page offset mask ALIGN 16 VESABUF: ;scratch area for VESA info TIMES 512 DB 0 IMAGE: ; FILE 'YOURFILE.BMP' ;put your 256-colour Windows bitmap here... FILE 'MONALISA.BMP'
_________________ FAMOS - the first memory operating system |
|||||||||||
![]() |
|
revolution 28 Aug 2008, 11:59
neville wrote: The attached file is an executable version which displays a well-known image. Its an EXE but "not allowed" so extension renamed to ZIP |
|||
![]() |
|
neville 28 Aug 2008, 22:26
revolution wrote:
Quote: How about really ZIPping up the exe and posting the real ZIP. That will save some disk space and download time also. When it rejected the EXE I tried various extensions including EEX, DAT etc, but ZIP was the first one that was accepted... It was only 74K, but OK, the attached 43K ZIP contains the FASM source above, plus the EXE. Actually you will end up with less disk space unless you delete the ZIP after unzipping it ![]()
_________________ FAMOS - the first memory operating system |
|||||||||||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.