From 336d676da69da395294956a1d69b2b91f99b48e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Fri, 1 Jun 2001 22:48:10 +0200 Subject: [PATCH] feat: ajout d'une application qui passe en Pmode. Finalisation de la gestion de la souris. --- 8253.asm | 53 ----------- disk.asm | 10 ++- m2.asm | 257 ----------------------------------------------------- mm.asm | 52 ----------- mouse.asm | 103 ++++++++++++++++----- pmode.asm | 15 ++++ setup.asm | 6 +- system.asm | 2 + 8 files changed, 108 insertions(+), 390 deletions(-) delete mode 100755 8253.asm delete mode 100755 m2.asm delete mode 100755 mm.asm create mode 100755 pmode.asm diff --git a/8253.asm b/8253.asm deleted file mode 100755 index 7189103..0000000 --- a/8253.asm +++ /dev/null @@ -1,53 +0,0 @@ -.model tiny -.486 -smart -.code -org 0100h -start: -jmp tsr -db '8253' -Tsr: -cli -cmp ax,1234h -jne nomore -mov ax,4321h -jmp itsok -nomore: -push bx -mov bl,ah -xor bh,bh -shl bx,1 -mov bx,cs:[bx].tables -mov cs:current,bx -pop bx -call cs:current -itsok: -jnc noerror -push bp -mov bp,sp -or byte ptr [bp+6],1b -pop bp -mov ax,cs -shl eax,16 -mov ax,cs:current -jmp endofint -noerror: -push bp -mov bp,sp -and byte ptr [bp+6],0FEh -pop bp -endofint: -sti -iret -current dw 0 -tables dw enableirq - dw disableirq - dw readmaskirq - dw readirr - dw readisr - dw installhandler - dw replacehandler - dw getint - dw setint - dw seteoi - diff --git a/disk.asm b/disk.asm index a90d01d..e0b4ca3 100755 --- a/disk.asm +++ b/disk.asm @@ -75,6 +75,8 @@ lines: mov ah,13 mov si,offset spaces int 47h + mov ah,5 + int 47h mov al,16 mov cl,7 mov ah,21 @@ -105,10 +107,12 @@ doaline2: inc di dec al jnz doaline2 + dec bh + je outes mov ah,6 int 47h - dec bh - jnz lines + jmp lines +outes: mov ah,21 mov cl,112 int 47h @@ -355,7 +359,7 @@ xxyy dw 3 xxyy2 dw 3 errordisk db 'An error has occured on drive A:, press a key to continu ',0 menu db 'Bottom F1, Top F2, Sectors F3&F4, Load/Save F5&F6, Mode F7, Quit F8 MODE ' -pope db 'VIEW ',0 +pope db 'VIEW',0 spaces db ' ³ ',0 showbuffer db 35 dup (0FFh) diff --git a/m2.asm b/m2.asm deleted file mode 100755 index acee17d..0000000 --- a/m2.asm +++ /dev/null @@ -1,257 +0,0 @@ -.model tiny -.486 -smart -.code -org 0100h -start: -jmp tsr -drv db 'MOUSE',0 -Tsr: -cli -cmp ax,1234h -jne nomore -mov ax,4321h -jmp itsok -nomore: -push bx ax -mov ah,4 -mov bh,0 -int 50h -mov bl,al -pop ax -cmp byte ptr cs:isact,1 -je nottest -mov cs:isact,1 -and bl,10000b -cmp bl,16 -jae react -mov bl,ah -xor bh,bh -shl bx,1 -mov bx,cs:[bx].tables -mov cs:current,bx -pop bx -call cs:current -itsok: -jnc noerror -push bp -mov bp,sp -or byte ptr [bp+6],1b -pop bp -mov ax,cs -shl eax,16 -mov ax,cs:current -jmp endofint -noerror: -push bp -mov bp,sp -and byte ptr [bp+6],0FEh -pop bp -endofint: -mov cs:isact,0 -sti -iret -nottest: -pop bx -jmp endofint -current dw 0 -tables dw cmdmouse - dw cmdmouse2 - dw detectmouse - dw getmouse - -isact db 0 - -;Envoie une commande AL … la souris via controleur clavier -cmdmouse: - push ax -videbuff1: - in al, 64h - and al, 10b - jne videbuff1 - mov al, 00d4h - out 64h, al -videbuff2: - in al, 64h - and al, 10b - jne videbuff2 - pop ax - out 60h, al - in al, 60h - ret - -;Envoie une commande2 AL … la souris via controleur clavier carry=nomouse -cmdmouse2: - push ax -videbuff21: - in al, 64h - and al, 10b - jne videbuff21 - mov al, 0060h - out 64h, al -videbuff22: - in al, 64h - and al, 10b - jne videbuff22 - pop ax - out 60h, al - in al, 60h - ret - -Detectmouse: - push ax cx - mov al, 0a8h ;AUX enable - out 64h, al - mov al, 0f3h ;Set sample - call cmdmouse - mov al, 100 ;Set sample - call cmdmouse - mov al, 0e8h ;Set resolution - call cmdmouse - mov al, 01 ;Set resolution - call cmdmouse - mov al, 0e7h ;Set scale 2:1 - call cmdmouse - mov al, 0f4h ;Enable device - call cmdmouse - mov al, 47h ;Interruption ON - call cmdmouse2 - mov cx, 1024 -testmouse: - in al, 60h ;Lecture du port de donn‚es - cmp al, 250 ;Test si il y a une souris - je okmouse - dec cx - jnz testmouse - stc - jmp endoftest -okmouse: - clc -endoftest: - pop cx ax - ret - -;envoie en bx,cx les coordonn‚es et en dl les boutons -getmouse: -mov bl,cs:vx -xor bh,bh -mov cl,cs:vy -xor ch,ch -mov dl,cs:button -;sub dl,8 -;and dl,0Fh -clc -ret - -Button db 0 -rx dw 0 -ry dw 0 -VX db 0 -VY db 0 -X dw 0 -Y dw 0 -count db 0 -error db 0 -xy dw 0 -old dw 0 -;Gestionnaire de souris PS/2 -react: - push ax bx cx dx di ds es - push cs - pop ds - in al, 60h - cmp error, 1 - je gest1 - cmp count, 1 - je gest1 - cmp count, 2 - je gest2 - cmp count, 3 - je gest3 - -gest1: - mov count, 2 - mov Button, al - and al, 00001000b - cmp al, 8 - je gest1end - mov error, 1 - jmp gest1end2 -gest1end: - mov error, 0 -gest1end2: - mov count, 2 - jmp endgest -gest2: - mov count, 3 - mov VX, al - jmp endgest -gest3: - mov count, 1 - mov VY, al - jmp endgest -endgest: - mov bl,VY - xor bh,bh - mov al,button - shr al,5 - and al,1 - cmp al,0 - je addy - add y,bx - jmp hadsuby - addy: - sub y,bx - hadsuby: - mov bl,VX - xor bh,bh - mov al,button - shr al,8 - and al,1 - cmp al,0 - je addx - sub x,bx - jmp hadsubx - addx: - add x,bx - hadsubx: - push cs - pop es - mov di,offset infos - mov ah,34 - int 47h - mov ax,x - mov bx,0FFFFh - xor ch,ch - mov cl,[di+1] - mul cx - div bx - mov rx,ax - mov ax,y - mov cl,[di] - mul cx - div bx - mov ry,ax - mul byte ptr [di+1] - add ax,rx - shl ax,1 - mov di,ax - mov ax,0B800h - mov es,ax - mov bx,xy - mov ax,old - mov word ptr es:[bx],ax - mov xy,di - mov ax,es:[di] - mov old,ax - mov word ptr es:[di],0FF70h - mov al, 20h - out 0a0h, al - out 20h, al - pop es ds di dx cx bx ax - mov cs:isact,0 - pop bx - iret - infos db 10 dup (0) - -end start diff --git a/mm.asm b/mm.asm deleted file mode 100755 index 71446d7..0000000 --- a/mm.asm +++ /dev/null @@ -1,52 +0,0 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: -mov ah,2 -int 74h -jc error -mov si,offset dnoerror -jmp noerror -error: -mov si,offset derror -noerror: -mov ah,20 -mov bx,1010h -int 47h -mov ax,0 -int 16h -xor edx,edx -popr: -mov ah,3 -int 74h -mov ah,6 -int 47h -mov si,bx -mov di,cx -mov ah,9 -mov cx,8 -int 47H -mov ah,5 -int 47H -mov dx,si -mov ah,9 -mov cx,8 -int 47H -mov ah,5 -int 47h -mov dx,di -mov ah,9 -mov cx,8 -int 47H -jmp popr -db 0CBh - -dnoerror db 'Souris d‚tect‚e en PS/2',0 -derror db 'Souris non d‚tect‚e',0 - - -end start diff --git a/mouse.asm b/mouse.asm index 021b203..67ad649 100755 --- a/mouse.asm +++ b/mouse.asm @@ -59,6 +59,8 @@ tables dw cmdmouse dw cmdmouse2 dw detectmouse dw getmouse + dw getmousescreen + dw configmouse isact db 0 @@ -133,27 +135,46 @@ endoftest: ;envoie en bx,cx les coordonn‚es et en dl les boutons getmouse: -mov bl,cs:vx -xor bh,bh -mov cl,cs:vy -xor ch,ch +mov bx,cs:rx +mov cx,cs:ry mov dl,cs:button -;sub dl,8 -;and dl,0Fh +sub dl,8 +and dl,0Fh clc ret -Button db 0 -rx dw 0 -ry dw 0 -VX db 0 -VY db 0 -X dw 0 -Y dw 0 -count db 0 -error db 0 -xy dw 0 -old dw 0 +;envoie en di les coordonn‚es ecran et en dl les boutons +getmousescreen: +mov di,cs:xy +mov cx,cs:ry +mov dl,cs:button +sub dl,8 +and dl,0Fh +clc +ret + + +;configure la rapidit‚ dans cl et dans ah,al sphŠre x et y +Configmouse: +mov cs:speed,cl +mov cs:spherex,ah +mov cs:spherey,al +ret + +Button db 0 +rx dw 0 +ry dw 0 +VX db 0 +VY db 0 +X dw 0 +Y dw 0 +speed db 6 +spherex db 0 +spherey db 0 +count db 0 +error db 0 +xy dw 0 +old dw 0 ;Gestionnaire de souris PS/2 react: push ax bx cx dx di ds es @@ -191,17 +212,50 @@ gest3: mov VY, al jmp endgest endgest: - mov bl,VY - xor bh,bh - add y,bx - mov bl,VX - xor bh,bh - add x,bx + cmp error,1 + je errormouse push cs pop es mov di,offset infos mov ah,34 - int 47h + int 47h + mov cl,speed + movsx bx,VY + shl bx,cl + cmp spherey,0 + jne nolimity + mov al,[di] + xor ah,ah + dec ax + cmp bx,0 + jg decy + cmp ry,ax + jae noaddy + jmp nolimity +decy: + cmp ry,0 + je noaddy +nolimity: + sub y,bx +noaddy: + movsx bx,VX + shl bx,cl + cmp spherex,0 + jne nolimitx + mov al,[di+1] + xor ah,ah + dec ax + cmp bx,0 + jl decx + cmp rx,ax + jae noaddx + jmp nolimitx +decx: + cmp rx,0 + je noaddx +nolimitx: + add x,bx +noaddx: mov ax,x mov bx,0FFFFh xor ch,ch @@ -230,6 +284,7 @@ endgest: mov al, 20h out 0a0h, al out 20h, al +errormouse: pop es ds di dx cx bx ax mov cs:isact,0 pop bx diff --git a/pmode.asm b/pmode.asm new file mode 100755 index 0000000..fc1625f --- /dev/null +++ b/pmode.asm @@ -0,0 +1,15 @@ +.model tiny +.486p +smart +.code + +org 0100h + +start: +mov eax,cr0 +or al,1 +mov cr0,eax + +db 0CBh + +end start diff --git a/setup.asm b/setup.asm index fc65f35..b44f3d0 100755 --- a/setup.asm +++ b/setup.asm @@ -156,6 +156,7 @@ jc error2 mov ax,3D00h int 21h jc error2 +mov cs:temp,ax mov bx,ax mov ax,4202h xor cx,cx @@ -219,13 +220,16 @@ pop es call writesector mov cx,entrie end1: +mov ah,3eh +mov bx,cs:temp +int 21h pop es ds bp di si dx bx ax ret entrie dw 0 error2: stc jmp end1 - +temp dw 0 makefit: push bx cx si di bp diff --git a/system.asm b/system.asm index dbb0152..48f9285 100755 --- a/system.asm +++ b/system.asm @@ -171,6 +171,8 @@ tre2: dec di shl di,5 mov dx,[di+bx+26] + cmp [di+bx+12],00657865h ;EXE + jne tre3 mov ah,6 int 47h int 47h