feat: mise à jour du code pour compilation sur LZASM en stdcall

This commit is contained in:
Nicolas Hordé 2007-03-23 22:33:05 +00:00
parent 2e23d3853b
commit 1d3ce9c6e6
1 changed files with 250 additions and 278 deletions

View File

@ -1,121 +1,98 @@
.model tiny model tiny,stdcall
.486 p586N
smart locals
.code jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
include "..\include\graphic.h"
org 0h org 0h
include ..\include\mem.h
start: start:
header exe <,1,0,,,offset imports,,> header exe <"CE",1,0,0,,offset imports,,offset realstart>
realstart: realstart:
mov ax,0305h mov ax,0305h
mov bx,0008h mov bx,0008h
int 16h
call [savestate]
call [setvideomode],2
xor ebp,ebp
xor ax,ax
mov fs,ax
call [disablescroll]
adres:
call [saveparamto],offset infos
call [readsector],[sect],offset buffer
jnc adres2
errtr:
call [setxy],0,[word ptr lastline]
call [print],offset errordisk
xor ax,ax
int 16h int 16h
mov ah,28h adres2:
int 47H call [saveparamto],offset infos
mov ax,0002 mov al,[infos.lines]
int 47H dec al
mov ah,2 mov [lastline],al
int 47h mov al,[infos.columns]
mov ah,43 sub al,16
int 47h mov bl,al
xor bp,bp shr al,2
push cs mov [sizex],al
push cs and bl,11b
pop es mov [sizex2],bl
pop ds mov al,[infos.mode]
Adres: cmp al,[oldmode]
mov di,offset infos je noinit
mov ah,34 call [clearscreen]
int 47h mov [oldmode],al
dec infos noinit:
push cs call [setxy],0,0
pop es mov edi,ebp
mov cx,sect mov bh,[lastline]
mov di,offset buffer
mov ah,0h
int 48h
jnc noerror
errtr:
mov ah,25
mov bl,infos
xor bh,bh
int 47h
push offset errordisk
call [print]
mov ax,0
int 16h
noerror:
adres2:
mov di,offset infos
mov ah,34
int 47h
dec byte ptr [di]
mov al,[di+1]
sub al,16
mov bl,al
shr al,2
mov [di+1],al
and bl,11b
mov [di+2],bl
mov al,[di+7]
cmp al,oldmode
je noinit
mov ah,2
int 47h
mov oldmode,al
noinit:
mov bx,0
mov ah,25
int 47h
mov bh,infos
mov di,bp
lines: lines:
xor edx,edx xor edx,edx
mov dx,di mov dx,di
push edx push edx
mov dx,sect mov edx,edi
push edx mov dx,[sect]
push offset spaces push edx
call [print] push offset spaces
mov al,infos+1 call [print]
mov si,di mov dx,di
mov al,[sizex]
mov esi,edi
doaline: doaline:
push dword ptr [di+offset buffer] push [dword ptr di+offset buffer]
push 8 push 8
call [showhex] call [showhex]
push ' ' call [showchar],' '
call [showchar] inc edi
inc di dec al
dec al jnz doaline
jnz doaline mov edi,esi
mov di,si push offset spaces2
push offset spaces2 call [print]
call [print] mov al,[sizex]
mov al,infos+1
doaline2: doaline2:
push word ptr [di+offset buffer] push [dword ptr di+offset buffer]
call [showchar] call [showchar]
inc di inc edi
dec al dec al
jnz doaline2 jnz doaline2
dec bh dec bh
je outes je outes
cmp byte ptr infos+2,0 cmp [sizex2],0
je lines je lines
mov ah,6 call [addline]
int 47h jmp lines
jmp lines
outes: outes:
mov bh,0 call [setxy],0,[word ptr lastline]
mov bl,infos call [print],offset menu
mov ah,25
int 47h
push offset menu
call [print]
waitkey: waitkey:
mov ax,0 mov ax,0
int 16h int 16h
@ -135,16 +112,16 @@ outes:
suit2: suit2:
cmp ax,3D00h cmp ax,3D00h
jne suit3 jne suit3
cmp sect,2880 cmp [sect],2880
ja waitkey ja waitkey
inc sect inc [sect]
jmp adres jmp adres
suit3: suit3:
cmp ax,3E00h cmp ax,3E00h
jne suit4 jne suit4
cmp sect,0 cmp [sect],0
je waitkey je waitkey
dec sect dec [sect]
jmp adres jmp adres
suit4: suit4:
cmp ax,3F00h cmp ax,3F00h
@ -153,165 +130,152 @@ outes:
suit5: suit5:
cmp ax,4000h cmp ax,4000h
jne suit6 jne suit6
mov cx,sect mov cx,[sect]
mov di,offset buffer call [writesector],[sect],offset buffer
mov ah,1
int 48h
jnc waitkey jnc waitkey
jmp errtr jmp errtr
suit6: suit6:
cmp ax,4100h cmp ax,4100h
jne suit7 jne suit7
mov dword ptr [pope],'TIDE' mov [dword ptr pope],'TIDE'
mov bh,0 call [setxy],0,[word ptr lastline]
mov bl,infos call [print],offset menu
mov ah,25 mov ax,0B800h
int 47h mov es,ax
push offset menu mov [xxyy2],3
call [print] mov [xxyy],3
mov ax,0B800h call calc1
mov es,ax call calc2
mov xxyy2,3
mov xxyy,3
call calc1
call calc2
waitst: waitst:
mov ax,0 mov ax,0
int 16h int 16h
cmp ah,41h cmp ah,41h
jne tre jne tre
mov dword ptr [pope],'WEIV' mov [dword ptr pope],' EUV'
push cs push cs
pop ds pop es
mov cx,sect call [writesector],[sect],offset buffer
mov si,offset buffer jnc waitkey
mov ah,1
int 48h
jnc adres
jmp errtr jmp errtr
tre: tre:
cmp al,0 cmp al,0
jne write jne write
cmp ah,48h cmp ah,48h
jne tre1 jne tre1
cmp yy,0 cmp [yy],0
je waitst je waitst
dec yy dec [yy]
jmp cursor jmp cursor
tre1: tre1:
cmp ah,50h cmp ah,50h
jne tre2 jne tre2
mov al,infos mov al,[lastline]
dec al dec al
xor ah,ah xor ah,ah
cmp yy,ax cmp [yy],ax
je waitst je waitst
inc yy inc [yy]
jmp cursor jmp cursor
tre2: tre2:
cmp ah,4Dh cmp ah,4Dh
jne tre4 jne tre4
cmp xx,15 cmp [xx],15
je waitst je waitst
inc xx inc [xx]
jmp cursor jmp cursor
tre4: tre4:
cmp ah,4Bh cmp ah,4Bh
jne waitst jne waitst
cmp xx,0 cmp [xx],0
je waitst je waitst
dec xx dec [xx]
jmp cursor jmp cursor
write: write:
call AsciiHex2dec call asciihex2dec
cmp cl,15 cmp cl,15
ja waitst ja waitst
call calc1 call calc1
call calc2 call calc2
mov byte ptr es:[bx],0112 mov edi,[es:bx-1]
mov es:[bx-1],al mov dx,[es:si-1]
mov [byte ptr es:bx],0112
mov [es:bx-1],al
writs: writs:
mov ax,0 mov ax,0
int 16H int 16h
mov ch,cl mov ch,cl
call AsciiHex2dec call asciihex2dec
cmp cl,15 cmp cl,15
ja writs ja writs
shl ch,4 shl ch,4
add ch,cl add ch,cl
mov es:[bx+1],al mov [es:bx+1],al
mov es:[si-1],ch mov [es:si-1],ch
mov ax,bx mov ax,bx
call calc3 call calc3
mov [bx],ch mov [bx],ch
inc xx inc [xx]
cmp xx,16 cmp [xx],16
jne pasde jne pasde
inc yy inc [yy]
mov xx,0h mov [xx],0h
pasde: pasde:
call calc1 call calc1
call calc2 call calc2
jmp waitst jmp waitst
cursor: cursor:
call calc1 call calc1
call calc2 call calc2
jmp waitst jmp waitst
suit7: suit7:
cmp ax,4200h cmp ax,4200h
jne adres2 jne adres
mov ah,29h call [restorestate]
int 47H retf
retf
calc1: calc1:
push ax dx si push ax dx si
mov ax,xx mov ax,[xx]
mov dx,xx mov dx,[xx]
shl ax,2 shl ax,2
shl dx,1 shl dx,1
add ax,dx add ax,dx
add ax,27 add ax,27
mov bx,YY mov bx,[yy]
mov dx,yy mov dx,[yy]
shl bx,5 shl bx,5
shl dx,7 shl dx,7
add bx,dx add bx,dx
add bx,ax add bx,ax
mov byte ptr es:[bx],112 mov [byte ptr es:bx],112
mov byte ptr es:[bx+2],112 mov [byte ptr es:bx+2],112
mov si,xxyy mov si,[xxyy]
mov byte ptr es:[si],07 mov [byte ptr es:si],07
mov byte ptr es:[si+2],07 mov [byte ptr es:si+2],07
mov xxyy,bx mov [xxyy],bx
pop si dx ax pop si dx ax
ret ret
calc2: calc2:
push ax bx dx push ax bx dx
mov si,YY mov si,[yy]
mov dx,yy mov dx,[yy]
shl si,5 shl si,5
shl dx,7 shl dx,7
add si,dx add si,dx
add si,2 mov dx,[xx]
mov dx,xx shl dx,1
shl dx,1 add si,dx
add si,dx add si,129
add si,127 mov [byte ptr es:si],112
mov byte ptr es:[si],112 mov bx,[xxyy2]
mov bx,xxyy2 mov [byte ptr es:bx],07
mov byte ptr es:[bx],07 mov [xxyy2],si
mov xxyy2,si pop dx bx ax
pop dx bx ax ret
ret
calc3: calc3:
push dx push dx
xor bx,bx xor bx,bx
mov bx,xx mov bx,[xx]
mov dx,yy mov dx,[yy]
shl dx,4 shl dx,4
add bx,dx add bx,dx
add bx,bp add bx,bp
@ -319,35 +283,39 @@ calc3:
pop dx pop dx
ret ret
asciihex2dec: asciihex2dec:
cmp al,'a' cmp al,'a'
jb nomin jb nomin
cmp al,'f' cmp al,'f'
ja nomin ja nomin
sub al,'a'-'A' sub al,'a'-'A'
jmp ismaj jmp ismaj
nomin: nomin:
cmp al,'A' cmp al,'A'
jb nomaj jb nomaj
cmp al,'F' cmp al,'F'
ja nomaj ja nomaj
ismaj: ismaj:
mov cl,al mov cl,al
sub cl,'A'-10 sub cl,'A'-10
jmp endt jmp endt
nomaj: nomaj:
mov cl,al mov cl,al
sub cl,'0' sub cl,'0'
endt: endt:
ret ret
dep db ':',0
sect dw 0
xx dw 0 xx dw 0
yy dw 0 yy dw 0
xxyy dw 3 xxyy dw 3
xxyy2 dw 3 xxyy2 dw 3
lastline db 0
sizex db 0
sizex2 db 0
buffer db 2048 dup (0)
dep db ':',0
errordisk db '\c74Une erreur est apparue sur le lecteur, appuyez sur une touche ',0 errordisk db '\c74Une erreur est apparue sur le lecteur, appuyez sur une touche ',0
menu db '\c70Haut&Bas [F1/2] Secteur [F3/4] Charger/Sauver [F5/6] Mode [F7] Quit. [F8] ' menu db '\c70Haut&Bas [F1/2] Secteur [F3/4] Charger/Sauver [F5/6] Mode [F7] Quit. [F8] '
pope db 'VUE ',0 pope db 'VUE ',0
@ -356,20 +324,24 @@ spaces2 db '\c04 | \c07',0
showbuffer db 35 dup (0FFh) showbuffer db 35 dup (0FFh)
oldmode db 0 oldmode db 0
infos db 40 dup (0) sect dw 0
buffer db 2048 dup (0) infos vgainf <>
imports: importing
db "VIDEO.LIB::print",0 use DISQUE,readsector
print dd 0 use DISQUE,writesector
db "VIDEO.LIB::showhex",0 use VIDEO,setvideomode
showhex dd 0 use VIDEO,savestate
db "VIDEO.LIB::showchar",0 use VIDEO,restorestate
showchar dd 0 use VIDEO,setxy
dw 0 use VIDEO,addline
use VIDEO,saveparamto
use VIDEO,disablescroll
end start use VIDEO,clearscreen
use VIDEO.LIB,print
use VIDEO.LIB,showhex
use VIDEO.LIB,showchar
endi