GithubHelp home page GithubHelp logo

30_day_os's Introduction

Note

cpu -> bios -> floppy(first sector to 0x7c00, and pc to 0x7c00)

0x7c00会加载第一扇区,到0x7dff。所以0x7e00到0x9fbff没有人用 18个扇区换柱面

这里的软盘是10个柱面,每个柱面18个扇区

每个扇区为512个字节

nasm

nasm EQU used to define constant.

x86 assembly

write to screen

putLoop:
    mov al, [si]    ; just check '\0'
    cmp al, 0
    je fi           ; this is the dnd
    mov ah, 0xe		; ah is the color
    int 0x10		; 0x10 is put a char to screen, bx, is the color, al is the charactor
    add si, 1
    jmp putLoop

int 0x13 read floppy

; will read to [es:bx]

mov ax, 0x7e00  ; jiazai 加载地址
mov es, ax		; read dest memory location

mov bl, 0		; 1st floppy disk ( "drive A:" )
mov ah, 2		; Read Sectors From Drive

; sector 扇面
; cylinder 柱面
; Register CX contains both the cylinder number (10 bits, possible values are 0 to 1023) 
; and the sector number (6 bits, possible values are 1 to 63). 
; Cylinder and Sector bits are numbered below:
; CX =       ---CH--- ---CL---
; cylinder : 76543210 98
; sector   :            543210

mov cx, 0       ; , start from 1, value 1 to 63
mov ch, 0		; 柱面
mov cl, 0		; 扇区

mov dh, 0		; head 0 or 1
mov dl, 0       ; Devier, but for now, I don't know what's this
mov al, 1		; setors to read count

mov bx, 0
int 0x13		; 磁盘读写方法
jc error		; carry is has error

软盘

a sector is 521(0x200) byte

写软盘

文件名写到0x002600 文件内容写到0x004200

C0-H0-S1

柱面0磁头0扇区1

locations

The content is write to floopy offset 0x004200. the ipl load floppy at location 0x8000, so we need jump to 0xc200

Locations

0x7c00 - 0x7dff(521 byte) is the boot location, bios will read the floppy first secotr to here, and jmp to here!

0x8000 + 0x4200 = 0xc200

Link

30_day_os's People

Contributors

huhuang03 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.