汇编语言的"hello world"

这个是8086的写法
data segment            ;这里定义一个数据段
tab db 'hello world$'  ;这里用内存存放字节数据 'hellow world!',$用来判断字符串是否输出完毕
data ends                 ;数据段的结束标志
code segment           ;这里定义了一个代码段
assume cs:code, ds:data  ;这里把程序中定义的段与对应的段寄存器关联起来
start:                                 ;这里是一个标号,根据end后面的标号判断这里是程序的开始位置
        mov ax,data
        mov ds,ax                 ;这里把数据段的地址放到数据段寄存器ds中
        lea dx,tab                 ;dx中放将要显示数据的偏移地址
        mov ah,9h
        int 21h                      ;调用21号中断的9号功能来显示字符串
        mov ah,4ch
        int 21h                      ;程序返回
 code  ends                      ;代码段的结束语
        end start                   ;定义程序从哪个标号处开始执行

68000 反汇编C原码 /* * main() */ int main(int argc, char **argv) { char dis_op[64], dis_inst[32], dis_arg[24]; UINT32 start_addr = 0, org = 0, do_org = 0, len = 0, fsize, i, j, k, file_i = 0; FILE *fp; UINT8 *buffer; char *c; /* * Process the command line */ if (argc <= 1) ShowHelp(); for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { if (file_i) fprintf(stderr, "68kd: Garbage on the command line (ignored): %s\n", argv[i]); else file_i = i; } else if (!strcmp(argv[i], "-?") || !strcmp(argv[i], "-h")) ShowHelp(); else if (!strcmp(argv[i], "-s")) { i++; if (i >= argc) fprintf(stderr, "68kd: Warning: No argument to: %s (ignored)\n", "-s"); else start_addr = strtoul(argv[i], &c, 16); } else if (!strcmp(argv[i], "-l")) { i++; if (i >= argc) fprintf(stderr, "68kd: Warning: No argument to: %s (ignored)\n", "-l"); else { len = strtoul(argv[i], &c, 16); if (!len) exit(0); // nothing to do! } } else if (!strcmp(argv[i], "-o")) { i++; if (i >= argc) fprintf(stderr, "68kd: Warning: No argument to: %s (ignored)\n", "-o"); else { org = strtoul(argv[i], &c, 16); do_org = 1; } } else fprintf(stderr, "68kd: Warning: Unrecognized option: %s (ignored)\n", argv[i]); } if (!file_i) { fprintf(stderr, "68kd: No file specified\n"); exit(1); } /* * Load file */ if ((fp = fopen(argv[file_i], "rb")) == NULL) { fprintf(stderr, "68kd: Unable to open %s for writing\n", argv[file_i]); exit(1); } fseek(fp, 0, SEEK_END); fsize = ftell(fp); rewind(fp); if ((buffer = (UINT8 *) malloc(fsize)) == NULL) { fprintf(stderr, "68kd: Not enough memory to load input file: %s, %lu bytes\n", argv[file_i], (unsigned long) fsize); exit(1); } fread(buffer, sizeof(UINT8), fsize, fp); fclose(fp); ByteSwapMemory(buffer, fsize);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值