//---------------------------------------------------------------- // mymain.s // // This GNU assembly language program is designed to show a // procedure call to an external subroutine. Notice that a // custom linker-script is required when linking with 'ld'. // // assemble and link using: // $ as mymain.s -o mymain.o // $ as mysub.s -o mysub.o // $ ld mymain.o mysub.o -T ldscript -o mymain.b // install on floppy using: // $ dd if=mymain.b of=/dev/fd0 seek=1 // // programmer: ALLAN CRUSE // written on: 02 MAY 2004 //---------------------------------------------------------------- .code16 .section .text .word 0xABCD _start: mov %cs, %ax mov %ax, %ds popl return_address mov %ax, %ss lea stk0, %esp mov %ds, %ax # address this segment mov %ax, %es # with ES register mov $0x0F, %ah # get display-page in BH int $0x10 mov $0x03, %ah # get cursor locn in DH,DL int $0x10 lea msg, %bp # message offset mov len, %cx # message length mov att, %bl # attribute byte mov $0x1301, %ax # write string int $0x10 call newline # call external procedure pushl return_address lret return_address: .long 0 msg: .ascii " Hello " len: .int . - msg att: .byte 0x70 .align 16 .space 512 stk0: .globl _start