flat assembler
Message board for the users of flat assembler.
Index
> Main > Problem with Graphic Modes. |
Author |
|
vid 28 Feb 2006, 10:08
i bet there is a bug in your code... mode switches allright but before you manage to draw something bug happens...
but it can be also bug in BIOS code... |
|||
28 Feb 2006, 10:08 |
|
Matrix 28 Feb 2006, 10:23
i think if you use a graphical operating system like windows, (i bet you were using iexplore)
you can switch to graphic modes. whould you try this code? Code: ; Print Screen causes an immediate Hard Reset in case of vesa setmode BX=$13 _640x400x256=$100 _640x480x256=$101 _800x600x16=$102 _800x600x256=$103 _1024x768x16=$104 _1024x768x256=$105 _1280x1024x16=$106 _1280x1024x256=$107 _80x60t=$108 _132x25t=$109 _132x43t=$10A _132x50t=$10B _132x60t=$10C ;---VBE v1.2+ --- _320x200x32k=$10D ;15bit 555 _320x200x64k=$10E ;16bit 565 _320x200x16m=$10F ;32bit 8888 _640x480x32k=$110 ;15bit 555 _640x480x64k=$111 ;16bit 565 _640x480x16m=$112 ;32bit 8888 _800x600x32k=$113 ;15bit 555 _800x600x64k=$114 ;16bit 565 _800x600x16m=$115 ;32bit 8888 _1024x768x32k=$116 ;15bit 555 _1024x768x64k=$117 ;16bit 565 _1024x768x16m=$118 ;32bit 8888 _1280x1024x32k=$119 ;15bit 1555 _1280x1024x64k=$11A ;16bit 565 _1280x1024x16m=$11B ;32bit 8888 not working ;---VBE 2.0+ --- _1600x1200x256=$120 ;8bit _1600x1200x32k=$121 ;15bit 555 _1600x1200x64k=$122 ;16bit 565 xmax=1279 ymax=1023 ;xmax=639 ;ymax=479 ;colors=16777215 colors=65536 ;colors=256 bitsperpixel=16 ;bytesperline=xmax+1*bitsperpixel/8 org $100 push es push $a000 pop es mov bx,_1280x1024x64k;_640x480x16m;_640x480x256;_640x480x64k; ; $13 ; _320x200x64k; _1024x768x16m ;_800x600x16m ;bts bx,15 ; prevent video memory clearing in case of mode switch call bsetvesamode call initrandomz mainloop: mov ecx,xmax+1 call randomz3 mov bx,ax mov ecx,ymax+1 call randomz3 mov cx,ax push ecx mov ecx,colors call randomz3 pop ecx call vesaputpixel ; al=color, bx=x, cx=y , es=segment ;call waitvretrace push ax mov ah,11h int 16h ; have we pressed a key?,if no then loop pop ax jz mainloop pop es mov ax,3 ;back to text mode. int 10h mov ax,4c00h ; exit with dos int 21h bsetvesamode: ; bx=mode number ;cmp bx,$99 ;jnb .vesamode bt bx,8 jc .vesamode mov ax,bx jmp .int10h .vesamode: mov ax,4f02h ;set vesa 1.0 screen mode int 10h mov ax,4f05h ;vesa 1 window select .int10h: xor bx,bx xor dx,dx ; set bank 0 int 10h ;dx is the reqired bank ret bselectbank: mov ax,4f05h ;vesa 1 bank select xor bx,bx int 10h ;dx is the reqired bank ret waitvretrace: mov dx,3dah .v1: in al,dx and al,08h jnz .v1 .v2: in al,dx and al,08h jz .v2 ret initrandomz: ; modifies edx, eax rdtsc ret randomz3: ; Z3 ecx=range transparent push ebx ; number returned is: ]0,ecx] push edx mov ebx,eax rdtsc mov dx,cx mov cl,al xor cl,ah ror ch,4 xor bl,ch and cx,$f rol bx,cl btc bx,cx xor bx,ax ror eax,16 xor bx,ax ror eax,16 mov cl,al xor cl,ah ror ch,4 xor bl,ch and cx,$f ror bx,cl btc bx,cx mov cl,bl .minorloop: rol eax,cl and cx,$f btc ax,cx loopw .minorloop mov cl,bh .majorloop: ror eax,cl and cl,$f btc ax,cx loopw .majorloop mov cx,dx mul ecx mov eax,edx pop edx pop ebx ret vesaputpixel: ; es=destination segment al=color, bx=x, cx=y , es=segment push eax movzx eax,cx mov ecx,xmax+1 mul ecx movzx ebx,bx add eax,ebx movzx ecx,byte [constant_bitsperpixel] shr cx,3 mul ecx mov di,ax shr eax,16 mov dx,ax cmp dx,[currentbank] je nobank mov [currentbank],dx mov ax,4f05h ;vesa 1 bank select xor bx,bx int 10h ;dx is the required window nobank: pop eax cmp byte [constant_bitsperpixel],32 jne n32 mov [es:di],eax jmp putten n32: cmp byte [constant_bitsperpixel],24 jne n24 mov [es:di],al inc di or di,di jnz .nobank inc dx mov [currentbank],dx push eax mov ax,4f05h ;vesa 1 bank select xor bx,bx int 10h ;dx is the required window pop eax .nobank: shr eax,8 mov [es:di],ax jmp putten n24: cmp byte [constant_bitsperpixel],16 jne n16 mov [es:di],ax jmp putten n16: mov [es:di],al putten: ret currentbank dw 0 constant_bitsperpixel db bitsperpixel if you want to test other modes, set the mode, number of colors, and pixelbits, not automatical yet. |
|||
28 Feb 2006, 10:23 |
|
shoorick 28 Feb 2006, 10:56
try this: it should draw white dot in the middle of the screen
Code: ;============== org 100h use16 ;============== mov ah,0 mov al,4 int 10h ;++++++++++++++ mov ah,0Ch mov al,7 mov bh,0 mov cx,160 mov dx,100 int 10h ;++++++++++++++ mov ah,0 int 16h ;-------------- mov ah,0 mov al,3 int 10h ;-------------- int 20h ;============== |
|||
28 Feb 2006, 10:56 |
|
HeadNG 05 Mar 2006, 13:55
2vid
Yeah, i work in WIN XP SP2. I use ordinary notepad to create *.ASM file and then translate it with Borland TASM to *.OBJ file, and then compose it with Borland TLINK to *.EXE file. I ran the program on my friend's computer, but result was the same. (now i know that my TFT monitor isn't the source of the problem). Here is program code: TITLE PROG1 (EXE) Graphic input functions .MODEL SMALL .STACK 64 .DATA STRING DB '1234567890' ; ------------------------------------code segment .286 ;used for 'pusha'/'popa' .CODE A10MAIN PROC FAR MOV AX,@DATA MOV DS,AX MOV ES,AX MOV AH,0FH ;retrieving screen info INT 10H PUSH AX ;saving screeen info CALL B10MODE ;setting video mode CALL C10SCROLL ;scrolling the screen CALL D10STRING ;outputting by 13H CALL E10DISPLAY ;outputting by 0AH MOV AH,10H ;permission INT 16H ; for input POP AX ;setting MOV AH,00H ; back INT 10H ; screen info MOV AX,4C00H ;ending INT 21H ; program A10MAIN ENDP ; --------------------------------additional procedure ; --------setting graphics mode and pallete permission B10MODE PROC NEAR MOV AH,00H ;setting new MOV AL,12H ; graphics mode INT 10H MOV AH,0BH ;setting new MOV BH,00 ; backgroung MOV BL,07 ; -grey INT 10H RET B10MODE ENDP ; --------------------------------additional procedure ; ----scrolling the screen and setting video atributes C10SCROLL PROC NEAR PUSHA MOV AX,0605H ;scrolling MOV BH,21H ; yellow color MOV CX,0000H MOV DX,044FH INT 10H POPA RET C10SCROLL ENDP ; --------------------------------additional procedure ; ---outputting the string, setting video atribute and ; -------------------------------------cursor posotion D10STRING PROC NEAR PUSHA MOV AX,1301H ;func.code:#outputs MOV BX,00021H ;page#:attributes MOV CX,10 ;# of symbols MOV DX,0815H ;row:column LEA BP,STRING ;setting address INT 10H POPA RET D10STRING ENDP ; --------------------------------additional procedure ; ------------------------------multiple symbol output E10DISPLAY PROC NEAR PUSHA MOV AX,0A01H ;permission to output MOV BH,00 ;number of page MOV BL,0100B ;red color MOV CX,10 ;10 symbols to output INT 10H POPA RET E10DISPLAY ENDP ; -------------------------------------end of program ; ----------------------------entering point: A10MAIN END A10MAIN I marker the problem line with RED. |
|||
05 Mar 2006, 13:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.