Skip to content

Commit 4229e23

Browse files
committed
adding episode 13
1 parent 0181e77 commit 4229e23

File tree

4 files changed

+149
-0
lines changed

4 files changed

+149
-0
lines changed

Diff for: Assembly64.sln

+10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Episode_12", "Episode_12",
5353
EndProject
5454
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Scanf", "Episode12\Scanf\Scanf.vcxproj", "{840F8D30-4C17-4596-890B-0CD8281307E4}"
5555
EndProject
56+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Episode_13", "Episode_13", "{7C5C8E6E-462B-48F4-9D85-F162F59FD5CF}"
57+
EndProject
58+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BitwiseLogicalInstructions", "Episode13\BitwiseLogicalInstructions\BitwiseLogicalInstructions.vcxproj", "{4F3265E2-67C5-4967-B8FA-1571762A8294}"
59+
EndProject
5660
Global
5761
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5862
Debug|x64 = Debug|x64
@@ -111,6 +115,10 @@ Global
111115
{840F8D30-4C17-4596-890B-0CD8281307E4}.Debug|x64.Build.0 = Debug|x64
112116
{840F8D30-4C17-4596-890B-0CD8281307E4}.Release|x64.ActiveCfg = Release|x64
113117
{840F8D30-4C17-4596-890B-0CD8281307E4}.Release|x64.Build.0 = Release|x64
118+
{4F3265E2-67C5-4967-B8FA-1571762A8294}.Debug|x64.ActiveCfg = Debug|x64
119+
{4F3265E2-67C5-4967-B8FA-1571762A8294}.Debug|x64.Build.0 = Debug|x64
120+
{4F3265E2-67C5-4967-B8FA-1571762A8294}.Release|x64.ActiveCfg = Release|x64
121+
{4F3265E2-67C5-4967-B8FA-1571762A8294}.Release|x64.Build.0 = Release|x64
114122
EndGlobalSection
115123
GlobalSection(SolutionProperties) = preSolution
116124
HideSolutionNode = FALSE
@@ -128,6 +136,8 @@ Global
128136
{9D66960B-9A65-4EBC-A634-54069B572D11} = {C2B7084E-0A4D-415C-B798-6AF9D358861C}
129137
{B21A457E-3E5C-4E42-9AFB-538781AD9F39} = {FB0B381C-979C-4651-AE85-A2E92A6579CB}
130138
{E303115F-3605-4683-A43D-57D46D553F27} = {65103D72-F115-49D4-BEAD-F0481A7C80E3}
139+
{840F8D30-4C17-4596-890B-0CD8281307E4} = {10BB7B6A-C1ED-49E8-8222-2D3943458912}
140+
{4F3265E2-67C5-4967-B8FA-1571762A8294} = {7C5C8E6E-462B-48F4-9D85-F162F59FD5CF}
131141
EndGlobalSection
132142
GlobalSection(ExtensibilityGlobals) = postSolution
133143
SolutionGuid = {74B06FA8-487D-4545-8B72-13DF56D10686}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|x64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>x64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|x64">
9+
<Configuration>Release</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<VCProjectVersion>16.0</VCProjectVersion>
15+
<Keyword>Win32Proj</Keyword>
16+
<ProjectGuid>{4f3265e2-67c5-4967-b8fa-1571762a8294}</ProjectGuid>
17+
<RootNamespace>BitwiseLogicalInstructions</RootNamespace>
18+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
19+
</PropertyGroup>
20+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
21+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
22+
<ConfigurationType>Application</ConfigurationType>
23+
<UseDebugLibraries>true</UseDebugLibraries>
24+
<PlatformToolset>v143</PlatformToolset>
25+
<CharacterSet>Unicode</CharacterSet>
26+
</PropertyGroup>
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
28+
<ConfigurationType>Application</ConfigurationType>
29+
<UseDebugLibraries>false</UseDebugLibraries>
30+
<PlatformToolset>v143</PlatformToolset>
31+
<WholeProgramOptimization>true</WholeProgramOptimization>
32+
<CharacterSet>Unicode</CharacterSet>
33+
</PropertyGroup>
34+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
35+
<ImportGroup Label="ExtensionSettings">
36+
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
37+
</ImportGroup>
38+
<ImportGroup Label="Shared">
39+
</ImportGroup>
40+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
41+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
42+
</ImportGroup>
43+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
44+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
45+
</ImportGroup>
46+
<PropertyGroup Label="UserMacros" />
47+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
48+
<ClCompile>
49+
<WarningLevel>Level3</WarningLevel>
50+
<SDLCheck>true</SDLCheck>
51+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
52+
<ConformanceMode>true</ConformanceMode>
53+
</ClCompile>
54+
<Link>
55+
<SubSystem>Console</SubSystem>
56+
<GenerateDebugInformation>true</GenerateDebugInformation>
57+
<EntryPointSymbol>main</EntryPointSymbol>
58+
</Link>
59+
</ItemDefinitionGroup>
60+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
61+
<ClCompile>
62+
<WarningLevel>Level3</WarningLevel>
63+
<FunctionLevelLinking>true</FunctionLevelLinking>
64+
<IntrinsicFunctions>true</IntrinsicFunctions>
65+
<SDLCheck>true</SDLCheck>
66+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
67+
<ConformanceMode>true</ConformanceMode>
68+
</ClCompile>
69+
<Link>
70+
<SubSystem>Console</SubSystem>
71+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
72+
<OptimizeReferences>true</OptimizeReferences>
73+
<GenerateDebugInformation>true</GenerateDebugInformation>
74+
<EntryPointSymbol>main</EntryPointSymbol>
75+
</Link>
76+
</ItemDefinitionGroup>
77+
<ItemGroup>
78+
<MASM Include="main.asm" />
79+
</ItemGroup>
80+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
81+
<ImportGroup Label="ExtensionTargets">
82+
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
83+
</ImportGroup>
84+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<MASM Include="main.asm" />
5+
</ItemGroup>
6+
</Project>

Diff for: Episode13/BitwiseLogicalInstructions/main.asm

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
.CODE
3+
main PROC
4+
5+
6+
; Bitwise AND &
7+
mov rcx, 0FFFFh ; CX = 1111 1111 1111 1111
8+
mov rdx, 5757h ; DX = 0101 0111 0101 0111
9+
and cx, dx ; CX = 0101 0111 0101 0111
10+
and cx, 3333h ; 0011 0011 0011 0011 (3333h)
11+
; CX = 0001 0011 0001 0011 (1313h)
12+
13+
; Bitwise OR |
14+
mov rcx, 4444h ; CX = 0100 0100 0100 0100
15+
mov rdx, 6767h ; DX = 0110 0111 0110 0111
16+
or cx, dx ; CX = 0110 0111 0110 0111
17+
or cx, 9999h ; 1001 1001 1001 1001 (9999h)
18+
; CX = 1111 1111 1111 1111 (FFFFh)
19+
20+
; Bitwise XOR ^
21+
mov rcx, 7777h ; CX = 0111 0111 0111 0111
22+
mov rdx, 5555h ; DX = 0101 0101 0101 0101
23+
xor cx, dx ; CX = 0010 0010 0010 0010
24+
xor cx, 9999h ; 1001 1001 1001 1001 (9999h)
25+
; CX = 1011 1011 1011 1011 (BBBBh)
26+
27+
; Bitwise NOT ~
28+
mov rcx, 7352h ; CX = 0111 0011 1001 0010
29+
not cx ; CX = 1000 1100 0110 1101 (8CADh)
30+
31+
32+
; Using memory operands
33+
mov rax, 1111111111111111b
34+
and rax, QWORD PTR [dataA]
35+
and QWORD PTR [dataB], rax
36+
not QWORD PTR [dataB]
37+
38+
39+
xor rax, rax ; clear rax
40+
ret
41+
main ENDP
42+
43+
44+
.DATA
45+
dataA QWORD 7777777777777777h
46+
dataB QWORD 9999999999999999h
47+
48+
49+
END

0 commit comments

Comments
 (0)