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 int 16h
mov ah,28h call [savestate]
int 47H call [setvideomode],2
mov ax,0002 xor ebp,ebp
int 47H xor ax,ax
mov ah,2 mov fs,ax
int 47h call [disablescroll]
mov ah,43 adres:
int 47h call [saveparamto],offset infos
xor bp,bp call [readsector],[sect],offset buffer
push cs jnc adres2
push cs
pop es
pop ds
Adres:
mov di,offset infos
mov ah,34
int 47h
dec infos
push cs
pop es
mov cx,sect
mov di,offset buffer
mov ah,0h
int 48h
jnc noerror
errtr: errtr:
mov ah,25 call [setxy],0,[word ptr lastline]
mov bl,infos call [print],offset errordisk
xor bh,bh xor ax,ax
int 47h
push offset errordisk
call [print]
mov ax,0
int 16h int 16h
noerror:
adres2: adres2:
mov di,offset infos call [saveparamto],offset infos
mov ah,34 mov al,[infos.lines]
int 47h dec al
dec byte ptr [di] mov [lastline],al
mov al,[di+1] mov al,[infos.columns]
sub al,16 sub al,16
mov bl,al mov bl,al
shr al,2 shr al,2
mov [di+1],al mov [sizex],al
and bl,11b and bl,11b
mov [di+2],bl mov [sizex2],bl
mov al,[di+7] mov al,[infos.mode]
cmp al,oldmode cmp al,[oldmode]
je noinit je noinit
mov ah,2 call [clearscreen]
int 47h mov [oldmode],al
mov oldmode,al
noinit: noinit:
mov bx,0 call [setxy],0,0
mov ah,25 mov edi,ebp
int 47h mov bh,[lastline]
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
mov dx,[sect]
push edx push edx
push offset spaces push offset spaces
call [print] call [print]
mov al,infos+1 mov dx,di
mov si,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 di,si mov edi,esi
push offset spaces2 push offset spaces2
call [print] call [print]
mov al,infos+1 mov al,[sizex]
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,26 +130,20 @@ 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
int 47h
push offset menu
call [print]
mov ax,0B800h mov ax,0B800h
mov es,ax mov es,ax
mov xxyy2,3 mov [xxyy2],3
mov xxyy,3 mov [xxyy],3
call calc1 call calc1
call calc2 call calc2
waitst: waitst:
@ -180,138 +151,131 @@ waitst:
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,127 add si,129
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
@ -341,13 +305,17 @@ calc3:
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