Форум программистов, компьютерный форум, киберфорум
Ubuntu, Mint Linux
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.80/15: Рейтинг темы: голосов - 15, средняя оценка - 4.80
0 / 0 / 0
Регистрация: 29.09.2012
Сообщений: 59

Как скомпилировать и запустить код ассемблера в терминале?

17.11.2013, 21:26. Показов 3110. Ответов 1
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
У меня есть код ассемблера. Как его скомпилить и запустить в терминале?
Есть файл с кодом и текстовый файл, который код обрабатывает, и выводит результат.
Вот код(файл формата .s)
Assembler
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
.data
.data
    cmd_cat: .string "/bin/cat"
    arg_cat: .string "log.txt"
    args_cat: .long cmd_cat, arg_cat, 0
 
    cmd_sort: .string "/usr/bin/sort"
    args_sort: .long cmd_sort, 0
    
    cmd_cut: .string "/usr/bin/cut"
    arg_cut: .string "-f"
    arg1_cut: .string "7,9"
    arg2_cut: .string "-d"
    arg3_cut: .string " "
    args_cut: .long cmd_cut, arg_cut, arg1_cut, arg2_cut, arg3_cut, 0
    
    cmd_grep: .string "/bin/grep"
    arg_grep: .string "40[0-9]"
    args_grep: .long cmd_grep, arg_grep, 0
 
    cmd_uniq: .string "/usr/bin/uniq"
    arg_uniq: .string "-c"
    args_uniq: .long cmd_uniq, arg_uniq, 0
 
    cmd_lsort: .string "/usr/bin/sort"
    arg1_lsort: .string "-n"
    arg2_lsort: .string "-r"
    args_lsort: .long cmd_lsort, arg1_lsort, arg2_lsort, 0
 
    cmd_head: .string "/usr/bin/head"
    args_head: .long cmd_head, 0
 
    cmd_awk: .string "/usr/bin/awk"
    arg_awk: .string "BEGIN{num=0;} {sum += $1; num=num+1; first[num]=$1; second[num]=$2; } END{for(i=1; i<=num;i++) {printf(\"%s. http:/%s - %d - %2.2f\",i, second[i], first[i], (first[i]/sum)*100); print \"%\"} }"
    args_awk: .long cmd_awk, arg_awk, 0
 
 
    fds:  .int 0, 0
    fds1: .int 0, 0
    fds2: .int 0, 0
    fds3: .int 0, 0
    fds4: .int 0, 0
    fds5: .int 0, 0
    fds6: .int 0, 0
 
 
.text
.globl _start
_start:
    pushq $fds1
    call pipe
    pushq $fds
    call pipe
    pushq $fds2
    call pipe
    pushq $fds3
    call pipe
    pushq $fds4
    call pipe
    pushq $fds5
    call pipe
    pushq $fds6
    call pipe
 
    call fork
    cmpl $0, %eax
    je child_cat
    call fork
    cmpl $0, %eax
    je child_grep
    call fork
    cmpl $0, %eax
    je child_cut
    call fork
    cmpl $0, %eax
    je child_sort
    call fork
    cmpl $0, %eax
    je child_uniq
    call fork
    cmpl $0, %eax
    je child_lsort
    call fork
    cmpl $0, %eax
    je child_head
    call fork
    cmpl $0, %eax
    je child_awk
    
 
    
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
 
 
    pushq $0
    call wait
    pushq $0
    call wait
    pushq $0
    call wait
    pushq $0
    call wait
    pushq $0
    call wait
    pushq $0
    call wait
    pushq $0
    call wait
    pushq $0
    call wait
 
finish:
    movl $1, %eax
    movl $0, %ebx
    int $0x80
child_cat:
    pushq $1
    movl $fds, %eax 
    pushq 4(%eax)
    call dup2
 
    
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
 
    pushq $0
    pushq $args_cat
    pushq $cmd_cat
    call execve
    call finish
 
child_grep:
    pushq $0
    movl $fds, %eax
    pushq (%eax)
    call dup2
    pushq $1
    movl $fds1, %eax
    pushq 4(%eax)
    call dup2
 
    
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
 
    pushq $0
    pushq $args_grep
    pushq $cmd_grep
    call execve
    call finish
 
child_cut:
    pushq $0
    movl $fds1, %eax
    pushq (%eax)
    call dup2
    pushq $1
    movl $fds2, %eax
    pushq 4(%eax)
    call dup2
    
 
 
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
    
 
    pushq $0
    pushq $args_cut
    pushq $cmd_cut
    call execve
    call finish
 
child_sort:
    pushq $0
    movl $fds2, %eax
    pushq (%eax)
    call dup2
    pushq $1
    movl $fds3, %eax
    pushq 4(%eax)
    call dup2
 
 
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
    
 
    pushq $0
    pushq $args_sort
    pushq $cmd_sort
    call execve
    call finish
 
child_uniq:
    pushq $0
    movl $fds3, %eax
    pushq (%eax)
    call dup2
    pushq $1
    movl $fds4, %eax
    pushq 4(%eax)
    call dup2
 
 
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
    
 
    pushq $0
    pushq $args_uniq
    pushq $cmd_uniq
    call execve
    call finish
 
child_lsort:
    pushq $0
    movl $fds4, %eax
    pushq (%eax)
    call dup2
    pushq $1
    movl $fds5, %eax
    pushq 4(%eax)
    call dup2
    
    
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
    
 
    pushq $0
    pushq $args_lsort
    pushq $cmd_lsort
    call execve
    call finish
 
child_head:
    pushq $0
    movl $fds5, %eax
    pushq (%eax)
    call dup2
    pushq $1
    movl $fds6, %eax
    pushq 4(%eax)
    call dup2
 
 
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
 
    pushq $0
    pushq $args_head
    pushq $cmd_head
    call execve
    call finish
 
child_awk:
    pushq $0
    movl $fds6, %eax
    pushq (%eax)
    call dup2
    
    
 
    movl $fds, %eax
    pushq 4(%eax)
    call close
    movl $fds, %eax
    pushq (%eax)
    call close
    movl $fds1, %eax
    pushq 4(%eax)
    call close
    movl $fds1, %eax
    pushq (%eax)
    call close
    movl $fds2, %eax
    pushq 4(%eax)
    call close
    movl $fds2, %eax
    pushq (%eax)
    call close
    movl $fds3, %eax
    pushq 4(%eax)
    call close
    movl $fds3, %eax
    pushq (%eax)
    call close
    movl $fds4, %eax
    pushq 4(%eax)
    call close
    movl $fds4, %eax
    pushq (%eax)
    call close
    movl $fds5, %eax
    pushq 4(%eax)
    call close
    movl $fds5, %eax
    pushq (%eax)
    call close
    movl $fds6, %eax
    pushq 4(%eax)
    call close
    movl $fds6, %eax
    pushq (%eax)
    call close
 
    pushq $0
    pushq $args_awk
    pushq $cmd_awk
    call execve
    call finish
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
17.11.2013, 21:26
Ответы с готовыми решениями:

Как запустить данный код ассемблера
Как или при помощи чего запустить данный код? пробовал с помощью TASM.EXE и TLINK.EXE пришет почти в каждой строке ошибка ;...

Не могу скомпилировать/запустить код в VSCode на Windows 10
При нажатии F5 в окне дебага выводит Error: LinkageError occurred while loading main class Hello ...

Есть один листинг программы который нужно запустить и скомпилировать!(код не мой).
Вообщем скачал с inet листинг программы на Delphi и как вы уже догадались не смог с ним разобраться, так как новичок в этом деле.созданием...

1
4866 / 3288 / 468
Регистрация: 10.12.2008
Сообщений: 10,570
18.11.2013, 00:27
попробуй as
1
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
18.11.2013, 00:27
Помогаю со студенческими работами здесь

Как скомпилировать и запустить программу?
помогите тоже запустить... в примере написано нужно запускать $ ./server1 &amp; и выводит 1094 $ server waiting но у меня...

Как скомпилировать и запустить java программу из командной строки ?
Добрый день. Хочу скомпилировать и запустить программу из командной строки. Но никак не получается. Выводит вот что:

Как скомпилировать и запустить файл .cpp в IDE CodeLite?
Это IDE установлено в линуксе. Не активны надписи (серым цветом) в меню Build.

Запустить в терминале
Давно не залазил Ubutu. Не могу понять почему нет появляется пункт меню &quot;Запустить в терминале&quot; ведь должна быть? При двойном клике...

Как скомпилировать программу в Qt и как её запустить?
Скачал Qt написал программу (Hello world ) а скомпилировать не могу подскажите как скомпилировать программу в Qt и как её запустить ...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Новые блоги и статьи
SDL3 для Web (WebAssembly): Обработчик клика мыши в браузере ПК и касания экрана в браузере на мобильном устройстве
8Observer8 02.02.2026
Содержание блога Для начала пошагово создадим рабочий пример для подготовки к экспериментам в браузере ПК и в браузере мобильного устройства. Потом напишем обработчик клика мыши и обработчик. . .
Философия технологии
iceja 01.02.2026
На мой взгляд у человека в технических проектах остается роль генерального директора. Все остальное нейронки делают уже лучше человека. Они не могут нести предпринимательские риски, не могут. . .
SDL3 для Web (WebAssembly): Вывод текста со шрифтом TTF с помощью SDL3_ttf
8Observer8 01.02.2026
Содержание блога В этой пошаговой инструкции создадим с нуля веб-приложение, которое выводит текст в окне браузера. Запустим на Android на локальном сервере. Загрузим Release на бесплатный. . .
SDL3 для Web (WebAssembly): Сборка C/C++ проекта из консоли
8Observer8 31.01.2026
Содержание блога Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
SDL3 для Web (WebAssembly): Установка Emscripten SDK (emsdk) и CMake для сборки C и C++ приложений в Wasm
8Observer8 31.01.2026
Содержание блога Для того чтобы скачать Emscripten SDK (emsdk) необходимо сначало скачать и уставить Git: Install for Windows. Следуйте стандартной процедуре установки Git через установщик. . . .
SDL3 для Android: Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 30.01.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами. Версия v3 была полностью переписана на Си, в. . .
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования. Часть библиотеки BedvitCOM Использованы. . .
SDL3 для Android: Загрузка PNG с альфа-каналом с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 28.01.2026
Содержание блога SDL3 имеет собственные средства для загрузки и отображения PNG-файлов с альфа-каналом и базовой работы с ними. В этой инструкции используется функция SDL_LoadPNG(), которая. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru