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,353 +1,327 @@
.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]
xor ebp,ebp adres:
xor ax,ax call [saveparamto],offset infos
mov fs,ax mov al,[infos.lines]
mov ah,43 dec al
int 47h mov [lastline],al
Adres: mov al,[infos.columns]
mov di,offset infos sub al,16
mov ah,34 mov bl,al
int 47h shr al,2
dec byte ptr [di] mov [sizex],al
mov al,[di+1] and bl,11b
sub al,16 mov [sizex2],bl
mov bl,al mov al,[infos.mode]
shr al,2 cmp al,[oldmode]
mov [di+1],al je noinit
and bl,11b call [clearscreen]
mov [di+2],bl mov [oldmode],al
mov al,[di+7] noinit:
cmp al,oldmode call [setxy],0,0
je noinit mov edi,ebp
mov ah,2 mov bh,[lastline]
int 47h
mov oldmode,al
noinit:
mov bx,0
mov ah,25
int 47h
mov bh,infos
mov edi,ebp
lines: lines:
xor edx,edx xor edx,edx
mov dx,di mov dx,di
push edx push edx
mov edx,edi mov edx,edi
shr edx,4*4 shr edx,4*4
shl edx,4*3 shl edx,4*3
push edx push edx
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,[sizex]
mov al,infos+1
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 waitkey:
int 47h mov ax,0
push offset menu int 16h
call [print] cmp ax,3B00h
waitkey: jne suit
mov ax,0 inc ebp
int 16h jmp adres
cmp ax,3B00h suit:
jne suit cmp ax,3C00h
inc ebp jne suit2
jmp adres dec ebp
suit: jmp adres
cmp ax,3C00h suit2:
jne suit2 cmp ax,3D00h
dec ebp jne suit3
jmp adres add ebp,24*16
suit2: jmp adres
cmp ax,3D00h suit3:
jne suit3 cmp ax,3E00h
add ebp,24*16 jne suit4
jmp adres sub ebp,24*16
suit3: jmp adres
cmp ax,3E00h suit4:
jne suit4 cmp ax,3F00h
sub ebp,24*16 jne suit5
jmp adres add ebp,010000h
suit4: jmp adres
cmp ax,3F00h suit5:
jne suit5 cmp ax,4000h
add ebp,010000h jne suit6
jmp adres sub ebp,010000h
suit5: jmp adres
cmp ax,4000h suit6:
jne suit6 cmp ax,4100h
sub ebp,010000h jne suit7
jmp adres mov [dword ptr pope],'TIDE'
suit6: call [setxy],0,[word ptr lastline]
cmp ax,4100h call [print],offset menu
jne suit7 mov ax,0B800h
mov dword ptr [pope],'TIDE' mov es,ax
mov bh,0 mov [xxyy2],3
mov bl,infos mov [xxyy],3
mov ah,25 call calc1
int 47h call calc2
push offset menu
call [print]
mov ax,0B800h
mov es,ax
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],' EUV' mov [dword ptr pope],' EUV'
push cs push cs
pop es pop es
jmp adres jmp adres
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 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 mov ax,0
int 47h int 16h
push offset msg call [setxy],0,[word ptr lastline]
call [print] call [print],offset menu
mov ax,0 pop bx si
int 16h mov [es:bx-1],edi
mov bh,0 mov [es:si-1],dx
mov bl,infos no:
mov ah,25 inc [xx]
int 47h cmp [xx],16
push offset menu jne pasde
call [print] inc [yy]
pop bx si mov [xx],0h
mov es:[bx-1],edi pasde:
mov es:[si-1],dx call calc1
no: call calc2
jmp waitst
inc xx
cmp xx,16
jne pasde
inc yy
mov xx,0h
pasde:
call calc1
call calc2
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 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
mov edx,ebx mov edx,ebx
shr edx,4*4 shr edx,4*4
shl edx,4*3 shl edx,4*3
mov gs,dx mov gs,dx
pop dx pop dx
ret ret
asciihex2dec:
cmp al,'a'
jb nomin
cmp al,'f'
ja nomin
sub al,'a'-'A'
jmp ismaj
nomin:
cmp al,'A'
jb nomaj
cmp al,'F'
ja nomaj
ismaj:
mov cl,al
sub cl,'A'-10
jmp endt
nomaj:
mov cl,al
sub cl,'0'
endt:
ret
asciihex2dec:
cmp al,'a'
jb nomin
cmp al,'f'
ja nomin
sub al,'a'-'A'
jmp ismaj
nomin:
cmp al,'A'
jb nomaj
cmp al,'F'
ja nomaj
ismaj:
mov cl,al
sub cl,'A'-10
jmp endt
nomaj:
mov cl,al
sub cl,'0'
endt:
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