Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Дарья Бондаренко
assignment-1-io-library
Commits
97cfdeb9
Commit
97cfdeb9
authored
4 months ago
by
Дарья Бондаренко
Browse files
Options
Download
Email Patches
Plain Diff
Update lib.asm
parent
9c249075
master
No related merge requests found
Pipeline
#98449
passed with stage
in 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
17 deletions
+10
-17
lib.asm
lib.asm
+10
-17
No files found.
lib.asm
View file @
97cfdeb9
...
...
@@ -27,7 +27,6 @@ string_length:
; Принимает указатель на нуль-терминированную строку, выводит её в stdout
print_string:
xor
rax
,
rax
push
rdi
call
string_length
pop
rdi
...
...
@@ -40,7 +39,6 @@ print_string:
; Принимает код символа и выводит его в stdout
print_char:
xor
rax
,
rax
push
rdi
mov
rdi
,
rsp
call
print_string
...
...
@@ -49,8 +47,7 @@ print_char:
; Переводит строку (выводит символ с кодом 0xA)
print_newline:
xor
rax
,
rax
mov
rdi
,
0xA
mov
rdi
,
'\
n
'
jmp
print_char
...
...
@@ -98,10 +95,7 @@ print_int:
pop
rdi
.plus:
push
rdi
call
print_uint
pop
rdi
ret
jmp
print_uint
; Принимает два указателя на нуль-терминированные строки, возвращает 1 если они равны, 0 иначе
string_equals:
...
...
@@ -132,7 +126,6 @@ string_equals:
; Читает один символ из stdin и возвращает его. Возвращает 0 если достигнут конец потока
read_char:
xor
rax
,
rax
push
0
xor
rax
,
rax
xor
rdi
,
rdi
...
...
@@ -159,11 +152,11 @@ read_word:
.ch_whitespace:
call
read_char
cmp
rax
,
0x20
cmp
rax
,
' '
je
.ch_whitespace
cmp
rax
,
0x9
cmp
rax
,
`\
t
`
je .ch_whitespace
cmp
rax
,
0xA
cmp rax,
`
\
n
`
je
.ch_whitespace
pop
r11
pop
r10
...
...
@@ -172,11 +165,11 @@ read_word:
.loop_word:
test
rax
,
rax
jz
.end_word
cmp
rax
,
0x20
cmp
rax
,
' '
je
.end_word
cmp
rax
,
0x9
cmp
rax
,
`\
t
`
je
.end_word
cmp
rax
,
0xA
cmp
rax
,
`\
n
`
je
.end_word
dec
r11
...
...
@@ -227,9 +220,9 @@ parse_uint:
jmp
.stop_parse
.ch_number:
cmp
cl
,
0x30
cmp
cl
,
'0'
jl
.stop_parse
cmp
cl
,
0x39
cmp
cl
,
'9'
jg
.stop_parse
sub
cl
,
'0'
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help