Skip to content

Commit 0181e77

Browse files
committed
Addng episode 12
1 parent 0e57e51 commit 0181e77

File tree

4 files changed

+148
-0
lines changed

4 files changed

+148
-0
lines changed

Diff for: Assembly64.sln

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Episode_11", "Episode_11",
4949
EndProject
5050
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Disassembly", "Episode11\Disassembly\Disassembly.vcxproj", "{E303115F-3605-4683-A43D-57D46D553F27}"
5151
EndProject
52+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Episode_12", "Episode_12", "{10BB7B6A-C1ED-49E8-8222-2D3943458912}"
53+
EndProject
54+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Scanf", "Episode12\Scanf\Scanf.vcxproj", "{840F8D30-4C17-4596-890B-0CD8281307E4}"
55+
EndProject
5256
Global
5357
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5458
Debug|x64 = Debug|x64
@@ -103,6 +107,10 @@ Global
103107
{E303115F-3605-4683-A43D-57D46D553F27}.Debug|x64.Build.0 = Debug|x64
104108
{E303115F-3605-4683-A43D-57D46D553F27}.Release|x64.ActiveCfg = Release|x64
105109
{E303115F-3605-4683-A43D-57D46D553F27}.Release|x64.Build.0 = Release|x64
110+
{840F8D30-4C17-4596-890B-0CD8281307E4}.Debug|x64.ActiveCfg = Debug|x64
111+
{840F8D30-4C17-4596-890B-0CD8281307E4}.Debug|x64.Build.0 = Debug|x64
112+
{840F8D30-4C17-4596-890B-0CD8281307E4}.Release|x64.ActiveCfg = Release|x64
113+
{840F8D30-4C17-4596-890B-0CD8281307E4}.Release|x64.Build.0 = Release|x64
106114
EndGlobalSection
107115
GlobalSection(SolutionProperties) = preSolution
108116
HideSolutionNode = FALSE

Diff for: Episode12/Scanf/Scanf.vcxproj

+84
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>{840f8d30-4c17-4596-890b-0cd8281307e4}</ProjectGuid>
17+
<RootNamespace>Scanf</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>

Diff for: Episode12/Scanf/Scanf.vcxproj.filters

+6
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: Episode12/Scanf/main.asm

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
includelib ucrt.lib
2+
includelib legacy_stdio_definitions.lib
3+
4+
EXTERN scanf: PROC
5+
6+
7+
.DATA
8+
integerFmtString DB "%d", 0 ; Scanf input format string (%d reads an integer value)
9+
stringFmtString DB "%16s", 0 ; Scanf input format string (%s reads a string)
10+
integerValue DQ 0 ; Scanf output integer value is stored here
11+
stringValue DB 17 DUP(0) ; Scanf output buffer (duplicate 17 bytes of value 0)
12+
13+
14+
.CODE
15+
16+
main PROC
17+
18+
call scanfInteger
19+
call scanfString
20+
21+
mov rax, 0
22+
ret
23+
main ENDP
24+
25+
26+
scanfInteger PROC
27+
sub rsp, 20h ; Allocate stack space for function arguments
28+
29+
lea rcx, integerFmtString
30+
lea rdx, integerValue
31+
call scanf
32+
33+
add rsp, 20h ; Restore the stack
34+
ret
35+
scanfInteger ENDP
36+
37+
38+
scanfString PROC
39+
sub rsp, 20h ; Allocate stack space for function arguments
40+
41+
lea rcx, stringFmtString
42+
lea rdx, stringValue
43+
call scanf
44+
45+
add rsp, 20h ; Restore the stack
46+
ret
47+
scanfString ENDP
48+
49+
50+
END

0 commit comments

Comments
 (0)