| | |
need help generating graphic
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
I'm having trouble with drawing squares on the x86 assembler using the XGA 8-bit linear frame buffer. I'm suppose to draw a large square containing a grid of smaller 12x12 squares using my own functions and this is what I have so far:
When I try to run it, only a few lines appear on the screen and the program lags for a bit before exiting...
Any help would be appreciated.
Assembly Syntax (Toggle Plain Text)
[SECTION .text] ;---------------------------------------------------------------------------- ; code belongs in this section starting here mystart: mov ah, 0fh ; BIOS function - get current video mode int 10h ; call BIOS video interrupt mov [vidmode], al ; save the current video mode mov eax, 4f02h ; SVGA function - set SVGA video mode mov ebx, XGAMODE ; select XGA video mode int 10h ; call BIOS video interrupt mov ecx, 12 mov eax, xPos sqrver: push ecx mov ebx, yPos mov ecx, width mov edx, eax push eax mov eax, ebx mov ebx, XGAXRES mul ebx pop ebx add eax, ebx vloop: mov byte [fs:eax], 15 add dword eax, 800 dec ecx jnz vloop add dword eax, 5 pop ecx loop sqrver mov ecx, 12 mov ebx, yPos sqrhori: push ecx mov eax, xPos mov ecx, width mov edx, ebx push eax mov eax, ebx mov ebx, XGAXRES mul ebx pop ebx add eax, ebx hloop: mov byte [fs:eax], 15 inc eax dec ecx jnz hloop add dword ebx, 5 pop ecx loop sqrver mov ah, 1 ; select DOS function - input character int 0f1h ; call OS function to wait for key press mov ah, 00h ; BIOS function - set video mode mov al, [vidmode] ; restore the old video mode int 10h ; call BIOS video interrupt ret ;---------------------------------------------------------------------------- [SECTION .data] ;---------------------------------------------------------------------------- ; all initialized data variables and constant definitions go here XGAMODE equ 4103h ; XGA video mode code (w/ linear addr bit) XGAXRES equ 800 ; horizontal resolution of XGA screen XGAYRES equ 600 ; vertical resolution of XGA screen xPos db 300 yPos db 50 width equ 400 ;---------------------------------------------------------------------------- [SECTION .bss] ;---------------------------------------------------------------------------- ; all uninitialized data elements go here vidmode resb 1 ; the old video mode
When I try to run it, only a few lines appear on the screen and the program lags for a bit before exiting...
Any help would be appreciated.
![]() |
Similar Threads
- Please Review My Office Live Site (Website Reviews)
- Questions For WebDevelopment =) (HTML and CSS)
- NZBoards.com (vB 3.0.5) - Critique please (Website Reviews)
Other Threads in the Assembly Forum
- Previous Thread: help me out please, my asm code is not working
- Next Thread: learning nasm assembly, need some help
| Thread Tools | Search this Thread |





