<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=C%2FAssembly%2FMain</id>
	<title>C/Assembly/Main - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=C%2FAssembly%2FMain"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=C/Assembly/Main&amp;action=history"/>
	<updated>2026-05-15T12:12:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=C/Assembly/Main&amp;diff=29999&amp;oldid=prev</id>
		<title>imported&gt;Unknown at 05:22, 7 February 2021</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=C/Assembly/Main&amp;diff=29999&amp;oldid=prev"/>
		<updated>2021-02-07T05:22:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;우선 기억 하는 것 복습.&lt;br /&gt;
&lt;br /&gt;
 int main(){ return; }&lt;br /&gt;
 &lt;br /&gt;
 .globl main&lt;br /&gt;
         .type   main, @function&lt;br /&gt;
 main:&lt;br /&gt;
         pushl   %ebp            // 현재의 명령어 Counter를 Stack에 저장함. 이 프로그램이 끝나면 stack에서 다시 꺼냄.&lt;br /&gt;
         movl    %esp, %ebp&lt;br /&gt;
         subl    $8, %esp        // 빈 스택 할당&lt;br /&gt;
         andl    $-16, %esp&lt;br /&gt;
 &lt;br /&gt;
         movl    $0, %eax        // eax = 0&lt;br /&gt;
         addl    $15, %eax       // eax = 15&lt;br /&gt;
         addl    $15, %eax       // eax = 15  11110(Bin)&lt;br /&gt;
         shrl    $4, %eax        // eax = 0xF0000001   11110000000000000000000000000001(bin)&lt;br /&gt;
         sall    $4, %eax        // eax = 0x1F         00000000000000000000000000011111(bin)&lt;br /&gt;
 &lt;br /&gt;
         subl    %eax, %esp&lt;br /&gt;
 &lt;br /&gt;
         movl    $0, %eax        // return 0;&lt;br /&gt;
         leave                   // 프로그램의 종료. stack에서 프로그램 시작 전의 명령어를 꺼내 %ebp에 집어 넣는 역할.&lt;br /&gt;
         ret                     // 프로그램이 종료.&lt;br /&gt;
&lt;br /&gt;
push - ret&lt;br /&gt;
Windows OS가 아닌 DOS OS는 메모리의 관리를 Kernel(OS의 Core)이 아닌 Program에서 해주게 된다.&lt;br /&gt;
따라서 프로그램이 시작하고 나갈때에는 어디서 프로그램을 시작하고 끝냈는지 위치를 저장(push)하고 꼭 반환(leave)해야한다.&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>imported&gt;Unknown</name></author>
	</entry>
</feed>