feat: ajout d'un pilote VGA et changement de police dés le démarrage.

This commit is contained in:
Nicolas Hordé 2001-02-04 21:48:09 +01:00
parent 2a899f1618
commit 00571c6cc7
10 changed files with 1550 additions and 1257 deletions

View File

@ -1,7 +1,10 @@
@echo off @echo off
del system.bin del system.bin
copy id.com system.bin
tasm boot.asm /t/x/m4 tasm boot.asm /t/x/m4
tasm mem.asm /t/x/m4
tasm choise.asm /t/x/m4
tasm vg2.asm /t/x/m4
tasm sect.asm /t/x/m4
tlink boot.obj /x tlink boot.obj /x
del boot.obj del boot.obj
exe2boot.com exe2boot.com

View File

@ -34,7 +34,7 @@ okloading db 'COS search system',0Dh,0ah,0
syst db 'Ok',0dh,0ah,0 syst db 'Ok',0dh,0ah,0
dot db '.',0 dot db '.',0
carry db 0dh,0ah,0 carry db 0dh,0ah,0
Sys db 'System file',0 Sys db 'system ',0
sys2 db 'sys',0 sys2 db 'sys',0
errorboot: errorboot:

View File

@ -5,32 +5,56 @@ smart
org 0100h org 0100h
start: start:
mov cx,23
mov bx,8400h
mov es,bx
mov bx,100h
call loadfatway
mov di,bx
mov bx,47h
call setint
ret
mov bx,9
call getint
mov cs:int9seg,ds
mov cs:int9off,si
push cs
pop es
mov di,offset int9
call setint
start2:
push cs push cs
push cs push cs
pop ds pop ds
pop es pop es
call clear mov ah,21
mov ax,0 mov cl,7
call setxy int 47h
mov si,offset msg mov ax,0002
call showstring0 int 47h
mov di,0 mov ah,2
mov al,112 int 47h
call changeattrib mov ah,25
call line mov bx,0
call line int 47h
mov si,offset mssg mov ah,13
call showstring0 mov si,offset msg1
call line int 47h
mov si,offset msg2 mov ah,6
call showstring0 int 47h
call line int 47h
mov ah,13
mov si,offset prompt
int 47h
mov ah,6
int 47h
xor di,di xor di,di
mov bx,offset buffer mov bx,offset buffer
mov cx,13 mov cx,13
call readsector call readsector
jc fin2
xor bp,bp xor bp,bp
showall: showall:
cmp byte ptr [bx+di],0 cmp byte ptr [bx+di],0
@ -39,117 +63,118 @@ mov al,[bx+di+12]
mov byte ptr [bx+di+12],0 mov byte ptr [bx+di+12],0
mov si,bx mov si,bx
add si,di add si,di
call showstring0 mov ah,13
int 47h
mov si,offset spaces mov si,offset spaces
call showstring0 int 47h
mov [bx+di+12],al mov [bx+di+12],al
mov byte ptr [bx+di+12+5],0 mov byte ptr [bx+di+12+5],0
mov si,bx mov si,bx
add si,di add si,di
add si,12 add si,12
call showstring0 int 47h
call line mov ah,6
int 47h
add di,32 add di,32
inc bp inc bp
jmp showall jmp showall
endof2: endof2:
mov xx,1
mov xxold,2
call Select call Select
endof: endof:
mov ax,0 mov ax,0
int 16h int 16h
cmp ah,50h cmp ah,50h
jne tre1 jne tre1
cmp xxx,bp cmp xx,bp
je endof je endof
inc xxx inc xx
call select call select
jmp endof jmp endof
tre1: tre1:
cmp ah,48h cmp ah,48h
jne tre2 jne tre2
cmp xxx,1 cmp xx,1
je endof je endof
dec xxx dec xx
call select call select
jmp endof jmp endof
tre2: tre2:
cmp al,0Dh cmp al,0Dh
je fin2
jne tre3 jne tre3
mov di,xxx mov di,xx
dec di dec di
shl di,5 shl di,5
mov cx,[di+bx+26] mov cx,[di+bx+26]
call line mov ah,6
call line int 47h
mov si,offset msgg int 47h
call showstring0 mov ah,13
call executefat mov si,offset msg2
int 47h
call executefatway
tre3: tre3:
cmp ah,3bh cmp ah,59
jne endof jne endof
mov di,0 mov lastread,0FFFFh
mov cx,1 jmp start2
mov al,7
call changeattribword
mov si,offset popup
mov ax,0200h
call popupmenu
mov di,0
mov cx,1
mov al,112
call changeattribword
jmp endof
fin2:
ret
executefatway:
push cs
mov bx,offset start2
push bx
mov bx,03000h
mov es,bx
push bx
mov bx,0100h
push bx
call loadfatway
push es
push es
push es
pop ds
pop fs
pop gs
push 7202h
popf
db 0CBh
popup db 4,'&New' ;cx entre -> fatway chemin
db 5,'&Open' getfatway:
db 1,'-' push bx cx es
db 7,'&Delete' mov bx,offset fatway
db 7,'R&ename'
db 5,'&Copy'
db 5,'&Link'
db 1,'-'
db 8,'&Restart'
db 10,'&Shut down'
db 1,'-'
db 12,'&About me...'
db 0
db 070h ;couleur normale
db 07Fh ;couleur speciale
db 07h ;couleur select
executefat:
push cs
mov bx,offset start
push bx
mov bx,6000h
mov es,bx
push bx
mov bx,0100h
push bx
mov si,offset dot
fatagain: fatagain:
mov cs:[bx],cx
add bx,2
cmp cx,0FFF0h cmp cx,0FFF0h
jae finishload jae finishload
call readsector
jc fin2
call showstring0
add bx,sizec
call getfat call getfat
jnc fatagain jnc fatagain
finishload: finishload:
push es pop es cx bx
push es ret
push es
pop ds loadfatway:
pop fs push bx cx di
pop gs call getfatway
push 7202h jc endload
popf mov di,offset fatway
db 0CBh mov si,offset dot
mov ah,13
loadagain:
mov cx,cs:[di]
cmp cx,0FFF0h
jae endload
add di,2
call readsector
jc endload
int 47h
add bx,cs:sizec
jmp loadagain
endload:
pop di cx bx
ret
sizec dw 512 sizec dw 512
reserv dw 1 reserv dw 1
@ -159,9 +184,9 @@ getfat:
push es ax bx dx push es ax bx dx
mov ax,cx mov ax,cx
xor dx,dx xor dx,dx
div sizec div cs:sizec
mov cx,ax mov cx,ax
add cx,reserv add cx,cs:reserv
mov bx,offset buffer mov bx,offset buffer
push cs push cs
pop es pop es
@ -169,7 +194,7 @@ call readsector
jc errorgetfat jc errorgetfat
shl dx,1 shl dx,1
add bx,dx add bx,dx
mov cx,[bx] mov cx,cs:[bx]
errorgetfat: errorgetfat:
pop dx bx ax es pop dx bx ax es
ret ret
@ -179,342 +204,27 @@ Select:
push ax di push ax di
mov di,xxold mov di,xxold
mov al,7 mov al,7
add di,3 add di,2
call changeattrib mov ah,32
mov ax,xxx int 47h
mov ax,xx
mov xxold,ax mov xxold,ax
mov di,xxx mov di,xx
mov ah,32
mov al,112 mov al,112
add di,3 add di,2
call changeattrib int 47h
pop di ax pop di ax
ret ret
;couleur al pour ligne di mot cx xx dw 1
Changeattribword:
push bp bx dx di es
mov dx,0B800h
mov es,dx
mov dx,di
shl dx,5
shl di,7
add di,dx
mov dx,80
xor bp,bp
xor bx,bx
popp:
cmp byte ptr es:[di],' '
je noway
cmp bx,1
je noway2
mov bx,1
inc bp
cmp cx,bp
ja fint
jmp noway2
noway:
xor bx,bx
noway2:
cmp bp,cx
jne noway3
mov es:[di-1],al
noway3:
add di,2
dec dx
jnz popp
fint:
pop es di dx bx bp
ret
;couleur al pour ligne di
changeattrib:
push dx di es
mov dx,0B800h
mov es,dx
mov dx,di
shl dx,5
shl di,7
add di,dx
mov cx,80
inc di
popep:
mov es:[di],al
add di,2
dec cx
jnz popep
pop es di dx
ret
colors db 7
xy dw 0
x db 0
y db 0
xxx dw 1
xxold dw 0 xxold dw 0
msg db ' File Edition',0 msg1 db 'Cos 2000 menu loader release 1.0',0
mssg db 'Cos 2000 menu loader release 1.0',0 msg2 db 'Program loading',0
msg2 db '>',0 prompt db '>',0
spaces db ' ',0 spaces db ' ',0
dot db '.',0 dot db '.',0
msgg db 'Chargement du programme',0
;==========SHOWCHAR===========
;met un caractŠre aprs le curseur
;-> dl
;<-
;=============================
showchar:
push dx bx es
mov bx,0B800h
mov es,bx
mov bx,cs:xy
mov dh,cs:colors
mov es:[bx],dx
add cs:xy,2
pop es bx dx
ret
;==========SPACE===========
;met un espace aprs le curseur
;->
;<-
;=============================
space:
push bx es
add cs:xy,2
mov bx,0B800h
mov es,bx
mov bx,cs:xy
mov byte ptr es:[bx],' '
pop es bx
ret
;==============================Affiche le nombre nb binaire en EDX==============
ShowbinRow:
push es ax bx cx di
mov di,cs:xy
mov bx,0B800h
mov es,bx
mov ax,cx
sub cx,32
neg cx
shl edx,cl
mov ch,cs:colors
binaize:
rol edx,1
mov cl,'0'
adc cl,0
mov es:[di],cx
add di,2
dec al
jnz binaize
mov cs:xy,di
pop di cx bx ax es
ret
;==========SETCOLOR=========
;Change les attributs du texte a CL
;-> CL
;<-
;=============================
setcolor:
mov cs:colors,CL
ret
;=============CLEAR=========
;Efface l'ecran texte
;->
;<-
;=============================
clear:
push es eax cx di
xor di,di
mov ax,0b800h
mov es,ax
mov eax,07200720h
mov cx,1000
cld
rep stosd
pop di cx eax es
ret
;==========SCROLLDOWN=========
;defile de cx lines vers le bas
;-> CX
;<-
;=============================
scrolldown:
push cx si di ds es
mov si,0B800h
mov es,si
mov ds,si
mov si,cx
shl si,5
shl cx,7
add si,cx
mov cx,4000
sub cx,si
xor di,di
cld
rep movsb
pop es ds di si cx
ret
;==========LINE=========
;remet le curseur a la ligne
;->
;<-
;=============================
line:
push ax cx di es
mov ah,cs:x
mov al,cs:y
xor ah,ah
cmp al,24
jne scro
dec al
mov cl,1
call scrolldown
scro:
inc al
call setxy
pop es di cx ax
ret
;==========SETXY=========
;Change les coordonnées du curseur a X:AL,Y:AH
;-> AX
;<- es di
;=============================
setxy:
push ax bx di
mov cs:x,ah
mov cs:y,al
mov bl,ah
xor bh,bh
xor ah,ah
mov di,ax
shl di,5
shl ax,7
shl bx,1
add di,ax
add di,bx
mov cs:xy,di
pop di bx ax
ret
;================Affiche la chaine 0 de caractŠre contenue dans ds:si
showstring0:
push es cx si di
mov di,cs:xy
mov cx,0B800h
mov es,cx
mov ch,cs:colors
strinaize0:
mov cl,[si]
cmp cl,0
je no0
mov es:[di],cx
add di,2
inc si
jmp strinaize0
no0:
mov cs:xy,di
pop di si cx es
ret
;==============================Affiche le nombre nb hexa en EDX==============
ShowHexRow:
push es ax bx cx di
mov di,cs:xy
mov bx,0B800h
mov es,bx
mov ax,cx
sub cx,32
neg cx
shl edx,cl
mov ch,cs:colors
shr ax,2
Hexaize:
rol edx,4
mov bx,dx
and bx,0fh
mov cl,cs:[bx+offset Tab]
mov es:[di],cx
add di,2
dec al
jnz Hexaize
mov cs:xy,di
pop di cx bx ax es
ret
Tab db '0123456789ABCDEF'
ret
;===================================sauve l'ecran rapidement================
SaveScreen:
push cx si di ds es
mov cx,0B800H
mov ds,cx
push cs
pop es
mov cx,(80*25*2)/4
xor si,si
mov di,offset Copy2
cld
rep movsd
pop es ds di si cx
ret
;===================================sauve l'ecran rapidement================
RestoreScreen:
push cx si di ds es
mov cx,0B800H
mov es,cx
push cs
pop ds
mov cx,(80*25*2)/4
mov si,offset Copy2
xor di,di
cld
rep movsd
pop es ds di si cx
ret
;===================================Afficher un int EDX a l'cran en ah,al================
ShowInt:
push eax bx cx edx esi di es ds
mov di,cs:xy
mov cx,0B800h
mov es,cx
xor cx,cx
mov eax,edx
mov esi,10
mov bx,offset showbuffer+27
decint3:
xor edx,edx
div esi
add dl,'0'
mov dh,cs:colors
sub bx,2
add cx,2
mov cs:[bx],dx
cmp ax,0
jne decint3
mov si,bx
push cs
pop ds
cld
rep movsb
mov cs:xy,di
pop ds es di esi edx cx bx eax
ret
showbuffer db 35 dup (0FFh)
Lastread dw 0FFFFh
ReadSector: ReadSector:
push ax cx dx si push ax cx dx si
@ -552,7 +262,6 @@ Done:
pop si dx cx ax pop si dx cx ax
ret ret
WriteSector:
push ax cx dx si push ax cx dx si
cmp cs:Lastread,cx cmp cs:Lastread,cx
jne nodestruct jne nodestruct
@ -588,13 +297,213 @@ Done2:
pop si dx cx ax pop si dx cx ax
ret ret
include menu.Asm Lastread dw 0FFFFh
WriteSector:
;met es:di le handle de l'int bx
setint:
push ax bx ds
cli
shl bx,2
xor ax,ax
mov ds,ax
mov ds:[bx],di
mov ds:[bx+2],es
pop ds bx ax
sti
ret
;met ds:si le handle de l'int bx
getint:
push ax bx es
cli
shl bx,2
xor ax,ax
mov es,ax
mov si,es:[bx]
mov ds,es:[bx+2]
pop es bx ax
sti
ret
int9off dw 0
int9seg dw 0
int9:
pushf
db 2eh,0ffh,1eh
dw int9off
cli
pusha
in al,60h
cmp cs:isstate,1
jne nostate
cmp al,57
jne nof12
mov cs:isstate,0
jmp noF12
nostate:
cmp al,87
jne NoF11
push es
push cs
pop es
mov di,offset infos
mov ah,34
int 47h
mov al,cs:infos+7
inc al
and ax,11b
int 47h
pop es
nof11:
cmp al,88
jne NoF12
mov ah,26
int 47h
call showstate
mov cs:isstate,1
sti
waitt:
cmp cs:isstate,0
jne waitt
mov ah,27
int 47h
noF12:
popa
sti
iret
isstate db 0
infos db 10 dup (0)
showstate:
push ds es
push ss
push gs
push fs
push es
push ds
push cs
pushad
pushfd
push cs
push cs
pop es
pop ds
mov ah,2
int 47h
mov ah,21
mov cl,4
int 47h
mov ah,13
mov si,offset reg
int 47h
mov ah,6
int 47h
mov ah,21
mov cl,7
int 47h
mov ah,13
mov si,offset fla
int 47h
pop edx
mov cx,32
mov ah,11
int 47h
mov ah,5
int 47h
mov ah,10
int 47h
mov si,offset regs
mov bx,8+6
mov ah,21
mov cl,6
int 47h
showallREG:
mov ah,6
int 47h
cmp bx,7
jb nodr
pop edx
jmp popo
nodr:
mov ah,21
mov cl,1
int 47h
xor edx,edx
pop dx
popo:
mov ah,13
int 47h
mov ah,10
mov cx,32
int 47h
mov ah,5
int 47h
push si
mov si,offset gr
mov ah,13
int 47h
mov ah,8
int 47h
mov si,offset dr
mov ah,13
int 47h
pop si
add si,5
dec bx
jnz showallreg
mov ah,34
mov di,offset infos
int 47h
mov ah,25
mov bl,cs:infos
xor bh,bh
dec bl
int 47h
mov si,offset app
mov ah,13
int 47h
mov ah,32
mov bl,cs:infos
xor bh,bh
mov di,ax
dec di
mov cl,116
int 47h
pop es ds
ret
reg db 'State of registers',0
fla db 'Flags:',0
regs db 'EDI:',0
db 'ESI:',0
db 'EBP:',0
db 'ESP:',0
db 'EBX:',0
db 'EDX:',0
db 'ECX:',0
db 'EAX:',0
db ' CS:',0
db ' DS:',0
db ' ES:',0
db ' FS:',0
db ' GS:',0
db ' SS:',0
gr db '(',0
dr db ')',0
app db 'Press enter to quit...',0
DiskSectorsPerTrack dw 18 DiskSectorsPerTrack dw 18
DiskTracksPerHead dw 80 DiskTracksPerHead dw 80
DiskHeads dw 2 DiskHeads dw 2
copy2 equ $ fatway equ $
buffer equ $
buffer equ $+3000
end start end start

224
cosinit.asm Executable file
View File

@ -0,0 +1,224 @@
.model tiny
.486
smart
.code
org 0100h
ent equ 32h
start:
jmp CopyCOS
DiskSectorsPerTrack dw 18
DiskTracksPerHead dw 80
DiskHeads dw 2
NameBoot db 'Boot.bin',0
Namesystem db 'System.bin',0
Message db 0Ah,0Dh,'Installation of the COS (Celyn Operating System) !!',0Ah,0Dh,'Written By Nico',0Ah,0Dh,'Copyright 2000',0Ah,0Dh,'Please insert a floppy disk and press a key...',0Ah,0Dh,'Be careful! All the disk is going to be deleted',0Ah,0dh,'$'
Message2 db 0Ah,0Dh,'Create boot sector$'
systfile db 0Ah,0Dh,'Creating file allocation table 16 bits$'
systfile2 db 0Ah,0Dh,'Creating file information table 32 bytes$'
systfile3 db 0Ah,0Dh,'Creating operating system files$'
Errormsg db 0Ah,0Dh,0Ah,0Dh,'An error has stopped the copying process !',0Ah,0Dh,'$'
Ok db 0Ah,0Dh,0Ah,0Dh,'The boot sector and the system files had been succefully copied.',0Ah,0Dh, 'To try COS reboot with this system disk',0Ah,0Dh,0Ah,0Dh,'$'
entrie db 'System file',0
db 'sys',0,0
dw 1234h
dw 1234h
dw 1234h
dw 1234h
db 0h
dw ent
dw 512
dw 0h
dw 0
CopyCOS:
mov ah,09
mov dx,offset message
int 21h
jc error
mov ax,0
int 16h
mov ah,09
mov dx,offset message2
int 21h
mov ax,3D00h
mov dx,offset nameboot
int 21h
jc error
mov bx,ax
mov ax,4202h
xor cx,cx
xor dx,dx
int 21h
jc error
cmp dx,0
jne error
cmp ax,512
jne error
mov ax,4200h
xor cx,cx
xor dx,dx
int 21h
jc error
mov ah,3fh
mov cx,512
mov dx,offset buffer
int 21h
jc error
mov ah,3eh
int 21h
jc error
mov cx,0
mov bx,dx
call writesector
jne error
jc error
mov ah,09
mov dx,offset systfile3
int 21h
jc error
mov ax,3D00h
mov dx,offset namesystem
int 21h
jc error
mov bx,ax
mov ax,4202h
xor cx,cx
xor dx,dx
int 21h
jc error
cmp dx,0
jne error
sub ax,1 ;+512
cmp ax,0
jl error
shr ax,9
inc ax
mov bp,ax
mov ax,4200h
xor cx,cx
xor dx,dx
int 21h
jc error
mov ah,3fh
mov cx,0FFFFh
mov dx,offset buffer
int 21h
jc error
mov bx,dx
mov cx,ent
mov dx,bp
syst:
call writesector
jne error
add bx,512
inc cx
dec dx
jnz syst
ret ;++++++++++++++++++=
mov ah,09
mov dx,offset systfile
int 21h
mov cx,512/4
mov di,bx
mov eax,0
rep stosd
mov cx,13
fatanymore:
call writesector
jne error
dec cx
cmp cx,1
ja fatanymore
mov di,bx
mov ax,0FFF0h
mov cx,13
rep stosw
mov ax,0FFFFh
stosw
mov si,ent
dec bp
makefat:
mov ax,si
inc ax
shl si,1
mov [bx+si],ax
mov si,ax
dec bp
jnz makefat
shl si,1
mov word ptr [bx+si],0ffffh
mov cx,1
call writesector
jne error
mov ah,09
mov dx,offset systfile2
int 21h
jc error
mov cx,13
mov bx,offset entrie
call writesector
jne error
mov ah,09
mov dx,offset ok
int 21h
jc error
ret
error:
mov ah,09
mov dx,offset errormsg
int 21h
ret
WriteSector:
push cx dx si
mov AX, CX
xor DX, DX
div DiskSectorsPerTrack
mov CL, DL ;{ Set the sector }
and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder }
xor DX, DX
div DiskTracksPerHead
mov CH, DL ;{ Set the track bits 0-7 }
mov AL, DH
ror AL, 1
ror AL, 1
and AL, 11000000b
or CL, AL ;{ Set bits 8&9 of track }
xor DX, DX
div DiskHeads
mov DH, DL ;{ Set the head }
inc CL
mov SI, 4
TryAgain:
mov AL, 1
mov DL, 0
mov AH, 3
int 13h
jnc Done
dec SI
jnz TryAgain
Done:
mov cl, AH
mov ah,9
mov dx,offset sign
int 21h
cmp cl,0
pop si dx cx
ret
sign db '.$'
buffer db 512 dup (0)
end start

View File

@ -1,67 +0,0 @@
.model tiny
.486
smart
.code
org 0100h
start:
jmp transform
NameBoot db 'Boot.exe',0
nameboot2 db 'Boot.bin',0
buffer db 510 dup (0)
dw 0AA55h
message db 0ah,0dh,'Transformation of boot.com to boot.bin...',0ah,0dh,'By Horde Nicolas',0ah,0dh,'Copyright 2000',0ah,0dh,'$'
ok db 0ah,0dh,'The transformation was done succefully !',0ah,0dh,'$'
errormsg db 0ah,0dh,'Some errors has been detected !',0ah,0dh,'$'
transform:
mov ah,09
mov dx,offset message
int 21h
mov ax,3D00h
mov dx,offset nameboot
int 21h
jc error
mov bx,ax
mov ax,4202h
xor cx,cx
xor dx,dx
int 21h
jc error
cmp dx,0
jne error
mov ax,4200h
xor cx,cx
mov dx,7E00h
int 21h
jc error
mov ah,3fh
mov cx,512
mov dx,offset buffer
int 21h
jc error
mov ah,3eh
int 21h
jc error
mov ah,3ch
xor cx,cx
mov dx,offset nameboot2
int 21h
jc error
mov ah,40h
mov cx,512
mov dx,offset buffer
int 21h
jc error
mov ah,09
mov dx,offset ok
int 21h
ret
error:
mov ah,09
mov dx,offset errormsg
int 21h
ret
end start

367
id.asm
View File

@ -1,367 +0,0 @@
.model tiny
.386c
.code
org 0100h
colores equ 7
logoY equ 064h
logo2X equ 0A0h
logo2Y equ 064h
ecartlogo2 equ 13Eh
logocoordsize equ 0B40h
logo2coordsize equ 26Ch
zoomout equ 43h
start:
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,13h
int 10h
mov dx,3C8h
mov al,7
out dx,al
inc dx
xor al,al
out dx,al
out dx,al
out dx,al
mov si,offset logo2text
call showstr
mov ax,0A000h
mov ds,ax
push ds
push es
push cs
mov di,logo2coord
mov cx,logo2coordsize
xor si,si
xor dx,dx
xor bx,bx
loopcoord2:
lodsb
or al,al
jz nothingcoord2
mov ax,dx
sub ax,5Ah
stosw
mov ax,bx
sub ax,14h
stosw
inc cs:nblogo2
nothingcoord2:
add dx,3
cmp dx,0BAh
jne short loc_3
xor dx,dx
add si,102h
add bx,4
loc_3:
loop loopcoord2
pop ds
call zerocurs
mov si,offset data6
call showstr
pop es
pop ds
mov cx,logocoordsize
xor si,si
xor dx,dx
xor bx,bx
loopcoord:
lodsb
or al,al
jz nothingcoord
mov ax,dx
sub ax,32h
stosw
mov ax,bx
shl ax,1
sub ax,1Eh
stosw
inc cs:nblogo
nothingcoord:
inc dx
inc dx
cmp dx,60h
jne short loc_6
xor dx,dx
add si,110h
inc bx
loc_6:
loop loopcoord
push ds
pop es
push cs
pop ds
masterloop:
inc logox ;++++
inc data_10
mov bl,data_10
xor bh,bh
mov al,data_1[bx]
cbw
mov data_11,ax
add bl,zoomout
mov al,data_1[bx]
cbw
mov data_12,ax
mov cx,nblogo2
push cx
push cx
mov si,logo2coord
showlogo2:
lodsw
mov data_7,ax
lodsw
mov data_8,ax
mov data_9,0FFCEh
push cx
push si
mov si,offset data_8
push si
mov di,offset data_9
call sub_1
mov si,offset data_7
call sub_1
pop di
call sub_1
pop si
mov ax,100h
imul data_7
mov bx,data_9
add bx,140h
idiv bx
add ax,logo2X
mov bp,ax
mov ax,100h
imul data_8
mov bx,data_9
add bx,140h
idiv bx
add ax,logo2Y
mov bx,140h
imul bx
add ax,bp
mov di,ax
push si
sub si,logo2coord
shr si,1
mov ds:data_16e[si],di
pop si
mov bx,data_9
mov cl,4
shr bx,cl
pop cx
mov al,17h
sub al,bl
mov ah,al
stosw
add di,ecartlogo2
stosw
loop showlogo2
pop si
shl si,1
shl si,1
add si,logo2coord
mov cx,nblogo
showlogo:
push cx
lodsw
imul data_12
mov di,ax
lodsw
imul data_11
sub di,ax
mov cl,7
sar di,cl
add di,logoX
mov bx,di
sub si,4
lodsw
imul data_11
mov di,ax
lodsw
imul data_12
add di,ax
sar di,cl
add di,logoy
mov ax,140h
imul di
add ax,bx
mov di,ax
pop cx
mov ax,cx
shl ax,1
mov bx,data_17e
add bx,ax
mov [bx],di
mov al,28h
stosb
loop showlogo
mov dx,3DAh
synchro:
in al,dx
test al,8
jnz synchro
synchroagain:
in al,dx
test al,8
jz synchroagain
mov si,data_16e
pop cx
add cx,nblogo
add cx,14h
showlogo2effect:
lodsw
mov di,ax
xor ax,ax
stosw
add di,ecartlogo2
stosw
loop showlogo2effect
in al,60h
cmp al,1
je endofprog
jmp masterloop
endofprog:
mov ax,3
int 10h
int 20h
ret
sub_1 proc near
mov ax,[si]
imul data_12
mov bp,ax
mov ax,[di]
imul data_11
sub bp,ax
mov cl,7
sar bp,cl
push bp
mov ax,[si]
imul data_11
mov bp,ax
mov ax,[di]
imul data_12
add bp,ax
sar bp,cl
mov [di],bp
pop ax
mov [si],ax
retn
sub_1 endp
showcrlf:
push ax bx
mov ax, 0E0Dh
xor bx, bx
int 10h
mov al, 0Ah
int 10h
pop bx ax
ret
zerocurs:
push ax bx dx
mov ah,02h
mov bh,0
mov dx,0
int 10h
pop dx bx ax
ret
showstr:
push ax bx si
again:
lodsb
or al,al
jz fin
cmp al,0Dh
jne noret
call showcrlf
jmp again
noret:
mov ah,0Eh
mov bx,colores
int 10h
jmp again
fin:
pop si bx ax
ret
logoX dw 0A0h ;++++
data_1 db 0
db 03h, 06h, 09h, 0Ch, 10h, 13h
db 16h, 19h, 1Ch, 1Fh
db '"%(+.1369<?ADGILNQSUXZ\^`bdfhjkm'
db 'opqstuvxyzz{|}}~~~'
db 7 dup (7Fh)
db '~~~}}|{zzyxvutsqpomkjhfdb`^\ZXUS'
db 'QNLIGDA?<9631.+(%"'
db 1Fh, 1Ch, 19h, 16h, 13h, 10h
db 0Ch, 09h, 06h, 03h, 00h,0FDh
db 0FAh,0F7h,0F4h,0F0h,0EDh,0EAh
db 0E7h,0E4h,0E1h,0DEh,0DBh,0D8h
db 0D5h,0D2h,0CFh,0CDh,0CAh,0C7h
db 0C4h,0C1h,0BFh,0BCh,0B9h,0B7h
db 0B4h,0B2h,0AFh,0ADh,0ABh,0A8h
db 0A6h,0A4h,0A2h,0A0h, 9Eh, 9Ch
db 9Ah, 98h, 96h, 95h, 93h, 91h
db 90h, 8Fh, 8Dh, 8Ch, 8Bh, 8Ah
db 88h, 87h, 86h, 86h, 85h, 84h
db 83h, 83h, 82h, 82h, 82h, 81h
db 81h, 81h, 81h, 81h, 81h, 81h
db 82h, 82h, 82h, 83h, 83h, 84h
db 85h, 86h, 86h, 87h, 88h, 8Ah
db 8Bh, 8Ch, 8Dh, 8Fh, 90h, 91h
db 93h, 95h, 96h, 98h, 9Ah, 9Ch
db 9Eh,0A0h,0A2h,0A4h,0A6h,0A8h
db 0ABh,0ADh,0AFh,0B2h,0B4h,0B7h
db 0B9h,0BCh,0BFh,0C1h,0C4h,0C7h
db 0CAh,0CDh,0CFh,0D2h,0D5h,0D8h
db 0DBh,0DEh,0E1h,0E4h,0E7h,0EAh
db 0EDh,0F0h,0F4h,0F7h,0FAh,0FDh
logo2text db 'Cos 2000' ,0
data6 db 'Speedy', 0dh,0dh
data61 db 'System' ,0dh,0Dh
data62 db 'Inside' ,0
data_7 dw 0
data_8 dw 0
data_9 dw 0
data_10 db 0
data_11 dw 0
data_12 dw 0
nblogo2 dw 0
nblogo dw 0
data_15 = $ ;*
data_16 = $+9C4h ;*
data_17 = $+0B2Ch ;*
logo2coord = offset data_15 ;*
data_16e = offset data_16 ;*
data_17e = offset data_17 ;*
end start

87
mem.asm
View File

@ -5,87 +5,9 @@ org 0100h
start: start:
push ss
push gs
push fs
push es
push ds
push cs
pushad
pushfd
;cli
;mov dx,21h
;mov al,0FFh
;out dx,al
;mov dx,0A1h
;mov al,0FFh
;out dx,al
push cs
pop es
mov ax,3
int 10h
;mov ax,1100h
;mov bx,2000h ;1000H
;mov cx,0080h ;100h
;xor dx,dx
;mov bp,offset buffer
;int 10h
call savescreen
call clear
mov colors,4
mov si,offset reg
call showstring0
call line
mov colors,7
mov si,offset fla
call showstring0
pop edx
mov cx,32
call showbinrow
call space
call showhexrow
mov si,offset regs
mov ax,8+6
mov colors,6
showall:
call line
cmp ax,7
jb nodr
pop edx
jmp popo
nodr:
mov colors,8
xor edx,edx
pop dx
popo:
call showstring0
call showhexrow
call space
push si
mov si,offset gr
call showstring0
call showint
mov si,offset dr
call showstring0
pop si
add si,5
dec ax
jnz showall
;mov dx,21h
;mov al,0
;out dx,al
;mov dx,0A1h
;mov al,0
;out dx,al
;sti
mov ax,0
int 16h
mov ax,0305h mov ax,0305h
mov bx,0008h mov bx,0008h
int 16h int 16h
xor ax,ax
mov fs,ax
xor edx,edx
mov ax,0B800h mov ax,0B800h
mov es,ax mov es,ax
xor ebp,ebp xor ebp,ebp
@ -673,15 +595,6 @@ decint3:
pop ds es di esi edx cx bx eax pop ds es di esi edx cx bx eax
ret ret
showbuffer db 35 dup (0FFh)
copy2 db 4000 dup (0)
buffer db 0
end start end start

387
sect.asm
View File

@ -8,15 +8,18 @@ start:
mov ax,0305h mov ax,0305h
mov bx,0008h mov bx,0008h
int 16h int 16h
;mov ax,1100h mov ax,0002
;mov bx,1000h ;2000H int 47H
;mov cx,0100h ;80h mov ah,26
;xor dx,dx int 47H
;mov bp,offset copy2 mov ah,2
;int 10h int 47h
call savescreen
xor bp,bp xor bp,bp
Adres: Adres:
mov di,offset infos
mov ah,34
int 47h
dec infos
push cs push cs
pop es pop es
mov cx,sect mov cx,sect
@ -24,67 +27,92 @@ Adres:
call readsector call readsector
jnc noerror jnc noerror
errtr: errtr:
mov ax,24 mov ah,25
call setxy mov bl,infos
mov colors,116 xor bh,bh
int 47h
mov ah,21
mov cl,116
int 47h
mov ah,13
mov si,offset errordisk mov si,offset errordisk
call showstring0 int 47h
mov ax,0 mov ax,0
int 16h int 16h
noerror: noerror:
adres2: adres2:
mov bx,offset buffer mov di,offset infos
call clear mov ah,34
mov ax,0 int 47h
call setxy dec infos
mov ah,24 mov bx,0
mov ah,25
int 47h
mov bh,infos
mov di,bp mov di,bp
mov colors,7 mov ah,21
mov cl,7
int 47h
lines: lines:
mov dx,sect mov dx,sect
mov cx,16 mov cx,16
call showhexrow mov ah,10
int 47h
mov si,offset dep mov si,offset dep
call showstring0 mov ah,13
int 47h
mov dx,di mov dx,di
call showhexrow mov ah,10
int 47h
mov ah,13
mov si,offset spaces mov si,offset spaces
call showstring0 int 47h
mov al,16 mov al,16
mov cx,8 mov cl,7
mov colors,7 mov ah,21
int 47h
mov si,di mov si,di
doaline: doaline:
mov dl,[di+bx] mov dl,[di+offset buffer]
call showhexrow mov ah,10
call space mov cl,8
int 47h
mov ah,5
int 47h
inc di inc di
dec al dec al
jnz doaline jnz doaline
mov di,si mov di,si
mov si,offset spaces mov si,offset spaces
call showstring0 mov ah,13
int 47h
mov al,16 mov al,16
mov colors,7 mov ah,21
mov cl,7
int 47h
doaline2: doaline2:
mov dl,[di+bx] mov dl,[di+offset buffer]
call showchar mov ah,7
int 47h
inc di inc di
dec al dec al
jnz doaline2 jnz doaline2
call line mov ah,6
dec ah int 47h
dec bh
jnz lines jnz lines
mov colors,112 mov ah,21
mov cl,112
int 47h
mov si,offset menu mov si,offset menu
call showstring0 mov ah,13
mov bx,bp int 47h
waitkey: waitkey:
mov ax,0 mov ax,0
int 16h int 16h
cmp ax,3B00h cmp ax,3B00h
jne suit jne suit
cmp bx,8*16 cmp bp,8*16
jae waitkey jae waitkey
add bp,16 add bp,16
jmp adres2 jmp adres2
@ -125,12 +153,19 @@ doaline2:
cmp ax,4100h cmp ax,4100h
jne suit7 jne suit7
mov dword ptr [pope],'TIDE' mov dword ptr [pope],'TIDE'
mov ax,24 mov bl,infos
call setxy xor bh,bh
mov colors,116 mov ah,25
int 47h
mov ah,21
mov cl,116
int 47h
mov si,offset menu mov si,offset menu
call showstring0 mov ah,13
mov colors,7 int 47h
mov ah,21
mov cl,7
int 47h
mov ax,0B800h mov ax,0B800h
mov es,ax mov es,ax
mov xxyy2,3 mov xxyy2,3
@ -162,7 +197,10 @@ tre:
tre1: tre1:
cmp ah,50h cmp ah,50h
jne tre2 jne tre2
cmp yy,23 mov al,infos
dec al
xor ah,ah
cmp yy,ax
je waitst je waitst
inc yy inc yy
jmp cursor jmp cursor
@ -219,7 +257,9 @@ cursor:
suit7: suit7:
cmp ax,4200h cmp ax,4200h
jne waitkey jne waitkey
call restorescreen mov ah,27
int 47h
db 0CBH
ret ret
calc1: calc1:
@ -307,264 +347,6 @@ errordisk db 'Une erreur est survenu sur le lecteur A:, appuyer sur une touche
menu db 'Haut F1, Bas F2, Secteurs F3&F4, Load/Save F4&F5, Edit F7, Quitter F8 MODE ' menu db 'Haut F1, Bas F2, Secteurs F3&F4, Load/Save F4&F5, Edit F7, Quitter F8 MODE '
pope db 'VUE ',0 pope db 'VUE ',0
spaces db ' ³ ',0 spaces db ' ³ ',0
xy dw 0
colors db 7
x db 1
y Db 1
;==========SHOWCHAR===========
;met un caractŠre aprs le curseur
;-> dl
;<-
;=============================
showchar:
push dx bx es
mov bx,0B800h
mov es,bx
mov bx,cs:xy
mov dh,cs:colors
mov es:[bx],dx
add cs:xy,2
pop es bx dx
ret
;==========SPACE===========
;met un espace aprs le curseur
;->
;<-
;=============================
space:
push bx es
add cs:xy,2
mov bx,0B800h
mov es,bx
mov bx,cs:xy
mov byte ptr es:[bx],' '
pop es bx
ret
;==============================Affiche le nombre nb binaire en EDX==============
ShowbinRow:
push es ax bx cx di
mov di,cs:xy
mov bx,0B800h
mov es,bx
mov ax,cx
sub cx,32
neg cx
shl edx,cl
mov ch,cs:colors
binaize:
rol edx,1
mov cl,'0'
adc cl,0
mov es:[di],cx
add di,2
dec al
jnz binaize
mov cs:xy,di
pop di cx bx ax es
ret
;==========SETCOLOR=========
;Change les attributs du texte a CL
;-> CL
;<-
;=============================
setcolor:
mov cs:colors,CL
ret
;=============CLEAR=========
;Efface l'ecran texte
;->
;<-
;=============================
clear:
push es eax cx di
xor di,di
mov ax,0b800h
mov es,ax
mov eax,07200720h
mov cx,1000
cld
rep stosd
pop di cx eax es
ret
;==========SCROLLDOWN=========
;defile de cx lines vers le bas
;-> CX
;<-
;=============================
scrolldown:
push cx si di ds es
mov si,0B800h
mov es,si
mov ds,si
mov si,cx
shl si,5
shl cx,7
add si,cx
mov cx,4000
sub cx,si
xor di,di
cld
rep movsb
pop es ds di si cx
ret
;==========LINE=========
;remet le curseur a la ligne
;->
;<-
;=============================
line:
push ax cx di es
mov ah,cs:x
mov al,cs:y
xor ah,ah
cmp al,24
jne scro
dec al
mov cl,1
call scrolldown
scro:
inc al
call setxy
pop es di cx ax
ret
;==========SETXY=========
;Change les coordonnées du curseur a X:AL,Y:AH
;-> AX
;<- es di
;=============================
setxy:
push ax bx di
mov cs:x,ah
mov cs:y,al
mov bl,ah
xor bh,bh
xor ah,ah
mov di,ax
shl di,5
shl ax,7
shl bx,1
add di,ax
add di,bx
mov cs:xy,di
pop di bx ax
ret
;================Affiche la chaine 0 de caractŠre contenue dans ds:si
showstring0:
push es cx si di
mov di,cs:xy
mov cx,0B800h
mov es,cx
mov ch,cs:colors
strinaize0:
mov cl,[si]
cmp cl,0
je no0
mov es:[di],cx
add di,2
inc si
jmp strinaize0
no0:
mov cs:xy,di
pop di si cx es
ret
;==============================Affiche le nombre nb hexa en EDX==============
ShowHexRow:
push es ax bx cx di
mov di,cs:xy
mov bx,0B800h
mov es,bx
mov ax,cx
sub cx,32
neg cx
shl edx,cl
mov ch,cs:colors
shr ax,2
Hexaize:
rol edx,4
mov bx,dx
and bx,0fh
mov cl,cs:[bx+offset Tab]
mov es:[di],cx
add di,2
dec al
jnz Hexaize
mov cs:xy,di
pop di cx bx ax es
ret
Tab db '0123456789ABCDEF'
ret
;===================================sauve l'ecran rapidement================
SaveScreen:
push cx si di ds es
mov cx,0B800H
mov ds,cx
push cs
pop es
mov cx,(80*25*2)/4
xor si,si
mov di,offset Copy2
cld
rep movsd
pop es ds di si cx
ret
;===================================sauve l'ecran rapidement================
RestoreScreen:
push cx si di ds es
mov cx,0B800H
mov es,cx
push cs
pop ds
mov cx,(80*25*2)/4
mov si,offset Copy2
xor di,di
cld
rep movsd
pop es ds di si cx
ret
;===================================Afficher un int EDX a l'cran en ah,al================
ShowInt:
push eax bx cx edx esi di es ds
mov di,cs:xy
mov cx,0B800h
mov es,cx
xor cx,cx
mov eax,edx
mov esi,10
mov bx,offset showbuffer+27
decint3:
xor edx,edx
div esi
add dl,'0'
mov dh,cs:colors
sub bx,2
add cx,2
mov cs:[bx],dx
cmp ax,0
jne decint3
mov si,bx
push cs
pop ds
cld
rep movsb
mov cs:xy,di
pop ds es di esi edx cx bx eax
ret
showbuffer db 35 dup (0FFh) showbuffer db 35 dup (0FFh)
Lastread dw 0FFFFh Lastread dw 0FFFFh
@ -645,7 +427,8 @@ DiskSectorsPerTrack dw 18
DiskTracksPerHead dw 80 DiskTracksPerHead dw 80
DiskHeads dw 2 DiskHeads dw 2
copy2 equ $ infos db 10 dup (0)
buffer equ $+4000 buffer equ $+4000

BIN
thin8x8.fnt Executable file

Binary file not shown.

895
vg2.asm Executable file
View File

@ -0,0 +1,895 @@
.model tiny
.486
smart
.code
org 0100h
start:
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 setvideomode
dw getvideomode
dw cleartext
dw changefont
dw loadfont
dw space
dw line
dw showchar
dw showint
dw showsigned
dw showhex
dw showbin
dw showstring
dw showstring0
dw showcharat
dw showintat
dw showsignedat
dw showhexat
dw showbinat
dw showstringat
dw showstring0at
dw setcolor
dw getcolor
dw scrolldown
dw getxy
dw setxy2
dw savescreen
dw restorescreen
dw page2to1
dw page1to2
dw xchgPages
dw savepage1
dw changelineattr
dw waitretrace
dw getinfos
;Change la police a CL
changefont:
push ax cx dx
mov ah,cl
and cl,11b
and ah,0100b
shl ah,2
add ah,cl
mov dx,3C4h
mov al,3
out dx,ax
pop dx cx ax
ret
;met la police BL … ds:si taille dans CL
loadfont:
push ax bx cx dx si di es
xor di,di
mov dx,3C4h
cli
doseq:
mov ax,cs:[di+offset reg1]
out dx,ax
inc di
inc di
cmp di,6
jbe doseq
mov dx,3CEh
doseq2:
mov ax,cs:[di+offset reg1]
out dx,ax
inc di
inc di
cmp di,6+6
jbe doseq2
sti
mov ax,0A000h
mov es,ax
mov dx,255
mov al,0
xor bh,bh
cmp bl,4
jb isless
sub bl,4
shl bl,1
inc bl
jmp okmake
isless:
shl bl,1
okmake:
mov di,bx
shl di,13
mov bh,cl
mov bl,cl
sub bl,32
neg bl
xor cx,cx
cld
popz:
mov cl,bh
rep movsb
mov cl,bl
rep stosb
dec dx
jnz popz
xor di,di
mov dx,3C4h
doseqs:
mov ax,cs:[di+offset reg2]
out dx,ax
inc di
inc di
cmp di,6
jbe doseqs
mov dx,3CEh
doseqs2:
mov ax,cs:[di+offset reg2]
out dx,ax
inc di
inc di
cmp di,6+6
jbe doseqs2
pop es di si dx cx bx ax
ret
reg2 dw 0100h, 0302h, 0304h, 0300h
dw 0004h, 1005h, 0E06h
reg1 dw 0100h, 0402h, 0704h, 0300h
dw 0204h, 0005h, 0406h
;40*25 16 couleurs
mode0 DB 63H,00H, 03H,09H,03H,00H,02H
DB 2DH,27H,28H,90H,2BH,0A0H,0BFH,01FH,00H,4FH,0DH,0EH,00H,00H,00H,00H
DB 9CH,8EH,8FH,14H,1FH,96H,0B9H,0A3H,0FFH
DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH
DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH
DB 0CH,00H,0FH,08H,00H
db 40,25
;80*25 16 couleurs
mode1 DB 67H,00H, 03H,00H,03H,00H,02H
DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,4FH,0DH,0EH,00H,00H,00H,00H
DB 9CH,0EH,8FH,28H,1FH,96H,0B9H,0A3H,0FFH
DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH
DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH
DB 0CH,00H,0FH,08H,00H
db 80,25
;80*50 16 couleurs
mode2 DB 63H, 00H, 03H,01H,03H,01H,02H
DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,47H,06H,07H,00H,00H,00H
DB 00H,9CH,8EH,8FH,28H,1FH,96H,0B9H,0A3H,0FFH
DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH
DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH
DB 0CH,00H,0FH,00H,00H
db 80,50
;640*480 16 couleurs
mode3 DB 63H, 00H, 03H,01H,0FH,00H,0EH
DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H
DB 9CH,0EH,8FH,28H,40H,96H,0B9H,0A3H,0FFH
DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH
DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH
DB 41H,00H,0FH,00H,00H
db 00,00
;320*240 256 couleurs
mode4 DB 63H, 00H, 03H,01H,0FH,00H,0EH
DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H
DB 9CH,0EH,8FH,28H,40H,96H,0B9H,0A3H,0FFH
DB 00H,00H,00H,00H,00H,10H,05H,0FH,0FFH
DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH
DB 41H,00H,0FH,00H,00H
db 00,00
;=============CLEAR=========
;Efface l'ecran texte
;->
;<-
;=============================
cleartext:
push es eax cx di
xor di,di
mov ax,0b800h
mov es,ax
mov eax,07200720h
mov cx,cs:pagesize
shr cx,2
cld
rep stosd
mov cs:xy,0
mov cs:x,0
mov cs:y,0
pop di cx eax es
ret
;=============CLEAR=========
;Efface l'ecran texte
;->
;<-
;=============================
clearpixel:
push es eax cx di
xor di,di
mov ax,0A000h
mov es,ax
mov eax,0h
mov cx,cs:pagesize
shr cx,2
cld
rep stosd
pop di cx eax es
ret
Sequencer equ 03C4h
misc equ 03C2h
CCRT equ 03D4h
Attribs equ 03C0h
graphic equ 03CEh
statut equ 3DAh
initmode:
push bx cx si ds
mov bl,1
mov cl,8
push cs
pop ds
mov si,offset special
call loadfont
pop ds si cx bx
ret
;Renvoie le mode video dans al
getvideomode:
mov al,cs:mode
ret
;====Met le mode video a al
setvideomode:
push ax dx di
cmp cs:mode,0FFh
jne noinit
call initmode
mov cs:pagesize,4000
call cleartext
noinit:
mov cs:mode,al
xor ah,ah
mov di,ax
shl di,6
add di,offset mode0
mov dx,misc
mov al,cs:[di]
out dx,al
inc di
mov dx,statut
mov al,cs:[di]
out dx,al
inc di
mov dx,sequencer
xor ax,ax
initsequencer:
mov ah,cs:[di]
out dx,ax
inc al
inc di
cmp al,5
jb initsequencer
mov ax,0E11h
mov dx,ccrt
out dx,ax
xor ax,ax
initcrt:
mov ah,cs:[di]
out dx,ax
inc al
inc di
cmp al,25
jb initcrt
mov dx,graphic
xor ax,ax
initgraphic:
mov ah,cs:[di]
out dx,ax
inc al
inc di
cmp al,9
jb initgraphic
mov dx,statut
in al,dx
mov dx,attribs
xor ax,ax
initattribs:
mov ah,cs:[di]
push ax
in ax,dx
pop ax
out dx,al
xchg ah,al
out dx,al
xchg ah,al
inc al
inc di
cmp al,21
jb initattribs
mov al,cs:[di]
mov cs:columns,al
mov ah,cs:[di+1]
mov cs:lines,ah
mul ah
shl ax,1
mov cs:pagesize,ax
mov al,20h
out dx,al
pop di dx ax
ret
;==========SPACE===========
;met un espace aprs le curseur
;->
;<-
;=============================
space:
push bx es
add cs:xy,2
mov bx,0B800h
mov es,bx
mov bx,cs:xy
mov byte ptr es:[bx],' '
pop es bx
ret
;==========SHOWCHAR===========
;met un caractŠre aprs le curseur
;-> dl
;<-
;=============================
showchar:
push dx bx es
mov bx,0B800h
mov es,bx
mov bx,cs:xy
mov dh,cs:colors
mov es:[bx],dx
add cs:xy,2
pop es bx dx
ret
;==========SHOWCHARAT===========
;met un caractŠre aprs le curseur coord ah,al
;-> dl ah al
;<-
;=============================
showcharat:
push es di
call setxy
call showchar
pop di es
ret
;==========LINE=========
;remet le curseur a la ligne
;->
;<-
;=============================
line:
push bx cx di es
mov bh,cs:x
mov bl,cs:y
xor bh,bh
mov cl,cs:lines
dec cl
cmp bl,cl
jne scro
dec bl
mov cl,1
call scrolldown
scro:
inc bl
call setxy
pop es di cx bx
ret
;==========SETCOLOR=========
;Change les attributs du texte a CL
;-> CL
;<-
;=============================
setcolor:
mov cs:colors,CL
ret
;==========GETCOLOR=========
;RcupŠre les attributs du texte dans CL
;->
;<- CL
;=============================
getcolor:
mov cl,cs:colors
ret
updatecursor:
push ax dx di
mov dx,3D4h
mov al,0Eh
mov di,offset xy
mov ah,cs:[di]
out dx,ax
mov ah,cs:[di+1]
inc al
out dx,ax
pop di dx ax
ret
;==========SCROLLDOWN=========
;defile de cx lines vers le bas
;-> CX
;<-
;=============================
scrolldown:
push ax cx dx si di ds es
mov si,0B800h
mov es,si
mov ds,si
mov ax,cx
mul cs:columns
shl ax,1
mov si,ax
mov cx,cs:pagesize
sub cx,si
xor di,di
cld
rep movsb
pop es ds di si dx cx ax
ret
;==========GETXY=========
;Change les coordonnées du curseur a X:AL,Y:AH
;-> AX
;<-
;=============================
getxy:
mov bh,cs:x
mov bl,cs:y
ret
;==========SETXY=========
;Change les coordonnées du curseur a X:AH,Y:AL
;-> AX
;<- es di
;=============================
setxy:
push ax bx dx
mov cs:x,bh
mov cs:y,bl
mov al,bl
mov bl,bh
xor bh,bh
mov di,bx
mul cs:columns
shl ax,1
add di,ax
mov cs:xy,di
mov ax,0B800h
mov es,ax
pop dx bx ax
ret
setxy2:
push es di
call setxy
pop di es
ret
;===================================sauve l'ecran rapidement================
SaveScreen:
push cx si di ds es
mov cx,0B800H
mov ds,cx
push cs
pop es
mov cx,cs:pagesize
shr cx,2
xor si,si
mov di,offset Copy2
cld
rep movsd
pop es ds di si cx
ret
;===================================sauve l'ecran rapidement================
Savepage1:
push cx si di ds es
mov cx,0B800H
mov ds,cx
push cs
pop es
mov cx,cs:pagesize
shr cx,2
xor si,si
mov di,offset Copy
cld
rep movsd
pop es ds di si cx
ret
;===================================sauve l'ecran rapidement================
RestoreScreen:
push cx si di ds es
mov cx,0B800H
mov es,cx
push cs
pop ds
mov cx,cs:pagesize
shr cx,2
mov si,offset Copy2
xor di,di
cld
rep movsd
pop es ds di si cx
ret
copy2 db 4000 dup (0)
copy db 4000 dup (0)
;===============================Page2to1============================
Page2to1:
push cx si di ds es
mov cx,0B800H
mov es,cx
mov ds,cx
mov cx,cs:pagesize
shr cx,2
mov si,4000
xor di,di
cld
rep movsd
pop es ds di si cx
ret
;===============================Page1to2============================
Page1to2:
push cx si di ds es
mov cx,0B800H
mov es,cx
mov ds,cx
mov cx,cs:pagesize
shr cx,2
mov di,4000
xor si,si
cld
rep movsd
pop ds es di si cx
ret
;===============================xchgPages============================
xchgPages:
push cx si di ds es
call savepage1
call page2to1
mov cx,0B800H
mov es,cx
push cs
pop ds
mov cx,cs:pagesize
shr cx,2
mov si,offset Copy
mov di,4000
rep movsd
pop es ds di si cx
ret
;===================================Afficher un int EDX a l'cran en ah,al================
ShowInt:
push eax bx cx edx esi di es ds
mov di,cs:xy
mov cx,0B800h
mov es,cx
xor cx,cx
mov eax,edx
mov esi,10
mov bx,offset showbuffer+27
decint3:
xor edx,edx
div esi
add dl,'0'
mov dh,cs:colors
sub bx,2
add cx,2
mov cs:[bx],dx
cmp ax,0
jne decint3
mov si,bx
push cs
pop ds
cld
rep movsb
mov cs:xy,di
pop ds es di esi edx cx bx eax
ret
showbuffer db 35 dup (0FFh)
;===================================Afficher un int EDX a l'cran en ah,al================
ShowIntat:
push es di
call setxy
call showint
pop di es
ret
waitretrace:
push ax dx
mov dx,3DAh
waitr:
in al,dx
test al,8
jz waitr
pop dx ax
ret
nbexactbit:
push edx
xor cx,cx
viewnb:
inc cx
shr edx,1
cmp edx,0
jnz viewnb
pop edx
ret
bittobyte:
push dx
adap:
mov dx,cx
and dx,3
jz adapfin
add cx,1
jmp adap
adapfin:
pop dx
ret
Nbbit:
cmp edx,0FFh
jb ok1
cmp edx,0FFFFh
jb ok2
mov cx,32
ret
ok1:
mov cx,8
ret
ok2:
mov cx,16
ret
showhexat:
push es di
call setxy
call showhex
pop di es
ret
showbinat:
push cx es di
call setxy
call showbin
pop di es cx
ret
;==============================Affiche le nombre nb binaire en EDX==============
Showbin:
push es ax bx cx di
mov di,cs:xy
mov bx,0B800h
mov es,bx
mov ax,cx
sub cx,32
neg cx
shl edx,cl
mov ch,cs:colors
binaize:
rol edx,1
mov cl,'0'
adc cl,0
mov es:[di],cx
add di,2
dec al
jnz binaize
mov cs:xy,di
pop di cx bx ax es
ret
;==============================Affiche le nombre nb hexa en EDX==============
ShowHex:
push es ax bx cx di
mov di,cs:xy
mov bx,0B800h
mov es,bx
mov ax,cx
sub cx,32
neg cx
shl edx,cl
mov ch,cs:colors
shr ax,2
Hexaize:
rol edx,4
mov bx,dx
and bx,0fh
mov cl,cs:[bx+offset Tab]
mov es:[di],cx
add di,2
dec al
jnz Hexaize
mov cs:xy,di
pop di cx bx ax es
ret
Tab db '0123456789ABCDEF'
;===================================Afficher un int EDX a l'cran en ah,al================
Showsigned:
push ax ebx edx es
xor ebx,ebx
mov bl,cl
bt edx,ebx
jnc pos
neg edx
mov ah,cs:colors
mov al,'-'
mov bx,0B800h
mov es,bx
mov bx,cs:xy
mov word ptr es:[bx],ax
add cs:xy,2
pos:
call showint
pop es edx ebx ax
ret
showsignedat:
push es di
call setxy
call showsigned
pop di es
ret
;================Affiche la chaine de caractŠre contenue dans ds:si
showstring:
push es bx cx si di
mov di,cs:xy
mov bx,0B800h
mov es,bx
mov bl,[si]
mov ch,cs:colors
strinaize:
inc si
mov cl,[si]
mov es:[di],cx
add di,2
dec bl
jnz strinaize
mov cs:xy,di
pop di si cx bx es
ret
;================Affiche la chaine 0 de caractŠre contenue dans ds:si
showstring0:
push es cx si di
mov di,cs:xy
mov cx,0B800h
mov es,cx
mov ch,cs:colors
strinaize0:
mov cl,[si]
cmp cl,0
je no0
mov es:[di],cx
add di,2
inc si
jmp strinaize0
no0:
mov cs:xy,di
pop di si cx es
ret
showstringat:
push es di
call setxy
call showstring
pop di es
ret
showstring0at:
push es di
call setxy
call showstring0
pop di es
ret
;couleur al pour ligne di
changelineattr:
push ax bx di es
mov bx,ax
mov ax,0B800h
mov es,ax
mov ax,di
mul cs:columns
mov di,ax
shl di,1
mov al,cs:columns
inc di
popep:
mov es:[di],bl
add di,2
dec al
jnz popep
pop es di bx ax
ret
;Retourne en es:di un bloc de donnes
Getinfos:
push cx si di ds
push cs
pop ds
mov cx,10
mov si,offset lines
cld
rep movsb
pop ds di si cx
ret
lines db 0
columns db 0
x db 0
y db 0
xy dw 0
colors db 7
mode db 0FFh
pagesize dw 0
special equ $
endofme equ $ +4096
end start