国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
nasm calling subroutine from another file

I'm doing a project that attaches a subroutine that I wrote to a main file included by the teacher. He gave us the instructions for making our subroutine global but apparently I'm an idiot. The two asm files are in the same folder, I'm using nasm -f elf -g prt_dec.asm and ld prt_dec and then doing the same for main.asm. Here's the relevant code in the main.asm:

    SECTION .text                   ; Code section.global  _start                  ; let loader see entry pointextern  prt_dec_start:mov     ebx, 17mov     edx, 214123mov     edi, 2223187809mov     ebp, 1555544444mov     eax, dword 0x0call    prt_deccall    prt_lf

The line call prt_dec throws "undefined reference to prt_dec" when i use ld main.o

Here's the a code segment from my prt_dec.asm:

    Section .text    global prt_dec    global _startstart:prt_dec:      (pushing some stuff)L1_top:(code continues)




/////////////


You want to call a routine in another asm file or object file?if you are Assembling prt_dec.asm and are linking multiple asm files to use in your main program, here is a sample, 2 asm files Assembled and linked together... * NOTE * hello.asm *DOES NOT * have a start label!

Main asm file: hellothere.asm

sys_exit    equ 1extern Hello global _start section .text_start:    call    Hello    mov     eax, sys_exit    xor     ebx, ebx    int     80H

Second asm file: hello.asm

sys_write   equ 4stdout      equ 1global Hellosection .dataszHello     db  "Hello", 10Hello_Len   equ ($ - szHello)section .textHello:        mov     edx, Hello_Len        mov     ecx, szHello        mov     eax, sys_write        mov     ebx, stdout        int     80H       ret

makefile:

APP = hellothere$(APP): $(APP).o hello.o    ld -o $(APP) $(APP).o hello.o$(APP).o: $(APP).asm     nasm -f elf $(APP).asm hello.o: hello.asm    nasm -f elf hello.asm

Now, if you just want to separate your code into multiple asm files, you can include them into your main source: with %include "asmfile.asm" at the beginning of your main source file and just assemble and link your main file.

 
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
gdb 調(diào)試nasm語(yǔ)法的匯編程序
linux簡(jiǎn)單之美
vc 鏈接asm文件
自己動(dòng)手寫操作系統(tǒng)虛擬實(shí)現(xiàn),軟盤啟動(dòng)
如何寫一個(gè)最簡(jiǎn)單的操作系統(tǒng)
第7章 NASM的使用教程(X86匯編教程)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服