org命令是什么东东
如题,在emu8086的例题中都是org 100h,没有用我们在甲鱼大大视频中学的start:和end start语句。看了汇编金手指里面的解说也还是没搞懂,求高手指点迷津!!!name "hi-world"; this example prints out"hello world!"
; by writing directly to video memory.
; in vga memory: first byte is ascii character, byte that follows is character attribute.
; if you change the second byte, you can change the color of
; the character even after it is printed.
; character attribute is 8 bit value,
; high 4 bits set background color and low 4 bits set foreground color.
; hex bin color
;
; 0 0000 black
; 1 0001 blue
; 2 0010 green
; 3 0011 cyan
; 4 0100 red
; 5 0101 magenta
; 6 0110 brown
; 7 0111 light gray
; 8 1000 dark gray
; 9 1001 light blue
; a 1010 light green
; b 1011 light cyan
; c 1100 light red
; d 1101 light magenta
; e 1110 yellow
; f 1111 white
org 100h
; set video mode
mov ax, 3 ; text mode 80x25, 16 colors, 8 pages (ah=0, al=3)
int 10h ; do it!
; cancel blinking and enable all 16 colors:
mov ax, 1003h
mov bx, 0
int 10h
; set segment register:
mov ax, 0b800h
mov ds, ax
; print "hello world"
; first byte is ascii code, second byte is color code.
mov , 'H'
mov , 'e'
mov , 'l'
mov , 'l'
mov , 'o'
mov , ','
mov , 'W'
mov , 'o'
mov , 'r'
mov , 'l'
mov , 'd'
mov , '!'
; color all characters:
mov cx, 12; number of characters.
mov di, 03h ; start from byte after 'h'
c:mov , 11101100b ; light red(1100) on yellow(1110)
add di, 2 ; skip over next ascii code in vga memory.
loop c
; wait for any key press:
mov ah, 0
int 16h
ret
http://bbs.fishc.com/xwb/images/bgimg/icon_logo.png 该贴已经同步到 风剑河的微博 本帖最后由 莫名其妙 于 2012-3-13 08:47 编辑
百度了下 貌似是偏移的意思贴上来一段
第一个程序不用ORG 100H时相当于:
0000:0000 CODE SEGMENT
START:
0000:0000 mov ax,offset message 注:这时 offset message值为0003H
0000:0003 message db 'this is'
第一个程序相当于:
0000:0000 CODE SEGMENT
0000:0000 ORG 100H
START:
0000:0100 mov ax,offset message 注:这时 offset message值为0103H
0000:0103 message db 'this is'
莫名其妙 发表于 2012-3-13 08:46 static/image/common/back.gif
百度了下 貌似是偏移的意思贴上来一段
emu里面能正常编译链接运行,而在cmd里面用masm命令就不行了,出错为:error a2034:must be in segment block 风剑河 发表于 2012-3-13 10:29 static/image/common/back.gif
emu里面能正常编译链接运行,而在cmd里面用masm命令就不行了,出错为:error a2034:must be in segment...
应该是编译模式不一样吧可能用CMD里的masm 需要用 assume ----code segment start;这种格式 查到点东西,网上说 org 100h是com程序不可缺少的东西,说这样的程序是com程序,至于什么是com程序,貌似还要啃进去一本书来能懂。
页:
[1]