当前位置: 首页 > 工具软件 > Bios-lt > 使用案例 >

bios开发 c语言,如何编写bios

商弘义
2023-12-01

调试已通过,100个数据太长了吧,我这就给出30个成绩记录

data segment

credit dw 76,69,84,90,73,88,99,63,100,80,45,64,24,36,51,20,19,86,89,90,76,69,84,90,73,88,99,63,100,80

mes1 db '<60:$'

mes2 db '60-85:$'

mes3 db '>85:$'

v1 dw 0

v2 dw 0

v3 dw 0

data ends

code segment

assume cs:code,ds:data

main proc far

start:

mov ax,data

mov ds,ax

call count ;统计各分段人数的子程序

mov ah,4ch

int 21h

ret

main endp

;------------------------------

count proc near

lea si,credit

mov cx,30

m1:mov bx,[si]

add si,2

cmp bx,60

jg m2

inc v1

jmp m4

m2:cmp bx,85

jg m3

inc v2

jmp m4

m3:inc v3

m4:loop m1

mov dx,offset mes1

mov ah,09h

int 21h

mov bx,v1

call bini

call crlf

mov dx,offset mes2

mov ah,09h

int 21h

mov bx,v2

call bini

call crlf

mov dx,offset mes3

mov ah,09h

int 21h

mov bx,v3

call bini

ret

count endp

;-----------------------------

bini proc near

mov cx,10d

call bin

mov cx,1d

call bin

ret

bini endp

bin proc near

mov ax,bx

mov dx,0

div cx

mov bx,dx

mov dl,al

add dl,30h

mov ah,02h

int 21h

ret

bin endp

;-------------------------------

crlf proc near ;回车换行子程序

mov dl,0ah

mov ah,02h

int 21h

mov dl,0dh

mov ah,02h

int 21h

ret

crlf endp

;-------------------------------

code ends

end start

取消

评论

 类似资料: