锘??xml version="1.0" encoding="utf-8" standalone="yes"?>最新亚洲一区,亚洲第一伊人,久久久蜜桃精品http://www.shnenglu.com/jackyxinli/category/21019.html鏄ラ鎷傞潰涓ら綰紝縐嬪彾媧掑湴涓鐗囬噾銆? 澶忚嵎鎽囨洺涓韜交錛屽啲闆鐩栧ぇ鍦伴摱銆?/description>zh-cnFri, 09 Jan 2015 06:16:03 GMTFri, 09 Jan 2015 06:16:03 GMT60[ASM] 寮曞紼嬪簭浠庣鐩樹笂鍔犺澆絎簩鎵囧尯鍚庡畨瑁?x80涓柇騫惰皟鐢?/title><link>http://www.shnenglu.com/jackyxinli/archive/2015/01/08/209435.html</link><dc:creator>jacky_zz</dc:creator><author>jacky_zz</author><pubDate>Thu, 08 Jan 2015 06:34:00 GMT</pubDate><guid>http://www.shnenglu.com/jackyxinli/archive/2015/01/08/209435.html</guid><wfw:comment>http://www.shnenglu.com/jackyxinli/comments/209435.html</wfw:comment><comments>http://www.shnenglu.com/jackyxinli/archive/2015/01/08/209435.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/jackyxinli/comments/commentRss/209435.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/jackyxinli/services/trackbacks/209435.html</trackback:ping><description><![CDATA[<strong>bootloader.asm</strong><br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000; ">    org </span><span style="color: #000000; ">0x7c00</span><span style="color: #000000; "><br /> start:<br />     jmp main_entry<br /> <br /> stack:<br />     times </span><span style="color: #000000; ">128</span><span style="color: #000000; "> db </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br /> tos:<br />     db </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br /> <br /> main_entry:<br />     mov ax, cs<br />     mov ds, ax<br /> <br />     mov ax, stack<br />     mov ss, ax<br />     mov sp, start<br /> <br />     ; initialize es:bx, read data to </span><span style="color: #000000; ">0x0000</span><span style="color: #000000; ">:</span><span style="color: #000000; ">0x7e00</span><span style="color: #000000; "><br />     mov ax, </span><span style="color: #000000; ">0x0000</span><span style="color: #000000; "><br />     mov es, ax<br />     mov bx, </span><span style="color: #000000; ">0x7c00</span><span style="color: #000000; ">+</span><span style="color: #000000; ">0x200</span><span style="color: #000000; "><br /> <br />     mov ah, </span><span style="color: #000000; ">0x02</span><span style="color: #000000; ">    ; read function<br />     mov al, </span><span style="color: #000000; ">0x01</span><span style="color: #000000; ">    ; read </span><span style="color: #000000; ">1</span><span style="color: #000000; "> sectors<br />     mov ch, </span><span style="color: #000000; ">0x00</span><span style="color: #000000; ">    ; <br />     mov cl, </span><span style="color: #000000; ">0x02</span><span style="color: #000000; ">    ; read from 2nd section<br />     mov dh, </span><span style="color: #000000; ">0x00</span><span style="color: #000000; ">    ;<br />     mov dl, </span><span style="color: #000000; ">0x80</span><span style="color: #000000; ">    ; read from 1st hard disk<br />     </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x13</span><span style="color: #000000; "><br />     jc .die<br /> <br />     ; install interrupt </span><span style="color: #000000; ">0x80</span><span style="color: #000000; "><br />     call </span><span style="color: #000000; ">0x7e00</span><span style="color: #000000; "><br /> <br />     ; call interrupt </span><span style="color: #000000; ">0x80</span><span style="color: #000000; "><br />     mov ax, msg1<br />     </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x80</span><span style="color: #000000; "><br /> <br />     ; call interrupt </span><span style="color: #000000; ">0x80</span><span style="color: #000000; "><br />     mov ax, msg2<br />     </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x80</span><span style="color: #000000; "><br /> <br /> .die:<br />     jmp $<br /> <br /> print_char:    <br />     mov ah, </span><span style="color: #000000; ">0x0e</span><span style="color: #000000; "><br />     </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x10</span><span style="color: #000000; "><br />     ret<br /> <br /> msg1:    db </span><span style="color: #000000; ">"</span><span style="color: #000000; ">Loading system <img src="http://www.shnenglu.com/Images/dot.gif" alt="" /></span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0x0d</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0x0a</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br /> msg2:    db </span><span style="color: #000000; ">"</span><span style="color: #000000; ">Hello, World!</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0x0d</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0x0a</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br /> crlf:    db </span><span style="color: #000000; ">0x0d</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0x0a</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br /> <br /> fill_zero:<br />     times </span><span style="color: #000000; ">510</span><span style="color: #000000; ">-</span><span style="color: #000000; ">($</span><span style="color: #000000; ">-</span><span style="color: #000000; ">$$) db </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br /> <br /> magic:<br />     db </span><span style="color: #000000; ">0x55</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0xAA</span></div> <br /> <strong>lib16.asm</strong><br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #000000; ">    org </span><span style="color: #000000; ">0x7e00</span><span style="color: #000000; "><br /> install_int:<br />     mov ax, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />     mov es, ax<br /> <br />         mov ax, int_0x80<br />     mov bx, </span><span style="color: #000000; ">0x80</span><span style="color: #000000; ">*</span><span style="color: #000000; ">4</span><span style="color: #000000; "><br />     mov word [es:bx], ax    ; ip<br />     mov word [es:(bx</span><span style="color: #000000; ">+</span><span style="color: #000000; ">2</span><span style="color: #000000; ">)], </span><span style="color: #000000; ">0</span><span style="color: #000000; ">    ; cs<br /> <br />     ret<br /> <br /> int_0x80:<br />     pusha<br /> <br />     mov si, ax<br />     mov ah, </span><span style="color: #000000; ">0x0e</span><span style="color: #000000; "><br />     mov al, [ds:si]<br /> <br /> .loop:<br />     cmp al, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />     je .exit<br />     </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x10</span><span style="color: #000000; "><br /> <br />     inc si<br />     mov al, [ds:si]<br /> <br />     jmp .loop<br /> .exit:<br />     popa<br />     iret<br /> <br /> fill_zero:<br />     times </span><span style="color: #000000; ">512</span><span style="color: #000000; ">-</span><span style="color: #000000; ">($</span><span style="color: #000000; ">-</span><span style="color: #000000; ">$$) db </span><span style="color: #000000; ">0</span></div> <br /><strong>緇撴灉鍥撅細</strong><br /><img alt="" src="http://www.shnenglu.com/images/cppblog_com/jackyxinli/result.png" height="563" width="656" /><img src ="http://www.shnenglu.com/jackyxinli/aggbug/209435.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/jackyxinli/" target="_blank">jacky_zz</a> 2015-01-08 14:34 <a href="http://www.shnenglu.com/jackyxinli/archive/2015/01/08/209435.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ASM] 閫掑綊璁$畻闃朵箻http://www.shnenglu.com/jackyxinli/archive/2014/12/28/209326.htmljacky_zzjacky_zzSun, 28 Dec 2014 13:08:00 GMThttp://www.shnenglu.com/jackyxinli/archive/2014/12/28/209326.htmlhttp://www.shnenglu.com/jackyxinli/comments/209326.htmlhttp://www.shnenglu.com/jackyxinli/archive/2014/12/28/209326.html#Feedback0http://www.shnenglu.com/jackyxinli/comments/commentRss/209326.htmlhttp://www.shnenglu.com/jackyxinli/services/trackbacks/209326.html 

    org 100h
    jmp start
    
stack:
    db 
256 dup(0)
topofstack:
    db 
0

; add your code here
start:
    mov ax, cs
    mov ds, ax
    
    mov ss, ax
    mov sp, topofstack
    
    mov ax, 
0x0003
    push ax
    call f
    pop ax
    hlt
    
f:
    push bp
    push ax
    
    mov bp, sp
    mov ax, [bp
+6]
    cmp ax, 
0x0001
    je exit
    
    dec ax
    push ax
    call f
    pop ax
    
    mul [bp
+6]
    
exit:
    mov [bp
+6], ax
    pop ax
    pop bp
    ret

 



jacky_zz 2014-12-28 21:08 鍙戣〃璇勮
]]>
[ASM] 鎵撳嵃鎸囧畾鍦板潃鐨勫唴瀛樺唴瀹?/title><link>http://www.shnenglu.com/jackyxinli/archive/2014/12/26/209314.html</link><dc:creator>jacky_zz</dc:creator><author>jacky_zz</author><pubDate>Fri, 26 Dec 2014 08:09:00 GMT</pubDate><guid>http://www.shnenglu.com/jackyxinli/archive/2014/12/26/209314.html</guid><wfw:comment>http://www.shnenglu.com/jackyxinli/comments/209314.html</wfw:comment><comments>http://www.shnenglu.com/jackyxinli/archive/2014/12/26/209314.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/jackyxinli/comments/commentRss/209314.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/jackyxinli/services/trackbacks/209314.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">main:<br />    org </span><span style="color: #000000; ">0x0100</span><span style="color: #000000; "><br />    jmp start<br /><br />stack:<br />    db </span><span style="color: #000000; ">256</span><span style="color: #000000; "> dup(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br />tos:<br />    dw </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br /><br />start:<br />    mov ax, cs<br />    mov ds, ax<br />    mov ss, ax<br />    mov sp, tos<br />    <br />    mov ax, end<br />    mov bx, main<br />    sub ax, bx<br />    <br />    mov bx, </span><span style="color: #000000; ">2</span><span style="color: #000000; "><br />    div bx<br />    cmp dx, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    je next_step<br />    inc ax<br />    <br />next_step:<br />    mov bx, ax<br />    mov si, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    mov di, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    <br />.</span><span style="color: #000000; ">0</span><span style="color: #000000; ">:<br />    cmp di, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    je .</span><span style="color: #000000; ">1</span><span style="color: #000000; "><br />    <br />    mov ax, </span><span style="color: #000000; ">0x0000</span><span style="color: #000000; "><br />    push ax<br />    call print_char<br />    pop ax<br /><br />.</span><span style="color: #000000; ">1</span><span style="color: #000000; ">:    <br />    mov dx, cs:[si]<br />    mov ch, </span><span style="color: #000000; ">0x04</span><span style="color: #000000; "><br />    mov cl, </span><span style="color: #000000; ">0x04</span><span style="color: #000000; "><br />        <br />.</span><span style="color: #000000; ">2</span><span style="color: #000000; ">:<br />    mov ax, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    rol dx, cl<br />    <br />    mov al, dl<br />    and al, </span><span style="color: #000000; ">0x0f</span><span style="color: #000000; "><br />    add al, </span><span style="color: #000000; ">0x30</span><span style="color: #000000; "><br />    cmp al, </span><span style="color: #000000; ">0x3a</span><span style="color: #000000; "><br />    jl .</span><span style="color: #000000; ">3</span><span style="color: #000000; "><br />    add al, </span><span style="color: #000000; ">0x07</span><span style="color: #000000; "><br />.</span><span style="color: #000000; ">3</span><span style="color: #000000; ">:<br />    <br />    push ax<br />    call print_char<br />    pop ax<br />    <br />    dec ch<br />    cmp ch, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    jne .</span><span style="color: #000000; ">2</span><span style="color: #000000; "><br />     <br />    inc di<br />    add si, </span><span style="color: #000000; ">2</span><span style="color: #000000; "><br />    <br />    dec bx<br />    cmp bx, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    jne .</span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    <br />    hlt<br /><br />print_char:<br />    push bp<br />    push ax<br />    push bx<br />    <br />    mov bp, sp<br />    mov ax, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">8</span><span style="color: #000000; ">]<br />    mov ah, </span><span style="color: #000000; ">0x0e</span><span style="color: #000000; "><br />    mov bx, </span><span style="color: #000000; ">0x0000</span><span style="color: #000000; "><br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x10</span><span style="color: #000000; "><br /><br />    pop bx<br />    pop ax<br />    pop bp<br />    ret<br /><br />end:<br />    dw </span><span style="color: #000000; ">0</span></div><img src ="http://www.shnenglu.com/jackyxinli/aggbug/209314.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/jackyxinli/" target="_blank">jacky_zz</a> 2014-12-26 16:09 <a href="http://www.shnenglu.com/jackyxinli/archive/2014/12/26/209314.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ASM] 鏄劇ず鍒跺畾孌靛強闀垮害鐨勫唴瀛樺?/title><link>http://www.shnenglu.com/jackyxinli/archive/2014/12/19/209259.html</link><dc:creator>jacky_zz</dc:creator><author>jacky_zz</author><pubDate>Fri, 19 Dec 2014 14:53:00 GMT</pubDate><guid>http://www.shnenglu.com/jackyxinli/archive/2014/12/19/209259.html</guid><wfw:comment>http://www.shnenglu.com/jackyxinli/comments/209259.html</wfw:comment><comments>http://www.shnenglu.com/jackyxinli/archive/2014/12/19/209259.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/jackyxinli/comments/commentRss/209259.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/jackyxinli/services/trackbacks/209259.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">; You may customize </span><span style="color: #0000FF; ">this</span><span style="color: #000000; "> and other start</span><span style="color: #000000; ">-</span><span style="color: #000000; ">up templates; <br />; The location of </span><span style="color: #0000FF; ">this</span><span style="color: #000000; "> template </span><span style="color: #0000FF; ">is</span><span style="color: #000000; "> c:\emu8086\inc\0_com_template.txt<br /><br />    org 100h<br />start:<br />    jmp main<br /><br />stack:<br />    db </span><span style="color: #000000; ">256</span><span style="color: #000000; "> dup(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br />code_len:<br />    dw </span><span style="color: #000000; ">0</span><span style="color: #000000; "> <br />    <br />; add your code here<br />main:<br />    mov ax, cs<br />    mov ds, ax<br />    mov ss, ax<br />    mov sp, stack</span><span style="color: #000000; ">+</span><span style="color: #000000; ">256</span><span style="color: #000000; "><br />    <br />    mov ax, end<br />    mov bx, main<br />    sub ax, bx<br />    mov bx, </span><span style="color: #000000; ">2</span><span style="color: #000000; "><br />    div bx<br />    <br />    cmp dx, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    je next_step<br />    inc ax<br />          <br />next_step:<br />    mov bx, code_len<br />    mov [bx], ax<br />    mov bx, main<br />    <br />    push ax<br />    push bx<br />    push cs<br />    call dump_memory<br />   <br />    pop ax<br />    pop bx<br />    pop ax<br />    hlt         <br />    <br />dump_memory:<br />    push bp<br />    push ax<br />    push bx<br />    push cx<br />    push dx<br />    push ds<br />    <br />    mov bp, sp    <br />    mov ax, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">14</span><span style="color: #000000; ">]<br />    mov bx, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">16</span><span style="color: #000000; ">]<br />    mov cx, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">18</span><span style="color: #000000; ">]<br />    xor dx, dx<br />    mov ds, ax<br />    <br />rotate_memory:<br />    mov ax, ds:[bx]<br />    push ax<br />    call write_hex<br />    pop ax<br />    add bx, </span><span style="color: #000000; ">2</span><span style="color: #000000; "><br />    loop rotate_memory  <br />    <br />    pop ax<br />    mov ds, ax<br />    <br />    pop dx<br />    pop cx<br />    pop bx<br />    pop ax<br />    pop bp<br />    ret<br />    <br />write_hex:<br />    push bp<br />    push ax<br />    push bx<br />    push cx<br />    push dx<br />    <br />    mov bp, sp<br />    mov bx, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">12</span><span style="color: #000000; ">]<br />    <br />    xor ax, ax<br />    xor cx, cx<br />    mov ch, </span><span style="color: #000000; ">4</span><span style="color: #000000; "> <br />    <br />rotate:<br />    mov cl, </span><span style="color: #000000; ">4</span><span style="color: #000000; "><br />    rol bx, cl<br />    mov al, bl<br />    and al, </span><span style="color: #000000; ">0x0f</span><span style="color: #000000; "><br />    add al, </span><span style="color: #000000; ">0x30</span><span style="color: #000000; "><br />    cmp al, </span><span style="color: #000000; ">0x3a</span><span style="color: #000000; "><br />    jl printit<br />    add al, </span><span style="color: #000000; ">0x07</span><span style="color: #000000; "><br />printit:<br />    mov dl, al<br />    push dx<br />    call write_char<br />    pop dx<br />    <br />    dec ch<br />    jnz rotate<br />    <br />    mov dx, </span><span style="color: #000000; ">0x0000</span><span style="color: #000000; "><br />    push dx<br />    call write_char<br />    pop dx<br />    <br />    pop dx<br />    pop cx<br />    pop bx<br />    pop ax<br />    pop bp<br />    ret<br />    <br />write_char:<br />    push bp<br />    push ax<br />    push dx<br />    <br />    mov bp, sp<br />    mov ah, </span><span style="color: #000000; ">0x02</span><span style="color: #000000; "><br />    mov dx, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">8</span><span style="color: #000000; ">]<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x21</span><span style="color: #000000; "> <br />    <br />    pop dx<br />    pop ax<br />    pop bp<br />    ret<br />    <br />end: db </span><span style="color: #000000; ">0x55</span><span style="color: #000000; ">,</span><span style="color: #000000; ">0xaa</span></div><img src ="http://www.shnenglu.com/jackyxinli/aggbug/209259.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/jackyxinli/" target="_blank">jacky_zz</a> 2014-12-19 22:53 <a href="http://www.shnenglu.com/jackyxinli/archive/2014/12/19/209259.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ASM] 鍒╃敤鍫嗘爤浼犻掑弬鏁?/title><link>http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209227.html</link><dc:creator>jacky_zz</dc:creator><author>jacky_zz</author><pubDate>Thu, 18 Dec 2014 09:10:00 GMT</pubDate><guid>http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209227.html</guid><wfw:comment>http://www.shnenglu.com/jackyxinli/comments/209227.html</wfw:comment><comments>http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209227.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/jackyxinli/comments/commentRss/209227.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/jackyxinli/services/trackbacks/209227.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">; You may customize </span><span style="color: #0000FF; ">this</span><span style="color: #000000; "> and other start</span><span style="color: #000000; ">-</span><span style="color: #000000; ">up templates; <br />; The location of </span><span style="color: #0000FF; ">this</span><span style="color: #000000; "> template </span><span style="color: #0000FF; ">is</span><span style="color: #000000; "> c:\emu8086\inc\0_com_template.txt<br /><br />    org 100h<br />    jmp start<br /><br />data:<br />    dw </span><span style="color: #000000; ">32</span><span style="color: #000000; "> dup(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br />        <br />stack:<br />    dw </span><span style="color: #000000; ">256</span><span style="color: #000000; "> dup(0</span><span style="color: #000000; ">)<br /><br />start:<br />; add your code here    <br />    mov ax, cs<br />    mov ds, ax<br />    mov bx, data<br />    <br />    mov ss, ax<br />    mov sp, stack</span><span style="color: #000000; ">+</span><span style="color: #000000; ">31</span><span style="color: #000000; "><br />    <br />    push </span><span style="color: #000000; ">0x0001</span><span style="color: #000000; "><br />    push </span><span style="color: #000000; ">0x0002</span><span style="color: #000000; "><br />    push </span><span style="color: #000000; ">0x0003</span><span style="color: #000000; "><br />    call test_proc<br />    <br />    hlt<br />    <br />test_proc:<br />    push bp<br />    mov bp, sp<br />    <br />    mov ax, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">8</span><span style="color: #000000; ">]<br />    push ax<br />    call write_char<br />    <br />    mov ax, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">6</span><span style="color: #000000; ">]<br />    push ax<br />    call write_char<br />    <br />    mov ax, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">4</span><span style="color: #000000; ">]<br />    push ax<br />    call write_char<br />    <br />    pop bp<br />    ret </span><span style="color: #000000; ">6</span><span style="color: #000000; "><br />    <br />write_char:<br />    push bp<br />    mov bp, sp<br />    <br />    mov ax, [bp</span><span style="color: #000000; ">+</span><span style="color: #000000; ">4</span><span style="color: #000000; ">]<br />    mov dl, al<br />    add dl, </span><span style="color: #000000; ">0x30</span><span style="color: #000000; "><br />    cmp dl, </span><span style="color: #000000; ">0x3a</span><span style="color: #000000; "><br />    jl printit<br />    add dl, </span><span style="color: #000000; ">0x07</span><span style="color: #000000; "><br />    <br />printit:<br />    mov ah, </span><span style="color: #000000; ">0x02</span><span style="color: #000000; "><br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x21</span><span style="color: #000000; "><br />    pop bp<br />    ret </span><span style="color: #000000; ">2</span></div><img src ="http://www.shnenglu.com/jackyxinli/aggbug/209227.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/jackyxinli/" target="_blank">jacky_zz</a> 2014-12-18 17:10 <a href="http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209227.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ASM] 浜岃繘鍒舵暟鐢ㄥ崄鍏繘鍒舵樉紺?/title><link>http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209224.html</link><dc:creator>jacky_zz</dc:creator><author>jacky_zz</author><pubDate>Thu, 18 Dec 2014 08:24:00 GMT</pubDate><guid>http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209224.html</guid><wfw:comment>http://www.shnenglu.com/jackyxinli/comments/209224.html</wfw:comment><comments>http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209224.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/jackyxinli/comments/commentRss/209224.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/jackyxinli/services/trackbacks/209224.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">org 100h<br /><br />; add your code here<br />    mov ax, cs<br />    mov ds, ax<br />    mov ss, ax<br />    <br />    mov ax, </span><span style="color: #000000; ">0x0000</span><span style="color: #000000; "><br />    mov bx, </span><span style="color: #000000; ">0x106f</span><span style="color: #000000; "><br />    mov ch, </span><span style="color: #000000; ">0x04</span><span style="color: #000000; "><br />    <br />rotate:<br />    mov cl, </span><span style="color: #000000; ">0x04</span><span style="color: #000000; "><br />    rol bx, cl<br />    mov al, bl<br />    and al, </span><span style="color: #000000; ">0x0f</span><span style="color: #000000; "><br />    add al, </span><span style="color: #000000; ">0x30</span><span style="color: #000000; "><br />    cmp al, </span><span style="color: #000000; ">0x3a</span><span style="color: #000000; "><br />    jl printit<br />    add al, </span><span style="color: #000000; ">0x07</span><span style="color: #000000; "><br />    <br />printit:<br />    mov dl, al<br />    mov ah, </span><span style="color: #000000; ">0x02</span><span style="color: #000000; "><br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">0x21</span><span style="color: #000000; "><br />    dec ch<br />    jnz rotate    <br /><br />ret</span></div><img src ="http://www.shnenglu.com/jackyxinli/aggbug/209224.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/jackyxinli/" target="_blank">jacky_zz</a> 2014-12-18 16:24 <a href="http://www.shnenglu.com/jackyxinli/archive/2014/12/18/209224.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ASM] 鏄劇ず涓涓暟瀛楃殑浜岃繘鍒躲佸叓榪涘埗銆佸崄榪涘埗銆佸崄鍏繘鍒訛紙甯﹁繃紼嬭皟鐢級http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209208.htmljacky_zzjacky_zzWed, 17 Dec 2014 08:55:00 GMThttp://www.shnenglu.com/jackyxinli/archive/2014/12/17/209208.htmlhttp://www.shnenglu.com/jackyxinli/comments/209208.htmlhttp://www.shnenglu.com/jackyxinli/archive/2014/12/17/209208.html#Feedback0http://www.shnenglu.com/jackyxinli/comments/commentRss/209208.htmlhttp://www.shnenglu.com/jackyxinli/services/trackbacks/209208.html; You may customize this and other start-up templates; 
; The location of 
this template is c:\emu8086\inc\0_com_template.txt

org 100h

; add your code here 
    mov ax, cs
    mov ds, ax 
    mov ss, ax    
    mov sp, stack 
+ 256 - 1    
    mov si, 
0
    
    push 
0x105e
    call write_bin
    pop ax 
    
    call write_space2
    
    push 
0x0002
    push 
0x78fd
    call write_num
    pop ax
    pop ax
    
    call write_space2
    
    push 
0x0008
    push 
0x78fd
    call write_num
    pop ax
    pop ax
    
    call write_space2
    
    push 
0x000A
    push 
0x78fd
    call write_num
    pop ax
    pop ax
    
    call write_space2
    
    push 
0x0010
    push 
0x78fd
    call write_num
    pop ax
    pop ax
    
    ret

write_space2:
    mov cx, 
2
loop_write_char:
    call write_space
    loop loop_write_char
    ret

write_space:
    push 
0x0000
    call write_char
    pop ax
    ret
    
write_char:    
    push ax
    push bx
    push cx
    push dx
    mov bp, sp
    
    mov ah, 
0x0e
    mov bx, ss:[bp
+10] ; parameter 1
    mov al, bl
    mov bx, 
0x000c
    
int 0x10
    
    pop dx
    pop cx
    pop bx
    pop ax
    ret

write_bin:
    mov bp, sp       
    mov ax, ss:[bp
+2] ; parameter 1
    mov cx, 
16
    
s:
    xor dx, dx
    rcl ax, 
1
    adc dl, 
0x30
    
    push dx
    call write_char
    pop dx 
    loop s
    ret
    
write_num:
    mov bp, sp
    mov ax, ss:[bp
+2] ; parameter 1
    mov bx, ss:[bp
+4] ; parameter 2
    mov cx, 
0
    
loop_num_div:
    mov dx, 
0
    div bx
    push dx
    inc cx
    cmp ax, 
0
    jne loop_num_div
    
loop_num_disp:
    pop dx
    
    add dl, 
0x30
    cmp dl, 
0x3A
    jl disp_char
    add dl, 
0x07

disp_char:    
    push dx
    call write_char
    pop dx
    
    loop loop_num_disp
    ret 
    
stack:
    dw 
0000000000000000
    dw 
0000000000000000
    dw 
0000000000000000
    dw 
0000000000000000
    dw 
0000000000000000
    dw 
0000000000000000
    dw 
0000000000000000
    dw 
0000000000000000
end_flag: db 
0x11

jacky_zz 2014-12-17 16:55 鍙戣〃璇勮
]]>
[ASM] 鏄劇ず涓涓暟瀛楃殑鍗佽繘鍒?/title><link>http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209201.html</link><dc:creator>jacky_zz</dc:creator><author>jacky_zz</author><pubDate>Wed, 17 Dec 2014 01:40:00 GMT</pubDate><guid>http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209201.html</guid><wfw:comment>http://www.shnenglu.com/jackyxinli/comments/209201.html</wfw:comment><comments>http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209201.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/jackyxinli/comments/commentRss/209201.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/jackyxinli/services/trackbacks/209201.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">org 100h<br /><br />; add your code here<br /><br />    mov ax, cs<br />    mov ds, ax<br />    <br />    mov ax, </span><span style="color: #000000; ">0xb800</span><span style="color: #000000; "><br />    mov es, ax<br />    <br />    xor ax, ax<br />    xor bx, bx<br />    xor cx, cx<br />    xor dx, dx<br />    <br />    mov ax, </span><span style="color: #000000; ">0x105e</span><span style="color: #000000; "> ;闄ゆ暟<br />    mov bx, </span><span style="color: #000000; ">10</span><span style="color: #000000; "> ;琚櫎鏁?br /><br />s:    <br />    mov dx, </span><span style="color: #000000; ">0</span><span style="color: #000000; "> ;娓呯┖浣欐暟<br />    div bx ;闄や互琚櫎鏁?br />    push dx ;鎶婁綑鏁板帇鏍?br />    inc cx ;寰幆嬈℃暟鍔?<br />    cmp ax, </span><span style="color: #000000; ">0</span><span style="color: #000000; "> ;鍟嗕笉涓?緇х畫闄?br />    jne s<br />    <br />    mov bx, </span><span style="color: #000000; ">0</span><span style="color: #000000; "><br />    <br />p1: <br />    pop dx<br />    add dl, </span><span style="color: #000000; ">0x30</span><span style="color: #000000; "><br />    <br />    mov es:[bx], dl<br />    inc bx<br />    mov es:[bx], </span><span style="color: #000000; ">0x0c</span><span style="color: #000000; "><br />    inc bx<br />    loop p1<br />    <br />ret</span></div><img src ="http://www.shnenglu.com/jackyxinli/aggbug/209201.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/jackyxinli/" target="_blank">jacky_zz</a> 2014-12-17 09:40 <a href="http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209201.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ASM] 鏄劇ず涓涓暟瀛楃殑鍗佸叚榪涘埗http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209200.htmljacky_zzjacky_zzWed, 17 Dec 2014 01:31:00 GMThttp://www.shnenglu.com/jackyxinli/archive/2014/12/17/209200.htmlhttp://www.shnenglu.com/jackyxinli/comments/209200.htmlhttp://www.shnenglu.com/jackyxinli/archive/2014/12/17/209200.html#Feedback0http://www.shnenglu.com/jackyxinli/comments/commentRss/209200.htmlhttp://www.shnenglu.com/jackyxinli/services/trackbacks/209200.htmlorg 100h

; add your code here

    mov ax, cs
    mov ds, ax
    
    mov ax, 
0xb800
    mov es, ax
    
    xor ax, ax
    xor bx, bx
    xor dx, dx
    
    mov dl, 
0x2f
    mov al, dl
    shr al, 
4
    add al, 
0x30
    cmp al, 
0x3a
    jl p1
    add al, 
0x07

p1:
    mov es:[bx], al
    inc bx
    mov es:[bx], 
0x0c
    inc bx
    
    mov al, dl
    and al, 
0x0f
    add al, 
0x30
    cmp al, 
0x3a
    jl p2
    add al, 
0x07
    
p2:
    mov es:[bx], al
    inc bx
    mov es:[bx], 
0x0c
    inc bx
    
ret


jacky_zz 2014-12-17 09:31 鍙戣〃璇勮
]]>
[ASM] 鏄劇ず涓涓暟瀛楃殑浜岃繘鍒?/title><link>http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209198.html</link><dc:creator>jacky_zz</dc:creator><author>jacky_zz</author><pubDate>Wed, 17 Dec 2014 01:00:00 GMT</pubDate><guid>http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209198.html</guid><wfw:comment>http://www.shnenglu.com/jackyxinli/comments/209198.html</wfw:comment><comments>http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209198.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/jackyxinli/comments/commentRss/209198.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/jackyxinli/services/trackbacks/209198.html</trackback:ping><description><![CDATA[<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">org 100h<br /><br />; add your code here<br /><br />    mov ax, cs<br />    mov ds, ax<br />    <br />    mov ax, </span><span style="color: #000000; ">0xb800</span><span style="color: #000000; "><br />    mov es, ax<br />    <br />    xor ax, ax<br />    xor bx, bx<br />    xor dx, dx<br />    <br />    mov al, </span><span style="color: #000000; ">0xff</span><span style="color: #000000; "><br />    mov cx, </span><span style="color: #000000; ">0x0008</span><span style="color: #000000; "><br />    <br />    <br />s:  <br />    xor dx, dx<br />    rcl al, </span><span style="color: #000000; ">1</span><span style="color: #000000; "><br />    adc dl, </span><span style="color: #000000; ">0x30</span><span style="color: #000000; "><br />    <br />    mov es:[bx], dl<br />    inc bx<br />    mov es:[bx], </span><span style="color: #000000; ">0x0c</span><span style="color: #000000; "><br />    inc bx<br />    loop s<br />    <br />ret</span></div><img src ="http://www.shnenglu.com/jackyxinli/aggbug/209198.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/jackyxinli/" target="_blank">jacky_zz</a> 2014-12-17 09:00 <a href="http://www.shnenglu.com/jackyxinli/archive/2014/12/17/209198.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ASM] 澶氱鏁板埗鏄劇ず鐨勬眹緙栬璦緙栫▼瀹炵幇http://www.shnenglu.com/jackyxinli/archive/2014/12/16/209191.htmljacky_zzjacky_zzTue, 16 Dec 2014 09:24:00 GMThttp://www.shnenglu.com/jackyxinli/archive/2014/12/16/209191.htmlhttp://www.shnenglu.com/jackyxinli/comments/209191.htmlhttp://www.shnenglu.com/jackyxinli/archive/2014/12/16/209191.html#Feedback0http://www.shnenglu.com/jackyxinli/comments/commentRss/209191.htmlhttp://www.shnenglu.com/jackyxinli/services/trackbacks/209191.html
; You may customize 
this and other start-up templates; 
; The location of 
this template is c:\emu8086\inc\0_com_template.txt

org 100h

; add your code here
    mov ax, cs
    mov ds, ax
    mov ss, ax
    
    mov ax, 
0xb800
    mov es, ax
    
    mov ax, 
0x6f4e
    ;mov bx, 
2     
    ;mov bx, 
8
    mov bx, 
10
    ;mov bx, 
16
    xor cx, cx  
    
next_div:
    mov dx, 
0
    div bx
    push dx
    inc cx
    cmp ax, 
0
    jnz next_div   
              
    mov si, bx
    xor bx, bx
    cmp si, 
16
    jnz outp
    
    ;濡傛灉鏄樉紺?6榪涘埗鍒欏湪鍊煎墠闈㈠姞涓?x
    mov es:[bx], 
'0'
    inc bx
    mov es:[bx], 
0x0c
    inc bx
    mov es:[bx], 
'x'
    inc bx
    mov es:[bx], 
0x0c
    inc bx
      
outp:
    pop dx
    add dl, 
0x30
    cmp dl, 
0x3a ;鏄疉-F錛岃澶氬姞7
    jl outc
    add dl, 
0x07
outc:
    mov es:[bx], dl
    inc bx
    mov es:[bx], 
0x0c
    inc bx
    loop outp
    
    hlt


jacky_zz 2014-12-16 17:24 鍙戣〃璇勮
]]>
[ASM] head.shttp://www.shnenglu.com/jackyxinli/archive/2014/12/08/209055.htmljacky_zzjacky_zzMon, 08 Dec 2014 02:59:00 GMThttp://www.shnenglu.com/jackyxinli/archive/2014/12/08/209055.htmlhttp://www.shnenglu.com/jackyxinli/comments/209055.htmlhttp://www.shnenglu.com/jackyxinli/archive/2014/12/08/209055.html#Feedback0http://www.shnenglu.com/jackyxinli/comments/commentRss/209055.htmlhttp://www.shnenglu.com/jackyxinli/services/trackbacks/209055.html/*
 *  head.s contains the 32-bit startup code.
 *
 * NOTE!!! Startup happens at absolute address 0x00000000, which is also where
 * the page directory will exist. The startup code will be overwritten by
 * the page directory.
 
*/
.text
.globl _idt,_gdt,_pg_dir
_pg_dir:
startup_32:
    movl $0x10,%eax
    mov %ax,%ds
    mov %ax,%es
    mov %ax,%fs
    mov %ax,%gs
    lss _stack_start,%esp
    call setup_idt
    call setup_gdt
    movl $0x10,%eax        # reload all the segment registers
    mov %ax,%ds        # after changing gdt. CS was already
    mov %ax,%es        # reloaded in 'setup_gdt'
    mov %ax,%fs
    mov %ax,%gs
    lss _stack_start,%esp
    xorl %eax,%eax
1:    incl %eax        # check that A20 really IS enabled
    movl %eax,0x000000
    cmpl %eax,0x100000
    je 1b
    movl %cr0,%eax        # check math chip
    andl $0x80000011,%eax    # Save PG,ET,PE
    testl $0x10,%eax
    jne 1f            # ET is set - 387 is present
    orl $4,%eax        # else set emulate bit
1:    movl %eax,%cr0
    jmp after_page_tables

/*
 *  setup_idt
 *
 *  sets up a idt with 256 entries pointing to
 *  ignore_int, interrupt gates. It then loads
 *  idt. Everything that wants to install itself
 *  in the idt-table may do so themselves. Interrupts
 *  are enabled elsewhere, when we can be relatively
 *  sure everything is ok. This routine will be over-
 *  written by the page tables.
 
*/
setup_idt:
    lea ignore_int,%edx
    movl $0x00080000,%eax
    movw %dx,%ax        /* selector = 0x0008 = cs */
    movw $0x8E00,%dx    /* interrupt gate - dpl=0, present */

    lea _idt,%edi
    mov $256,%ecx
rp_sidt:
    movl %eax,(%edi)
    movl %edx,4(%edi)
    addl $8,%edi
    dec %ecx
    jne rp_sidt
    lidt idt_descr
    ret

/*
 *  setup_gdt
 *
 *  This routines sets up a new gdt and loads it.
 *  Only two entries are currently built, the same
 *  ones that were built in init.s. The routine
 *  is VERY complicated at two whole lines, so this
 *  rather long comment is certainly needed :-).
 *  This routine will beoverwritten by the page tables.
 
*/
setup_gdt:
    lgdt gdt_descr
    ret

.org 0x1000
pg0:

.org 0x2000
pg1:

.org 0x3000
pg2:        # This is not used yet, but if you
        # want to expand past 8 Mb, you'll have
        # to use it.

.org 0x4000
after_page_tables:
    pushl $0        # These are the parameters to main :-)
    pushl $0
    pushl $0
    pushl $L6        # return address for main, if it decides to.
    pushl $_main
    jmp setup_paging
L6:
    jmp L6            # main should never return here, but
                # just in case, we know what happens.

/* This is the default interrupt "handler" :-) */
.align 2
ignore_int:
    incb 0xb8000+160        # put something on the screen
    movb $2,0xb8000+161        # so that we know something
    iret                # happened


/*
 * Setup_paging
 *
 * This routine sets up paging by setting the page bit
 * in cr0. The page tables are set up, identity-mapping
 * the first 8MB. The pager assumes that no illegal
 * addresses are produced (ie >4Mb on a 4Mb machine).
 *
 * NOTE! Although all physical memory should be identity
 * mapped by this routine, only the kernel page functions
 * use the >1Mb addresses directly. All "normal" functions
 * use just the lower 1Mb, or the local data space, which
 * will be mapped to some other place - mm keeps track of
 * that.
 *
 * For those with more memory than 8 Mb - tough luck. I've
 * not got it, why should you :-) The source is here. Change
 * it. (Seriously - it shouldn't be too difficult. Mostly
 * change some constants etc. I left it at 8Mb, as my machine
 * even cannot be extended past that (ok, but it was cheap :-)
 * I've tried to show which constants to change by having
 * some kind of marker at them (search for "8Mb"), but I
 * won't guarantee that's all :-( )
 
*/
.align 2
setup_paging:
    movl $1024*3,%ecx
    xorl %eax,%eax
    xorl %edi,%edi            /* pg_dir is at 0x000 */
    cld;rep;stosl
    movl $pg0+7,_pg_dir        /* set present bit/user r/w */
    movl $pg1+7,_pg_dir+4        /*  --------- " " --------- */
    movl $pg1+4092,%edi
    movl $0x7ff007,%eax        /*  8Mb - 4096 + 7 (r/w user,p) */
    std
1:    stosl            /* fill pages backwards - more efficient :-) */
    subl $0x1000,%eax
    jge 1b
    xorl %eax,%eax        /* pg_dir is at 0x0000 */
    movl %eax,%cr3        /* cr3 - page directory start */
    movl %cr0,%eax
    orl $0x80000000,%eax
    movl %eax,%cr0        /* set paging (PG) bit */
    ret            /* this also flushes prefetch-queue */

.align 2
.word 0
idt_descr:
    .word 256*8-1        # idt contains 256 entries
    .long _idt
.align 2
.word 0
gdt_descr:
    .word 256*8-1        # so does gdt (not that that's any
    .long _gdt        # magic number, but it works for me :^)

    .align 3
_idt:    .fill 256,8,0        # idt is uninitialized

_gdt:    .quad 0x0000000000000000    /* NULL descriptor */
    .quad 0x00c09a00000007ff    /* 8Mb */
    .quad 0x00c09200000007ff    /* 8Mb */
    .quad 0x0000000000000000    /* TEMPORARY - don't use */
    .fill 252,8,0            /* space for LDT's and TSS's etc */

jacky_zz 2014-12-08 10:59 鍙戣〃璇勮
]]>
[ASM] boot.shttp://www.shnenglu.com/jackyxinli/archive/2014/12/08/209054.htmljacky_zzjacky_zzMon, 08 Dec 2014 02:59:00 GMThttp://www.shnenglu.com/jackyxinli/archive/2014/12/08/209054.htmlhttp://www.shnenglu.com/jackyxinli/comments/209054.htmlhttp://www.shnenglu.com/jackyxinli/archive/2014/12/08/209054.html#Feedback0http://www.shnenglu.com/jackyxinli/comments/commentRss/209054.htmlhttp://www.shnenglu.com/jackyxinli/services/trackbacks/209054.html|
|    boot.s
|
| boot.s is loaded at 0x7c00 by the bios-startup routines, and moves itself
out of the way to address 0x90000, and jumps there.
|
| It then loads the system at 0x10000, using BIOS interrupts. Thereafter
| it disables all interrupts, moves the system down to 0x0000, changes
| to protected mode, and calls the start of system. System then must
| RE-initialize the protected mode in it's own tables, and enable
| interrupts as needed.
|
| NOTE! currently system is at most 8*65536 bytes long. This should be no
| problem, even in the future. I want to keep it simple. This 512 kB
| kernel size should be enough - in fact more would mean we'd have to move
| not just these start-up routines, but also do something about the cache-
| memory (block IO devices). The area left over in the lower 640 kB is meant
for these. No other memory is assumed to be "physical", ie all memory
| over 1Mb is demand-paging. All addresses under 1Mb are guaranteed to match
| their physical addresses.
|
| NOTE1 abouve is no longer valid in it's entirety. cache-memory is allocated
| above the 1Mb mark as well as below. Otherwise it is mainly correct.
|
| NOTE 2! The boot disk type must be set at compile-time, by setting
| the following equ. Having the boot-up procedure hunt for the right
| disk type is severe brain-damage.
| The loader has been made as simple as possible (had to, to get it
in 512 bytes with the code to move to protected mode), and continuos
| read errors will result in a unbreakable loop. Reboot by hand. It
| loads pretty fast by getting whole sectors at a time whenever possible.

| 1.44Mb disks:
sectors = 18
| 1.2Mb disks:
| sectors = 15
| 720kB disks:
| sectors = 9

.globl begtext, begdata, begbss, endtext, enddata, endbss
.text
begtext:
.data
begdata:
.bss
begbss:
.text

BOOTSEG = 0x07c0
INITSEG = 0x9000
SYSSEG  = 0x1000            | system loaded at 0x10000 (65536).
ENDSEG    = SYSSEG + SYSSIZE

entry start
start:
    mov    ax,#BOOTSEG
    mov    ds,ax
    mov    ax,#INITSEG
    mov    es,ax
    mov    cx,#256
    sub    si,si
    sub    di,di
    rep
    movw
    jmpi    go,INITSEG
go:    mov    ax,cs
    mov    ds,ax
    mov    es,ax
    mov    ss,ax
    mov    sp,#0x400        | arbitrary value >>512

    mov    ah,#0x03    | read cursor pos
    xor    bh,bh
    int    0x10
    
    mov    cx,#24
    mov    bx,#0x0007    | page 0, attribute 7 (normal)
    mov    bp,#msg1
    mov    ax,#0x1301    | write string, move cursor
    int    0x10

| ok, we've written the message, now
| we want to load the system (at 0x10000)

    mov    ax,#SYSSEG
    mov    es,ax        | segment of 0x010000
    call    read_it
    call    kill_motor

if the read went well we get current cursor position ans save it for
| posterity.

    mov    ah,#0x03    | read cursor pos
    xor    bh,bh
    int    0x10        | save it in known place, con_init fetches
    mov    [510],dx    | it from 0x90510.
        
| now we want to move to protected mode 

    cli            | no interrupts allowed !

| first we move the system to it's rightful place

    mov    ax,#0x0000
    cld            | 'direction'=0, movs moves forward
do_move:
    mov    es,ax        | destination segment
    add    ax,#0x1000
    cmp    ax,#0x9000
    jz    end_move
    mov    ds,ax        | source segment
    sub    di,di
    sub    si,si
    mov     cx,#0x8000
    rep
    movsw
    j    do_move

| then we load the segment descriptors

end_move:

    mov    ax,cs        | right, forgot this at first. didn't work :-)
    mov    ds,ax
    lidt    idt_48        | load idt with 0,0
    lgdt    gdt_48        | load gdt with whatever appropriate

| that was painless, now we enable A20

    call    empty_8042
    mov    al,#0xD1        | command write
    out    #0x64,al
    call    empty_8042
    mov    al,#0xDF        | A20 on
    out    #0x60,al
    call    empty_8042

| well, that went ok, I hope. Now we have to reprogram the interrupts :-(
| we put them right after the intel-reserved hardware interrupts, at
int 0x20-0x2F. There they won't mess up anything. Sadly IBM really
| messed this up with the original PC, and they haven't been able to
| rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f,
| which is used for the internal hardware interrupts as well. We just
| have to reprogram the 8259's, and it isn't fun.

    mov    al,#0x11        | initialization sequence
    out    #0x20,al        | send it to 8259A-1
    .word    0x00eb,0x00eb        | jmp $+2, jmp $+2
    out    #0xA0,al        | and to 8259A-2
    .word    0x00eb,0x00eb
    mov    al,#0x20        | start of hardware int's (0x20)
    out    #0x21,al
    .word    0x00eb,0x00eb
    mov    al,#0x28        | start of hardware int's 2 (0x28)
    out    #0xA1,al
    .word    0x00eb,0x00eb
    mov    al,#0x04        | 8259-1 is master
    out    #0x21,al
    .word    0x00eb,0x00eb
    mov    al,#0x02        | 8259-2 is slave
    out    #0xA1,al
    .word    0x00eb,0x00eb
    mov    al,#0x01        | 8086 mode for both
    out    #0x21,al
    .word    0x00eb,0x00eb
    out    #0xA1,al
    .word    0x00eb,0x00eb
    mov    al,#0xFF        | mask off all interrupts for now
    out    #0x21,al
    .word    0x00eb,0x00eb
    out    #0xA1,al

| well, that certainly wasn't fun :-(. Hopefully it works, and we don't
| need no steenking BIOS anyway (except for the initial loading :-).
| The BIOS-routine wants lots of unnecessary data, and it's less
| "interesting" anyway. This is how REAL programmers do it.
|
| Well, now's the time to actually move into protected mode. To make
| things as simple as possible, we do no register set-up or anything,
| we let the gnu-compiled 32-bit programs do that. We just jump to
| absolute address 0x00000, in 32-bit protected mode.

    mov    ax,#0x0001    | protected mode (PE) bit
    lmsw    ax        | This is it!
    jmpi    0,8        | jmp offset 0 of segment 8 (cs)

| This routine checks that the keyboard command queue is empty
| No timeout is used - if this hangs there is something wrong with
| the machine, and we probably couldn't proceed anyway.
empty_8042:
    .word    0x00eb,0x00eb
    in    al,#0x64    | 8042 status port
    test    al,#2        | is input buffer full?
    jnz    empty_8042    | yes - loop
    ret

| This routine loads the system at address 0x10000, making sure
| no 64kB boundaries are crossed. We try to load it as fast as
| possible, loading whole tracks whenever we can.
|
in:    es - starting address segment (normally 0x1000)
|
| This routine has to be recompiled to fit another drive type,
| just change the "sectors" variable at the start of the file
| (originally 18, for a 1.44Mb drive)
|
sread:    .word 1            | sectors read of current track
head:    .word 0            | current head
track:    .word 0            | current track
read_it:
    mov ax,es
    test ax,#0x0fff
die:    jne die            | es must be at 64kB boundary
    xor bx,bx        | bx is starting address within segment
rp_read:
    mov ax,es
    cmp ax,#ENDSEG        | have we loaded all yet?
    jb ok1_read
    ret
ok1_read:
    mov ax,#sectors
    sub ax,sread
    mov cx,ax
    shl cx,#9
    add cx,bx
    jnc ok2_read
    je ok2_read
    xor ax,ax
    sub ax,bx
    shr ax,#9
ok2_read:
    call read_track
    mov cx,ax
    add ax,sread
    cmp ax,#sectors
    jne ok3_read
    mov ax,#1
    sub ax,head
    jne ok4_read
    inc track
ok4_read:
    mov head,ax
    xor ax,ax
ok3_read:
    mov sread,ax
    shl cx,#9
    add bx,cx
    jnc rp_read
    mov ax,es
    add ax,#0x1000
    mov es,ax
    xor bx,bx
    jmp rp_read

read_track:
    push ax
    push bx
    push cx
    push dx
    mov dx,track
    mov cx,sread
    inc cx
    mov ch,dl
    mov dx,head
    mov dh,dl
    mov dl,#0
    and dx,#0x0100
    mov ah,#2
    int 0x13
    jc bad_rt
    pop dx
    pop cx
    pop bx
    pop ax
    ret
bad_rt:    mov ax,#0
    mov dx,#0
    int 0x13
    pop dx
    pop cx
    pop bx
    pop ax
    jmp read_track

/*
 * This procedure turns off the floppy drive motor, so
 * that we enter the kernel in a known state, and
 * don't have to worry about it later.
 
*/
kill_motor:
    push dx
    mov dx,#0x3f2
    mov al,#0
    outb
    pop dx
    ret

gdt:
    .word    0,0,0,0        | dummy

    .word    0x07FF        | 8Mb - limit=2047 (2048*4096=8Mb)
    .word    0x0000        | base address=0
    .word    0x9A00        | code read/exec
    .word    0x00C0        | granularity=4096, 386

    .word    0x07FF        | 8Mb - limit=2047 (2048*4096=8Mb)
    .word    0x0000        | base address=0
    .word    0x9200        | data read/write
    .word    0x00C0        | granularity=4096, 386

idt_48:
    .word    0            | idt limit=0
    .word    0,0            | idt base=0L

gdt_48:
    .word    0x800        | gdt limit=2048, 256 GDT entries
    .word    gdt,0x9        | gdt base = 0X9xxxx
    
msg1:
    .byte 13,10
    .ascii "Loading system "
    .byte 13,10,13,10

.text
endtext:
.data
enddata:
.bss
endbss:

jacky_zz 2014-12-08 10:59 鍙戣〃璇勮
]]>
[ASM] bootsect - nasmhttp://www.shnenglu.com/jackyxinli/archive/2014/11/12/208859.htmljacky_zzjacky_zzWed, 12 Nov 2014 12:23:00 GMThttp://www.shnenglu.com/jackyxinli/archive/2014/11/12/208859.html 

 1 2012.6.30, Jinfeng @ SWUST
 2 ; nasm boot.asm -o boot.bin
 3 
 4     org 07c00h    ; cs:ip = 07c00h
 5 entry:
 6     ; set env
 7     mov ax,cs
 8     mov ds,ax
 9     mov es,ax
10     mov ss,ax
11     mov sp,0x400
12     
13 load_system:
14     mov dx,0x0000
15     mov cx,0x0002
16     
17     mov ax,0x1000
18     mov es,ax
19     xor bx,bx ; [es:bx]
20     
21     mov ax,0x0200+2        ; 1024 bytes
22     int 0x13
23     jnc move_system
24 try_again:
25     jmp load_system
26     
27 move_system:
28     cli            ; don't need BIOS func
29                 ; will open just before 'ret' to task 0 in new mode
30     cld
31     mov ax,0x1000
32     mov ds,ax
33     xor ax,ax 
34     mov es,ax
35     mov cx,0x0200
36     sub si,si
37     sub di,di
38     rep movsb
39     
40 load_gdtr:
41     mov ax,0x0000
42     mov ds,ax
43     
44     mov ax,(gdtr-gdt)
45     mov word [gdtr],ax
46     mov dword [gdtr+2],gdt    ; not 0x7c00+gdt ?
47     
48     lidt [idtr]        ; CPU request IDT before jump into new mode
49     lgdt [gdtr]
50     
51     mov al,0x02 
52     out 0x92,al        ; open A20, enable 32-bit address
53     
54     mov ax,0x0001
55     mov cr0,eax        ; set PE flag in EFLAGS register
56     
57     jmp dword 0x08:0            ; jmp to reset all registers in new mode
58 
59 ;end!!!
60 
61 gdt:    dw 0,0,0,0
62         dw 0x1000,0x0000,0x9a00,0x00c0    ; 16Mb,0x0000,r/x
63         dw 0x1000,0x0000,0x9200,0x00c0    ; 10MB,0x0000,r/w
64         dw 0x0002,0x8000,0x920b,0x00c0    ; 8kb,0xb8000, 4kb<-swap->4kb
65 
66 gdtr:    dw 0x0000,0x0000,0x0000
67 idtr:    dw 0x0000,0x0000,0x0000
68 
69 times 510-($-$$)    db        0
70                     dw         0xaa55

 



jacky_zz 2014-11-12 20:23 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            狠狠久久五月精品中文字幕| 亚洲一区二区三区免费观看| 亚洲日韩视频| 欧美日韩国产bt| 亚洲综合激情| 久久婷婷国产综合尤物精品| 亚洲国产精品久久精品怡红院| 欧美激情女人20p| 亚洲一区二区三区在线| 久久夜色精品国产| 99精品国产一区二区青青牛奶 | 久久久久久久久久久成人| 欧美成人国产| 亚洲一区二区三区影院| 国内在线观看一区二区三区| 女人香蕉久久**毛片精品| 亚洲天堂视频在线观看| 美女在线一区二区| 中文在线资源观看网站视频免费不卡 | 亚洲愉拍自拍另类高清精品| 国产视频亚洲精品| 欧美国产日韩精品| 午夜伦理片一区| 亚洲国产一区二区精品专区| 亚洲小视频在线| 在线观看91精品国产入口| 欧美日韩三级视频| 久久婷婷麻豆| 在线视频亚洲一区| 欧美黄色aaaa| 久久精品国产77777蜜臀| 夜夜爽夜夜爽精品视频| 经典三级久久| 国产精品久久久久久久午夜片 | 国产日韩欧美综合| 欧美日韩成人在线| 久久亚洲视频| 欧美一区二区在线免费播放| 日韩视频免费看| 欧美激情网站在线观看| 久久精品视频免费播放| 亚洲在线中文字幕| 亚洲精品人人| 在线欧美日韩国产| 国产综合色产| 国产精品网站视频| 欧美视频在线视频| 欧美好吊妞视频| 老牛嫩草一区二区三区日本| 久久av一区二区三区| 亚洲深夜激情| 一本色道久久88精品综合| 欧美激情精品久久久久久久变态| 久久久久.com| 久久岛国电影| 欧美在线你懂的| 欧美亚洲一区三区| 亚洲欧美日韩精品久久亚洲区 | 欧美国产另类| 欧美激情精品久久久久久久变态| 久久综合伊人77777麻豆| 久久久久国产精品厨房| 欧美在线视频观看免费网站| 亚洲一级片在线看| 亚洲一区二区精品在线| 亚洲一区观看| 亚洲欧美网站| 欧美一区久久| 久久青草欧美一区二区三区| 久久久久久久成人| 男人插女人欧美| 欧美国产日韩一区二区| 欧美激情一区二区三区在线视频观看| 男男成人高潮片免费网站| 欧美成人69| 欧美精品一区三区在线观看| 欧美精品国产一区| 欧美体内谢she精2性欧美| 欧美午夜片在线观看| 国产精品久久久久久久久搜平片| 国产精品私拍pans大尺度在线| 国产精品毛片a∨一区二区三区| 国产精品资源| 国内精品国语自产拍在线观看| 在线播放不卡| 亚洲精品一区中文| 亚洲一区二区在线免费观看| 欧美一区二区三区啪啪| 久久综合狠狠综合久久综青草| 六月婷婷一区| 亚洲精品一区二区在线观看| 在线视频欧美日韩精品| 性久久久久久久| 免费不卡中文字幕视频| 欧美三级电影精品| 国产深夜精品| 亚洲日本中文字幕免费在线不卡| 在线一区欧美| 久久久久国内| 91久久国产综合久久| 一本一本久久| 久久裸体视频| 欧美日韩在线免费| 国产自产在线视频一区| 99re8这里有精品热视频免费 | 亚洲国产欧美日韩另类综合| 99re66热这里只有精品3直播| 亚洲欧美日韩人成在线播放| 久久人人超碰| 亚洲精品一区在线观看香蕉| 欧美亚洲在线观看| 欧美精品福利视频| 国语自产偷拍精品视频偷 | 亚洲一区一卡| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美私人网站| 亚洲高清免费在线| 欧美在线视频观看| 亚洲国产合集| 久久不见久久见免费视频1| 欧美精品日韩| 亚洲大片在线| 久久xxxx| 一区二区三区 在线观看视频| 久久婷婷国产综合国色天香| 国产精品爱久久久久久久| 亚洲国产精品黑人久久久| 欧美亚洲视频在线观看| 亚洲精品国产精品国产自| 久久久久久久网| 国产精品久久网| 一区二区黄色| 亚洲成在人线av| 久久精品男女| 国产欧美日韩中文字幕在线| 国产精品99久久久久久白浆小说| 蘑菇福利视频一区播放| 欧美一区二区黄| 国产精品资源在线观看| 亚洲综合国产激情另类一区| 亚洲国产裸拍裸体视频在线观看乱了 | 欧美日韩国产综合视频在线观看| 亚洲电影在线免费观看| 久久久亚洲一区| 亚洲欧美视频在线观看视频| 欧美视频日韩| 亚洲无限av看| 中文精品视频| 国产精品成人va在线观看| 一本到12不卡视频在线dvd| 模特精品在线| 另类尿喷潮videofree| 在线观看一区欧美| 噜噜噜躁狠狠躁狠狠精品视频 | 久久久精品久久久久| 国产视频亚洲精品| 久久精品国产91精品亚洲| 午夜精彩视频在线观看不卡| 国产精品日韩电影| 欧美在线免费看| 香蕉久久一区二区不卡无毒影院| 国产精品一二一区| 欧美一区二区视频97| 午夜亚洲激情| 红桃视频一区| 欧美国产亚洲精品久久久8v| 欧美www在线| 日韩亚洲欧美一区| 亚洲美洲欧洲综合国产一区| 欧美日韩一区二区三区视频| 宅男噜噜噜66一区二区 | 欧美日韩一卡二卡| 亚洲欧美日韩一区二区| 亚洲一区日韩在线| 国产一区二区日韩精品| 久久综合亚州| 欧美精品国产一区| 午夜精品理论片| 欧美一级淫片aaaaaaa视频| 国产中文一区二区| 欧美福利电影网| 欧美三级视频在线观看| 午夜在线一区二区| 久久免费视频在线观看| 99精品视频免费在线观看| 一本色道久久综合狠狠躁篇的优点 | 亚洲欧美另类综合偷拍| 香港久久久电影| 亚洲国产专区| 一本色道久久综合一区| 国产一区二区三区久久久久久久久| 美女啪啪无遮挡免费久久网站| 欧美激情麻豆| 欧美亚洲一区| 欧美成黄导航| 欧美一区2区视频在线观看| 久久精品夜色噜噜亚洲aⅴ| 亚洲精品久久久久久久久久久久久 | 国产欧美精品在线| 亚洲福利专区|