refpy.asm

来自「一个朋友写的操作系统源码」· 汇编 代码 · 共 70 行

ASM
70
字号
sseg segment STACK

     db 128 dup (0)

sseg ends

dseg segment 'data'

     filename db 'floppy.bin','0'

dseg ends

cseg segment 'code'

     assume cs:cseg;ds:dseg

start:
      ;read floppy boot block into 87C00

      mov ax,8000h
      mov es,ax
      mov bx,7c00h
      mov ax,201h
      mov dl,0
      mov dh,0
      mov ch,0
      mov cl,1
      int 13h

      ;use dos file system service to write it into floppy.bin file at current directory

      ;create a file

      mov ax,dseg
      mov ds,ax
      mov dx,offset filename
      mov cx,0
      mov ah,3ch
      int 21h

      ;write to it

      mov bx,ax
      mov ax,8000h
      mov ds,ax
      mov dx,7c00h
      mov ah,40h
      mov cx,200h
      int 21h

      ;close it

      mov ah,3eh
      int 21h

      mov ah,4ch
      int 21h

      ;mission successful

cseg ends

end start






⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?