; ex0025.nas [FORMAT "WCOFF"] [FILE "ex0025.nas"] [INSTRSET "i486p"] [BITS 32] GLOBAL _G01Main EXTERN _g01_execcmd0 [SECTION .text] _G01Main: MOV EAX,msg CALL _g01_execcmd0 DB 0x53, 0x00 ; g01_putstr0((char *) EAX); RET [SECTION .data] msg DB "hello, world", 0x0a, 0
; ex0026.nas [FORMAT "WCOFF"] [FILE "ex0026.nas"] [INSTRSET "i486p"] [BITS 32] GLOBAL _G01Main EXTERN _g01_execcmd0 [SECTION .text] _G01Main: MOV AL,0x20 .putc_loop CALL _g01_execcmd0 DB 0x55, 0x16, 0x00 ; g01_putc(EAX); INC EAX CMP AL,0x7e JBE .putc_loop MOV AL,0x0a CALL _g01_execcmd0 DB 0x55, 0x16, 0x00 ; g01_putc(EAX); RET
EXTERN _g01_esi0 _g01_execcmd0: XOR EDI,EDI MOV ESI,[_g01_esi0] JMP [ESI] ; これがAPI呼び出し。RETで帰ると_g01_execcmd0の呼び出し元へ帰る。
; ex0026.nas [FORMAT "WCOFF"] [FILE "ex0026.nas"] [INSTRSET "i486p"] [BITS 32] GLOBAL _G01Main EXTERN _g01_esi0 [SECTION .text] _G01Main: MOV AL,0x20 XOR EDI,EDI MOV ESI,[_g01_esi0] .putc_loop CALL [ESI] DB 0x55, 0x16, 0x00 ; g01_putc(EAX); INC EAX CMP AL,0x7e JBE .putc_loop MOV AL,0x0a CALL [ESI] DB 0x55, 0x16, 0x00 ; g01_putc(EAX); RET
; ex0026.nas [FORMAT "WCOFF"] [FILE "ex0026.nas"] [INSTRSET "i486p"] [BITS 32] GLOBAL _G01Main [SECTION .text] _G01Main: MOV AL,0x20 .putc_loop CALL [ESI] DB 0x55, 0x16, 0x00 ; g01_putc(EAX); INC EAX CMP AL,0x7e JBE .putc_loop MOV AL,0x0a CALL [ESI] DB 0x55, 0x16, 0x00 ; g01_putc(EAX); RET
; ex0027.nas [FORMAT "WCOFF"] [FILE "ex0027.nas"] [INSTRSET "i486p"] [BITS 32] GLOBAL _G01Main EXTERN _g01_execcmd0 [SECTION .text] _G01Main: CALL _g01_execcmd0 DB 0x51, "hello, world", 0x0a, 0x00 ; g01_putstr0("hello, world\n"); RET