
Janseverus
|
Voila ma source vous la pensez compatible en 32bits?
code segment byte public assume cs:code public mmsend public mmread public binread
;************************************************
mmsend proc far
cmd_add equ <8[bp]> mm_add equ <6[bp]>
push bp mov bp,sp
push ax push bx push dx push si push ds
lds si,cmd_add ;string address (offset) into SI ;segment into ds inc si ;skip over the length byte
mov dx,mm_add ;port address into DX; passed by value inc dx
wait_mm_rdy: in al,dx ;wait for MM2000 to be ready cmp al,80h ;bit 7=1 jne wait_mm_rdy
mov al,byte ptr[si] ;get data mov ah,al ;save data
dec dx out dx,al ;send data inc dx
or al,80h ;send DAV signal out dx,al ;output data and DAV signal
wait_mm_dac: in al,dx ;wait for MM2000 to accept data cmp al,0 ;i.e. not ready -- bit 7=0 jne wait_mm_dac
cli ;disable interrupts
mov al,0 ;set DAV not data valid and out dx,al ;remove data
inc si cmp ah,0dh ;test if last char. sent je wait_mm_rdy_exit
sti ;enable interrupts jmp wait_mm_rdy
wait_mm_rdy_exit: in al,dx ;wait for MM2000 to be ready for exit cmp al,80h ;bit 7=1 jne wait_mm_rdy_exit
sti ;enable interrupts pop ds pop si pop dx pop bx pop ax mov sp,bp pop bp ret 6
mmsend endp
;************************************************
mmread proc far
resp_add equ <8[bp]> mm_addr equ <6[bp]>
push bp mov bp,sp
push ax push bx push dx push di push ds
lds di,resp_add ;string address (offset) into di ;segment into ds mov bx,di ;save pointer to string length mov al,0 mov [bx],al ;string length = 0 at start inc di ;point to beginning of string
mov dx,mm_addr ;port address into DX inc dx
wait_mm_ready: in al,dx ;wait for MM2000 not ready to receive cmp al,0 ;i.e. ready to send jne wait_mm_ready
pc_ready_for_data: mov al,80h out dx,al ;send PC ready to interface
wait_mm_dav: in al,dx ;wait for MM2000 to indicate DAV cmp al,80h ;bit 7=1 jb wait_mm_dav ;jump if below
dec dx ;get data in al,dx inc dx
mov [di],al ;store data at string address inc byte ptr [bx] ;inc. resp. string length mov ah,al ;save received character inc di
mov al,0 ;indicate to MM2000 data accepted out dx,al ;set bit 7=0 cmp ah,0ah je exit
wait_mm_ndav: in al,dx ;wait for MM2000 to indicate not DAV cmp al,0 ;bit 7=0 jne wait_mm_ndav
jmp pc_ready_for_data
; Exit if character received is line feed
exit: in al,dx cmp al,80h jne exit
pop ds pop di pop dx pop bx pop ax mov sp,bp pop bp ret 6
mmread endp
;***************************************
binread proc
bin_add equ <8[bp]> mm_addr equ <6[bp]>
push bp mov bp,sp
push ax push bx push dx push di
mov dx,mm_addr ;port address into DX inc dx
lds bx,bin_add ;bx<-offset, ds<-segment mov cx,bx add cx,3 dec bx
bwait_mm_ready: in al,dx ;wait for MM2000 not ready to receive cmp al,0 ;i.e. ready to send jne bwait_mm_ready
bpc_ready_for_data: mov al,80h out dx,al ;send PC ready to interface
bwait_mm_dav: in al,dx ;wait for MM2000 to indicate DAV cmp al,80h ;bit 7=1 jb bwait_mm_dav ;jump if below
dec dx ;get data in al,dx inc dx
inc bx mov [bx],al
mov al,0 ;indicate to MM2000 data accepted out dx,al ;set bit 7=0
cmp bx,cx je bexit
bwait_mm_ndav: in al,dx ;wait for MM2000 to indicate not DAV cmp al,0 ;bit 7=0 jne bwait_mm_ndav
jmp bpc_ready_for_data
; Exit if character received is line feed
bexit: in al,dx cmp al,80h jne bexit
pop di pop dx pop bx pop ax mov sp,bp pop bp ret 6
binread endp
;--------------------------------------- code ends end
Merci pour les réponses :)
|