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

This commit is contained in:
Nicolas Hordé 2007-03-23 21:46:21 +00:00
parent 2b1f562890
commit 2e23d3853b
1 changed files with 314 additions and 337 deletions

View File

@ -1,54 +1,50 @@
.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
int 47H
mov ah,2
int 47h
xor ebp,ebp xor ebp,ebp
xor ax,ax xor ax,ax
mov fs,ax mov fs,ax
mov ah,43 call [disablescroll]
int 47h adres:
Adres: call [saveparamto],offset infos
mov di,offset infos mov al,[infos.lines]
mov ah,34 dec al
int 47h mov [lastline],al
dec byte ptr [di] mov al,[infos.columns]
mov al,[di+1]
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
int 47h
mov bh,infos
mov edi,ebp mov edi,ebp
mov bh,[lastline]
lines: lines:
xor edx,edx xor edx,edx
mov dx,di mov dx,di
@ -60,49 +56,43 @@ lines:
push offset spaces push offset spaces
call [print] call [print]
mov dx,di mov dx,di
mov al,infos+1 mov al,[sizex]
mov esi,edi mov esi,edi
doaline: doaline:
mov edx,edi mov edx,edi
shr edx,4*4 shr edx,4*4
shl edx,4*3 shl edx,4*3
mov fs,dx mov fs,dx
push dword ptr fs:[di] push [dword ptr fs:di]
push 8 push 8
call [showhex] call [showhex]
push ' ' call [showchar],' '
call [showchar]
inc edi inc edi
dec al dec al
jnz doaline jnz doaline
mov edi,esi mov edi,esi
push offset spaces2 push offset spaces2
call [print] call [print]
mov al,infos+1 mov al,[sizex]
doaline2: doaline2:
mov edx,edi mov edx,edi
shr edx,4*4 shr edx,4*4
shl edx,4*3 shl edx,4*3
mov fs,dx mov fs,dx
push word ptr fs:[di] push [word ptr fs:di]
call [showchar] call [showchar]
inc edi 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
@ -138,17 +128,13 @@ outes:
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:
@ -156,7 +142,7 @@ waitst:
int 16h int 16h
cmp ah,41h cmp ah,41h
jne tre jne tre
mov dword ptr [pope],' EUV' mov [dword ptr pope],' EUV'
push cs push cs
pop es pop es
jmp adres jmp adres
@ -165,93 +151,83 @@ tre:
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 edi,es:[bx-1] mov edi,[es:bx-1]
mov dx,es:[si-1] mov dx,[es:si-1]
mov byte ptr es:[bx],0112 mov [byte ptr es:bx],0112
mov es:[bx-1],al 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 gs:[bx],ch mov [gs:bx],ch
pusha pusha
popa popa
mov cl,gs:[bx] mov cl,[gs:bx]
cmp ch,cl cmp ch,cl
je no je no
push si ax push si ax
mov bh,0 call [setxy],0,[word ptr lastline]
mov bl,infos call [print],offset msg
mov ah,25
int 47h
push offset msg
call [print]
mov ax,0 mov ax,0
int 16h int 16h
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]
pop bx si pop bx si
mov es:[bx-1],edi mov [es:bx-1],edi
mov es:[si-1],dx mov [es:si-1],dx
no: no:
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
@ -259,56 +235,52 @@ cursor:
suit7: suit7:
cmp ax,4200h cmp ax,4200h
jne adres 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
mov dx,xx mov dx,[xx]
shl dx,1 shl dx,1
add si,dx add si,dx
add si,129 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 ebx,ebx xor ebx,ebx
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 ebx,ebp add ebx,ebp
@ -318,7 +290,6 @@ calc3:
mov gs,dx mov gs,dx
pop dx pop dx
ret ret
asciihex2dec: asciihex2dec:
cmp al,'a' cmp al,'a'
jb nomin jb nomin
@ -341,13 +312,16 @@ 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
dep db ':',0
msg db '\c74Erreur : zone non modifiable (ROM) pressez une touche pour continuer ',0 msg db '\c74Erreur : zone non modifiable (ROM) pressez une touche pour continuer ',0
menu db '\c70haut/bas [F1/2] Offset [F3/4] Segment [F5/6] Mode F7, Quitter F8 MODE ' menu db '\c70haut/bas [F1/2] Offset [F3/4] Segment [F5/6] Mode F7, Quitter F8 MODE '
pope db 'VUE ',0 pope db 'VUE ',0
@ -356,18 +330,21 @@ 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) infos vgainf <>
imports: importing
db "VIDEO.LIB::print",0 use VIDEO,setvideomode
print dd 0 use VIDEO,savestate
db "VIDEO.LIB::showhex",0 use VIDEO,restorestate
showhex dd 0 use VIDEO,setxy
db "VIDEO.LIB::showchar",0 use VIDEO,addline
showchar dd 0 use VIDEO,saveparamto
dw 0 use VIDEO,disablescroll
use VIDEO,clearscreen
end start use VIDEO.LIB,print
use VIDEO.LIB,showhex
use VIDEO.LIB,showchar
endi