-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBITFORG.ASM
59 lines (45 loc) · 1.32 KB
/
BITFORG.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;ÚÄÄÄÄÄÄÄÄÄÄÄ¿
;³ BITFORGAT ³ nyomtat¢ fggoleges tminta el” ll¡t sa v¡zszintes mint b¢l
;ÀÄÄÄÄÄÄÄÄÄÄÄÙ
; BITSOR = ARRAY[0..7] of BYTE
; minden input byte els” bitje az els” output byte-ba kerl
; fentr”l lefel‚, ha irany = true
; lentrol felfele, ha irany = false
;
; procedure BITFORGAT(var EZT:BITSOR, ERRE:BITSOR, IRANY:boolean); external;
public BITFORGAT
.model tpascal
.code
BITFORGAT proc near EZT:dword, ERRE:dword, IRANY:byte
cld ; felfele novelni stosb utan!
push ds
lds si,EZT ; 1. tomb cime
les di,ERRE ; 2. tomb cime
mov cx,8 ; kulso hurok
kulsohur:
push cx
xor bx,bx ; cimzes eltolas: 0
cmp IRANY,1 ; merre kell tolni?
je belsohur2
belsohur1:
shl byte ptr ds:[si+bx],1 ; eggyel balra
rcr al,1
inc bx
cmp bl,7 ; ez az utso
jbe belsohur1 ; belso hurok
stosb ; elrak al-t es:[di]-be, INC DI
jmp nextkulso
belsohur2:
shl byte ptr ds:[si+bx],1 ; eggyel balra
rcl al,1
inc bx
cmp bl,7 ; ez az utso
jbe belsohur2 ; belso hurok
stosb ; elrak al-t es:[di]-be, INC DI
nextkulso:
pop cx
loop kulsohur
pop ds
ret
BITFORGAT endp
end