A Tetris game would be great 0) , here are one or two pointer that may help.
SET GRAPHIC MODE:
The change mode depends on which mode, if your talking BIOS, like mode 13h you do it like this:
;----------------------------------------------------;
; Change to mode 13h. ;
;----------------------------------------------------;
mov ax,0x0013
call [RealModeInt10h]
If your talking vesa you do it like this:
;----------------------------------------------------;
; Load vesa info. ;
;----------------------------------------------------;
call [LoadVesaInfo]
mov edi,VESA_Info
mov ecx,193
cld
cli
rep movsd
sti
call [SetVesaMode] ;set to 4112h (640*480 32bpp)
TIMER:
The timer in Dex4u is set to 18.2 ticks a second, you can change that like this:
;----------------------------------------------------;
; Set time ticks per second. ;
;----------------------------------------------------;
mov cx,100
call [InterruptTimer]
The above code will give you 100 ticks a second.
;----------------------------------------------------;
; Set time ticks per second. ;
;----------------------------------------------------;
mov cx,0
call [InterruptTimer]
The above code restore time back to 18.2 and should be called a end of program.
There also functions for set delay both wait and nowait.
KEYBOARD:
Built into Dex4u is a game keyboard function, that let you get multi keypress, used like this:
;----------------------------------------------------;
; Replace keyboard with Game keyboard. ;
;----------------------------------------------------;
call [GameKeyBoardOn]
mov [KeyDown],esi
Here is a example of data to go with it.
;----------------------------------------------------;
; Data ;
;----------------------------------------------------;
KeyDown dd 0
Up = 0x48
Down = 0x50
Left = 0x4b
Q = 0x10
A = 0x1e
W = 0x11
Up1 = 0x4e
Down1 = 0x4a
EscKey = 1
Than all you need do to test for a keypressed is code like this:
;----------------------------------------------------;
; KeyPressed ;
;----------------------------------------------------;
KeyPressed:
push esi
mov esi,[KeyDown]
;----------------------------------------------------;
; Is ESC held down? ;
;----------------------------------------------------;
test byte[esi+EscKey],1
JZ Next
mov esi,message5
call PrintVGAstringSmall
mov [ExitYesNo],1
jmp Exit
;----------------------------------------------------;
; Is Q down? ;
;----------------------------------------------------;
Next:
test byte[esi+Q],1
jz Next1
cmp [PadLy],2
jbe Next1
sub [PadLy],2
;----------------------------------------------------;
; Is A down? ;
;----------------------------------------------------;
Next1:
test byte[esi+A],1
jz Next2
cmp [PadLy],182
jae Next2
add [PadLy],2
;----------------------------------------------------;
; Is down arrow down? ;
;----------------------------------------------------;
Next2:
test byte[esi+Down],1
jz Next3
cmp [PadRy],182
jae Next3
add [PadRy],2
;----------------------------------------------------;
; Is up arrow down? ;
;----------------------------------------------------;
Next3:
test byte[esi+Up],1
jz Exit
cmp [PadRy],2
jbe Exit
sub [PadRy],2
Exit:
pop esi
ret
Hope this helps, also i can send you the code for spacepong (a Dex4u game) if you want, but theres no comments in the code.
Also here is a bootable fasm Tetris game here:
http://bos.asmhackers.net/forum/viewtopic.php?id=54&p=2