Explorar el Código

start working through the pgu book.

it's quite interesting and surprisingly accessible.
Lucas Stadler %!s(int64=11) %!d(string=hace) años
padre
commit
d28ffab2c1
Se han modificado 3 ficheros con 49 adiciones y 0 borrados
  1. 9 0
      pgu/01_arch/README.md
  2. 11 0
      pgu/01_arch/exit.s
  3. 29 0
      pgu/01_arch/maximum.s

+ 9 - 0
pgu/01_arch/README.md

@ -0,0 +1,9 @@
1
# Programming from the ground up
2
3
Despite knowing about basic cpu architecture I have never actually
4
written any "real" assembler program. Here I aim to fix that. I
5
currently use the [Programming from the ground up][pgu-book] book, but
6
if you know anything similar that has helped you understand how a
7
computer works at the levels below C, please tell me.
8
9
[pgu-book]: http://www.cs.princeton.edu/courses/archive/spr08/cos217/reading/ProgrammingGroundUp-1-0-lettersize.pdf

+ 11 - 0
pgu/01_arch/exit.s

@ -0,0 +1,11 @@
1
.section .data
2
3
.section .text
4
.globl _start
5
6
_start:
7
	movl $1, %eax
8
9
	movl $0, %ebx
10
11
	int $0x80

+ 29 - 0
pgu/01_arch/maximum.s

@ -0,0 +1,29 @@
1
.section .data
2
3
numbers:
4
	.long 3,67,34,222,65,45,75,54,34,44,33,22,11,66,0
5
6
.section .text
7
.globl _start
8
9
_start:
10
	movl $0, %edi
11
	movl numbers(,%edi,4), %eax
12
	movl %eax, %ebx
13
14
loop_start:
15
	cmpl $0, %eax
16
	je loop_exit
17
18
	incl %edi
19
	movl numbers(,%edi,4), %eax
20
21
	cmpl %ebx, %eax
22
	jle loop_start
23
24
	movl %eax, %ebx
25
	jmp loop_start
26
27
loop_exit:
28
	movl $1, %eax
29
	int $0x80