File "driver.asm"
Full Path: /home/analogde/www/PIC18F452/driver.asm
File size: 22.38 KB
MIME-type: text/plain
Charset: 8 bit
.586p
model flat
ifndef ??version
?debug macro
endm
endif
?debug S "C:\Dveloppement\PP18_v2\dll\PIC18F452\driver.c"
?debug T "C:\Dveloppement\PP18_v2\dll\PIC18F452\driver.c"
_TEXT segment dword public use32 'CODE'
_TEXT ends
_DATA segment dword public use32 'DATA'
_DATA ends
_BSS segment dword public use32 'BSS'
_BSS ends
DGROUP group _BSS,_DATA
_DATA segment dword public use32 'DATA'
_CLOCK label byte
db 2
db 2
db 32
_DATA_TO_PIC label byte
db 1
db 1
db 32
_DATA_FROM_PIC label byte
db 0
db 128
db 16
_MCLR_VPP label byte
db 3
db 4
db 16
_VCC_ON label byte
db 4
db 8
db 16
align 2
_LPT_adr_out label word
dw 888
align 2
_LPT_adr_in label word
dw 889
align 4
_delay_IO label dword
dd 400
align 4
_delay_Prog label dword
dd 5
_DATA ends
_TEXT segment dword public use32 'CODE'
__InitHardware proc near
?live1@0:
@1:
push 2
call _ClearBit
pop ecx
push 1
call _ClearBit
pop ecx
push 3
call _ClearBit
pop ecx
push 4
call _ClearBit
pop ecx
@2:
ret
__InitHardware endp
__PowerOn proc near
?live1@96:
push ebp
mov ebp,esp
push ecx
@3:
xor eax,eax
mov dword ptr [ebp-4],eax
@4:
push 4
call _SetBit
pop ecx
inc dword ptr [ebp-4]
mov edx,dword ptr [ebp-4]
cmp edx,1500
jb short @4
@7:
pop ecx
pop ebp
ret
__PowerOn endp
__PowerOff proc near
?live1@160:
@8:
push 4
call _ClearBit
pop ecx
@9:
ret
__PowerOff endp
_ProgramBlock proc near
?live1@208:
push ebp
mov ebp,esp
add esp,-16
@10:
push 3
call _SetBit
pop ecx
push 3932166
call _SetTBLPTR
pop ecx
push 0
push 0
call _WriteDataAtTBLPTR
add esp,8
push 0
call _WriteOp
pop ecx
push 36518
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
push 40102
call _WriteData
pop ecx
xor eax,eax
mov dword ptr [ebp-12],eax
push dword ptr [ebp+8]
call _SetTBLPTR
pop ecx
xor edx,edx
mov dword ptr [ebp-4],edx
mov ecx,dword ptr [ebp-4]
mov eax,dword ptr [ebp+16]
cmp ecx,eax
jae @12
@11:
mov edx,dword ptr [ebp+12]
mov cx,word ptr [edx]
mov word ptr [ebp-14],cx
xor eax,eax
mov dword ptr [ebp-8],eax
jmp short @14
@13:
push 1
mov dx,word ptr [ebp-14]
push edx
call _WriteDataAtTBLPTR
add esp,8
inc dword ptr [ebp-4]
add dword ptr [ebp+12],2
inc dword ptr [ebp-12]
mov ecx,dword ptr [ebp+12]
mov ax,word ptr [ecx]
mov word ptr [ebp-14],ax
inc dword ptr [ebp-8]
@14:
mov edx,dword ptr [ebp-8]
cmp edx,3
setb cl
and ecx,1
mov eax,dword ptr [ebp+16]
cmp eax,1
seta dl
and edx,1
and ecx,edx
jne short @13
push 3
mov cx,word ptr [ebp-14]
push ecx
call _WriteDataAtTBLPTR
add esp,8
push 0
call _WriteOpDelay
pop ecx
xor eax,eax
mov dword ptr [ebp-8],eax
jmp short @17
@16:
push 2
call _SetBit
pop ecx
inc dword ptr [ebp-8]
@17:
mov edx,dword ptr [ebp-8]
mov ecx,dword ptr [_delay_IO]
cmp edx,ecx
jb short @16
push 2
call _ClearBit
pop ecx
push 0
call _WriteData
pop ecx
push 1
push 0
call _WriteDataAtTBLPTR
add esp,8
add dword ptr [ebp+12],2
inc dword ptr [ebp-12]
inc dword ptr [ebp-4]
mov eax,dword ptr [ebp-4]
mov edx,dword ptr [ebp+16]
cmp eax,edx
jb @11
@12:
mov ecx,dword ptr [ebp+20]
mov eax,dword ptr [ebp-4]
mov dword ptr [ecx],eax
mov edx,dword ptr [ebp+24]
mov ecx,dword ptr [ebp-12]
mov dword ptr [edx],ecx
push 3
call _ClearBit
pop ecx
@20:
mov esp,ebp
pop ebp
ret
_ProgramBlock endp
_ProgramBlockCfg proc near
?live1@704:
push ebp
mov ebp,esp
add esp,-16
@21:
push 3
call _SetBit
pop ecx
push 3932166
call _SetTBLPTR
pop ecx
push 0
push 0
call _WriteDataAtTBLPTR
add esp,8
push 0
call _WriteOp
pop ecx
push 36518
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
push 36006
call _WriteData
pop ecx
xor eax,eax
mov dword ptr [ebp-12],eax
push dword ptr [ebp+8]
call _SetTBLPTR
pop ecx
xor edx,edx
mov dword ptr [ebp-4],edx
mov ecx,dword ptr [ebp-4]
mov eax,dword ptr [ebp+16]
cmp ecx,eax
jae @23
@22:
mov edx,dword ptr [ebp+12]
mov cx,word ptr [edx]
mov word ptr [ebp-14],cx
xor eax,eax
mov dword ptr [ebp-8],eax
jmp short @25
@24:
push 1
mov dx,word ptr [ebp-14]
push edx
call _WriteDataAtTBLPTR
add esp,8
inc dword ptr [ebp-4]
add dword ptr [ebp+12],2
inc dword ptr [ebp-12]
mov ecx,dword ptr [ebp+12]
mov ax,word ptr [ecx]
mov word ptr [ebp-14],ax
inc dword ptr [ebp-8]
@25:
mov edx,dword ptr [ebp-8]
cmp edx,3
setb cl
and ecx,1
mov eax,dword ptr [ebp+16]
cmp eax,1
seta dl
and edx,1
and ecx,edx
jne short @24
push 3
mov cx,word ptr [ebp-14]
push ecx
call _WriteDataAtTBLPTR
add esp,8
push 0
call _WriteOpDelay
pop ecx
xor eax,eax
mov dword ptr [ebp-8],eax
jmp short @28
@27:
push 2
call _SetBit
pop ecx
inc dword ptr [ebp-8]
@28:
mov edx,dword ptr [ebp-8]
mov ecx,dword ptr [_delay_IO]
cmp edx,ecx
jb short @27
push 2
call _ClearBit
pop ecx
push 0
call _WriteData
pop ecx
push 1
push 0
call _WriteDataAtTBLPTR
add esp,8
add dword ptr [ebp+12],2
inc dword ptr [ebp-12]
inc dword ptr [ebp-4]
mov eax,dword ptr [ebp-4]
mov edx,dword ptr [ebp+16]
cmp eax,edx
jb @22
@23:
mov ecx,dword ptr [ebp+20]
mov eax,dword ptr [ebp-4]
mov dword ptr [ecx],eax
mov edx,dword ptr [ebp+24]
mov ecx,dword ptr [ebp-12]
mov dword ptr [edx],ecx
push 3
call _ClearBit
pop ecx
@31:
mov esp,ebp
pop ebp
ret
_ProgramBlockCfg endp
_ReadBlock proc near
?live1@1200:
push ebp
mov ebp,esp
add esp,-12
@32:
push 3
call _SetBit
pop ecx
push dword ptr [ebp+8]
call _SetTBLPTR
pop ecx
xor eax,eax
mov dword ptr [ebp-4],eax
mov edx,dword ptr [ebp-4]
mov ecx,dword ptr [ebp+16]
cmp edx,ecx
jae short @34
@33:
push 1
lea eax,dword ptr [ebp-10]
push eax
call _ReadDataAtTBLPTR
add esp,8
push 1
lea edx,dword ptr [ebp-9]
push edx
call _ReadDataAtTBLPTR
add esp,8
xor ecx,ecx
mov cl,byte ptr [ebp-10]
xor eax,eax
mov al,byte ptr [ebp-9]
shl eax,8
add cx,ax
mov word ptr [ebp-12],cx
mov edx,dword ptr [ebp+12]
mov cx,word ptr [ebp-12]
mov word ptr [edx],cx
add dword ptr [ebp+12],2
xor eax,eax
mov dword ptr [ebp-8],eax
jmp short @36
@35:
push 2
call _ClearBit
pop ecx
inc dword ptr [ebp-8]
@36:
mov edx,dword ptr [ebp-8]
mov ecx,dword ptr [_delay_IO]
cmp edx,ecx
jb short @35
inc dword ptr [ebp-4]
mov eax,dword ptr [ebp-4]
mov edx,dword ptr [ebp+16]
cmp eax,edx
jb short @33
@34:
push 3
call _ClearBit
pop ecx
@39:
mov esp,ebp
pop ebp
ret
_ReadBlock endp
_BulkErase proc near
?live1@1408:
push ebp
mov ebp,esp
push ecx
@40:
push 3
call _SetBit
pop ecx
push 3932164
call _SetTBLPTR
pop ecx
push 0
push 131
call _WriteDataAtTBLPTR
add esp,8
push 0
call _WriteOp
pop ecx
push 0
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
xor eax,eax
mov dword ptr [ebp-4],eax
@41:
push 2
call _ClearBit
pop ecx
inc dword ptr [ebp-4]
mov edx,dword ptr [ebp-4]
cmp edx,5000
jb short @41
push 0
call _WriteData
pop ecx
push 3
call _ClearBit
pop ecx
push 3
call _SetBit
pop ecx
push 3932164
call _SetTBLPTR
pop ecx
push 0
push 128
call _WriteDataAtTBLPTR
add esp,8
push 0
call _WriteOp
pop ecx
push 0
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
xor ecx,ecx
mov dword ptr [ebp-4],ecx
@44:
push 2
call _ClearBit
pop ecx
inc dword ptr [ebp-4]
mov eax,dword ptr [ebp-4]
cmp eax,5000
jb short @44
push 0
call _WriteData
pop ecx
push 3
call _ClearBit
pop ecx
@48:
@47:
pop ecx
pop ebp
ret
_BulkErase endp
_SetTBLPTR proc near
?live1@1776:
push ebp
mov ebp,esp
push ecx
@49:
mov al,byte ptr [ebp+8]
and al,-1
mov byte ptr [ebp-1],al
mov edx,dword ptr [ebp+8]
shr edx,8
and dl,-1
mov byte ptr [ebp-2],dl
mov ecx,dword ptr [ebp+8]
shr ecx,16
and cl,-1
mov byte ptr [ebp-3],cl
push 0
call _WriteOp
pop ecx
xor eax,eax
mov al,byte ptr [ebp-1]
add ax,3584
push eax
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
push 28406
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
xor edx,edx
mov dl,byte ptr [ebp-2]
add dx,3584
push edx
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
push 28407
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
xor ecx,ecx
mov cl,byte ptr [ebp-3]
add cx,3584
push ecx
call _WriteData
pop ecx
push 0
call _WriteOp
pop ecx
push 28408
call _WriteData
pop ecx
@50:
pop ecx
pop ebp
ret
_SetTBLPTR endp
_WriteDataAtTBLPTR proc near
?live1@2048:
push ebp
mov ebp,esp
@51:
mov al,byte ptr [ebp+12]
sub al,1
jb short @57
je short @56
dec al
je short @55
dec al
je short @54
jmp short @58
@57:
push 12
call _WriteOp
pop ecx
jmp short @58
@56:
push 13
call _WriteOp
pop ecx
jmp short @58
@55:
push 14
call _WriteOp
pop ecx
jmp short @58
@54:
push 15
call _WriteOp
pop ecx
@58:
mov dx,word ptr [ebp+8]
push edx
call _WriteData
pop ecx
@59:
pop ebp
ret
_WriteDataAtTBLPTR endp
_ReadDataAtTBLPTR proc near
?live1@2256:
push ebp
mov ebp,esp
@60:
mov al,byte ptr [ebp+12]
sub al,1
jb short @66
je short @65
dec al
je short @64
dec al
je short @63
jmp short @67
@66:
push 8
call _WriteOp
pop ecx
jmp short @67
@65:
push 9
call _WriteOp
pop ecx
jmp short @67
@64:
push 10
call _WriteOp
pop ecx
jmp short @67
@63:
push 11
call _WriteOp
pop ecx
@67:
call _ReadData
mov edx,dword ptr [ebp+8]
mov byte ptr [edx],al
@68:
pop ebp
ret
_ReadDataAtTBLPTR endp
_WriteOp proc near
?live1@2464:
push ebp
mov ebp,esp
push ecx
@69:
mov byte ptr [ebp-1],0
@70:
mov cl,byte ptr [ebp-1]
xor eax,eax
mov al,byte ptr [ebp+8]
sar eax,cl
and al,1
push eax
call _WriteRB6_RB7
pop ecx
inc byte ptr [ebp-1]
mov dl,byte ptr [ebp-1]
cmp dl,4
jb short @70
@73:
pop ecx
pop ebp
ret
_WriteOp endp
_WriteOpDelay proc near
?live1@2528:
push ebp
mov ebp,esp
push ecx
@74:
mov byte ptr [ebp-1],0
@75:
mov cl,byte ptr [ebp-1]
xor eax,eax
mov al,byte ptr [ebp+8]
sar eax,cl
and al,1
push eax
call _WriteRB6_RB7
pop ecx
inc byte ptr [ebp-1]
mov dl,byte ptr [ebp-1]
cmp dl,3
jb short @75
xor eax,eax
mov al,byte ptr [ebp+8]
sar eax,4
and al,1
push eax
call _WriteRB6_RB7Delay
pop ecx
@78:
pop ecx
pop ebp
ret
_WriteOpDelay endp
_WriteData proc near
?live1@2608:
push ebp
mov ebp,esp
push ecx
@79:
mov byte ptr [ebp-1],0
@80:
mov cl,byte ptr [ebp-1]
movzx eax,word ptr [ebp+8]
sar eax,cl
and al,1
push eax
call _WriteRB6_RB7
pop ecx
inc byte ptr [ebp-1]
mov dl,byte ptr [ebp-1]
cmp dl,16
jb short @80
@83:
pop ecx
pop ebp
ret
_WriteData endp
_ReadData proc near
?live1@2672:
push ebp
mov ebp,esp
push ecx
@84:
mov byte ptr [ebp-2],0
mov byte ptr [ebp-1],0
@85:
mov cl,byte ptr [ebp-1]
xor eax,eax
mov al,byte ptr [ebp-2]
sar eax,cl
and al,1
push eax
call _WriteRB6_RB7
pop ecx
inc byte ptr [ebp-1]
mov dl,byte ptr [ebp-1]
cmp dl,8
jb short @85
push 1
call _SetBit
pop ecx
mov byte ptr [ebp-1],0
@88:
push 0
call _ReadBit
pop ecx
mov byte ptr [ebp-3],al
mov cl,byte ptr [ebp-1]
mov al,1
mov dl,byte ptr [ebp-3]
test dl,dl
jne short @91
dec eax
@91:
shl al,cl
or byte ptr [ebp-2],al
inc byte ptr [ebp-1]
mov al,byte ptr [ebp-1]
cmp al,8
jb short @88
push 1
call _ClearBit
pop ecx
mov al,byte ptr [ebp-2]
@94:
@93:
pop ecx
pop ebp
ret
_ReadData endp
_ReadBit proc near
?live1@2848:
push ebp
mov ebp,esp
add esp,-12
@95:
mov al,byte ptr [ebp+8]
push eax
lea edx,dword ptr [ebp-12]
push edx
call _SelectBit
add esp,8
xor ecx,ecx
mov dword ptr [ebp-8],ecx
jmp short @97
@96:
push 2
call _SetBit
pop ecx
@98:
inc dword ptr [ebp-8]
@97:
mov eax,dword ptr [ebp-8]
mov edx,dword ptr [_delay_Prog]
cmp eax,edx
jb short @96
xor ecx,ecx
mov dword ptr [ebp-8],ecx
jmp short @100
@99:
push 2
call _ClearBit
pop ecx
@101:
inc dword ptr [ebp-8]
@100:
mov eax,dword ptr [ebp-8]
mov edx,dword ptr [_delay_Prog]
cmp eax,edx
jb short @99
mov dx, _LPT_adr_in
in al, dx
mov byte ptr [ebp-1], al
mov ecx,dword ptr [ebp-12]
test byte ptr [ecx+2],16
je short @102
mov al,byte ptr [ebp-1]
not al
mov edx,dword ptr [ebp-12]
mov cl,byte ptr [edx+1]
and al,cl
mov byte ptr [ebp-1],al
jmp short @103
@102:
mov eax,dword ptr [ebp-12]
mov dl,byte ptr [eax+1]
and byte ptr [ebp-1],dl
@103:
mov al,byte ptr [ebp-1]
@105:
@104:
mov esp,ebp
pop ebp
ret
_ReadBit endp
_WriteRB6_RB7 proc near
?live1@3040:
push ebp
mov ebp,esp
push ecx
@106:
xor eax,eax
mov dword ptr [ebp-4],eax
jmp short @108
@107:
push 2
call _SetBit
pop ecx
inc dword ptr [ebp-4]
@108:
mov edx,dword ptr [ebp-4]
mov ecx,dword ptr [_delay_Prog]
cmp edx,ecx
jb short @107
xor eax,eax
mov dword ptr [ebp-4],eax
jmp short @111
@110:
test byte ptr [ebp+8],1
je short @112
push 1
call _SetBit
pop ecx
jmp short @113
@112:
push 1
call _ClearBit
pop ecx
@113:
inc dword ptr [ebp-4]
@111:
mov edx,dword ptr [ebp-4]
mov ecx,dword ptr [_delay_Prog]
cmp edx,ecx
jb short @110
xor eax,eax
mov dword ptr [ebp-4],eax
jmp short @116
@115:
push 2
call _ClearBit
pop ecx
inc dword ptr [ebp-4]
@116:
mov edx,dword ptr [ebp-4]
mov ecx,dword ptr [_delay_Prog]
cmp edx,ecx
jb short @115
xor eax,eax
mov dword ptr [ebp-4],eax
jmp short @119
@118:
push 1
call _ClearBit
pop ecx
inc dword ptr [ebp-4]
@119:
mov edx,dword ptr [ebp-4]
mov ecx,dword ptr [_delay_Prog]
cmp edx,ecx
jb short @118
@121:
pop ecx
pop ebp
ret
_WriteRB6_RB7 endp
_WriteRB6_RB7Delay proc near
?live1@3200:
push ebp
mov ebp,esp
@122:
push 2
call _SetBit
pop ecx
test byte ptr [ebp+8],1
je short @123
push 1
call _SetBit
pop ecx
@126:
pop ebp
ret
@123:
push 1
call _ClearBit
pop ecx
@124:
@125:
pop ebp
ret
_WriteRB6_RB7Delay endp
_SetBit proc near
?live1@3264:
push ebp
mov ebp,esp
push ecx
@127:
mov al,byte ptr [ebp+8]
push eax
lea edx,dword ptr [ebp-4]
push edx
call _SelectBit
add esp,8
mov ecx,dword ptr [ebp-4]
test byte ptr [ecx+2],16
je short @128
mov eax,dword ptr [ebp-4]
mov dl,byte ptr [eax+1]
not dl
and byte ptr [_data_bus],dl
jmp short @129
@128:
mov ecx,dword ptr [ebp-4]
mov al,byte ptr [ecx+1]
or byte ptr [_data_bus],al
@129:
mov dx, 0378H
mov al, _data_bus
out dx, al
@130:
pop ecx
pop ebp
ret
_SetBit endp
_ClearBit proc near
?live1@3376:
push ebp
mov ebp,esp
push ecx
@131:
mov al,byte ptr [ebp+8]
push eax
lea edx,dword ptr [ebp-4]
push edx
call _SelectBit
add esp,8
mov ecx,dword ptr [ebp-4]
test byte ptr [ecx+2],16
je short @132
mov eax,dword ptr [ebp-4]
mov dl,byte ptr [eax+1]
or byte ptr [_data_bus],dl
jmp short @133
@132:
mov ecx,dword ptr [ebp-4]
mov al,byte ptr [ecx+1]
not al
and byte ptr [_data_bus],al
@133:
mov dx, 0378H
mov al, _data_bus
out dx, al
@134:
pop ecx
pop ebp
ret
_ClearBit endp
_ConfigBit proc near
?live1@3488:
push ebp
mov ebp,esp
push ecx
@135:
mov al,byte ptr [ebp+8]
push eax
lea edx,dword ptr [ebp-4]
push edx
call _SelectBit
add esp,8
mov cl,byte ptr [ebp+12]
test cl,cl
je short @136
mov eax,dword ptr [ebp-4]
mov dl,byte ptr [ebp+12]
mov byte ptr [eax+1],dl
@136:
mov ecx,dword ptr [ebp-4]
mov al,byte ptr [ebp+16]
mov byte ptr [ecx+2],al
@137:
pop ecx
pop ebp
ret
_ConfigBit endp
_SelectBit proc near
?live1@3584:
push ebp
mov ebp,esp
@138:
movsx eax,byte ptr [ebp+12]
cmp eax,4
ja short @139
jmp dword ptr [@146+4*eax]
@146:
dd @145
dd @144
dd @143
dd @142
dd @141
@144:
mov edx,dword ptr [ebp+8]
mov dword ptr [edx],offset _DATA_TO_PIC
@149:
pop ebp
ret
@145:
mov ecx,dword ptr [ebp+8]
mov dword ptr [ecx],offset _DATA_FROM_PIC
@150:
pop ebp
ret
@143:
mov eax,dword ptr [ebp+8]
mov dword ptr [eax],offset _CLOCK
@151:
pop ebp
ret
@142:
mov edx,dword ptr [ebp+8]
mov dword ptr [edx],offset _MCLR_VPP
@152:
pop ebp
ret
@141:
mov ecx,dword ptr [ebp+8]
mov dword ptr [ecx],offset _VCC_ON
@139:
@147:
@148:
pop ebp
ret
_SelectBit endp
_GetMask proc near
?live1@3792:
push ebp
mov ebp,esp
push ecx
@153:
mov al,byte ptr [ebp+8]
push eax
lea edx,dword ptr [ebp-4]
push edx
call _SelectBit
add esp,8
mov ecx,dword ptr [ebp-4]
mov al,byte ptr [ecx+1]
@155:
@154:
pop ecx
pop ebp
ret
_GetMask endp
_GetStatus proc near
?live1@3856:
push ebp
mov ebp,esp
push ecx
@156:
mov al,byte ptr [ebp+8]
push eax
lea edx,dword ptr [ebp-4]
push edx
call _SelectBit
add esp,8
mov ecx,dword ptr [ebp-4]
mov al,byte ptr [ecx+2]
@158:
@157:
pop ecx
pop ebp
ret
_GetStatus endp
_TEXT ends
_BSS segment dword public use32 'BSS'
_data_bus label byte
db 1 dup(?)
_BSS ends
_TEXT segment dword public use32 'CODE'
_TEXT ends
public _CLOCK
public _DATA_TO_PIC
public _DATA_FROM_PIC
public _MCLR_VPP
public _VCC_ON
public _data_bus
public _LPT_adr_out
public _LPT_adr_in
public _delay_IO
public _delay_Prog
public __InitHardware
public _ClearBit
public __PowerOn
public _SetBit
public __PowerOff
public _ProgramBlock
public _ProgramBlockCfg
public _ReadBlock
public _BulkErase
public _ReadBit
public _ConfigBit
public _GetMask
public _GetStatus
?debug D "C:\Dveloppement\PP18_v2\dll\PIC18F452\DRIVER.H" 12098 46123
?debug D "C:\Dveloppement\PP18_v2\dll\PIC18F452\driver.c" 12098 46120
end