summaryrefslogtreecommitdiff
path: root/PGU/CHAP10/convprog.s
blob: 49ac6fb510718ec77ca2ce0814d097f494883ea8 (plain)
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
.include "linux.s"

.section .data

tmp_buffer:
	.ascii "\0\0\0\0\0\0\0\0\0\0\0"

.section .text

.globl _start

_start:
	movq %rsp, %rbp

	pushq $tmp_buffer
	pushq $824
	call integer2string
	addq $16, %rsp

	pushq $tmp_buffer
	call count_chars
	addq $8, %rsp

	movq %rax, %rdx
	movq $STDOUT, %rdi
	movq $tmp_buffer, %rsi
	movq $SYS_WRITE, %rax
	syscall

	pushq $STDOUT
	call write_newline

	movq $SYS_EXIT, %rax
	movq $0, %rdi
	syscall