开发8088的rom固件方法步骤(一)

开发8088rom固件方法步骤(一)

1.emulator打开所提供的BOOT源代码

2.添加自己想要测试的汇编程序

3.编译生成二进制烧录文件

4.用编程器烧写固件

首先用编程器软件,打开要进行烧录的二进制文件。具体看你说选用的编程器的种类和型号了。8088单板机采用的ROMW27C512,对于这个型号,一般的编程器都是支持的。

      接下来,要手动编写一些二进制代码,具体的位置是地址FFF0开始的5个联系地址单元,如下图所示,录入“EA 00 00 00 F0,这样烧录8088单板机的固件准备工作就准备完毕了。

EA 00 00 00 F0 ,其实是汇编指令 JMP  F000:0000 FFF08088CPU上电复位后的首个取指令的地方,在此处放置一个长跳转,跳到boot代码的开始之处。

5.测试固件

将烧写好的W27C512重新插到8088单板机上,上电进行测试,发所添加的串口输出字符串,在串口助手上正确的显示出来了。

6.网上查阅的相关参考资料

6.1 操作系统引导扇区代码

code segment use16

assume cs:code

org 7c00h

start:

; Main program

main:             ; Label for the start of the main program

 mov ax,0000h      ; Setup the Data Segment register

              ; Location of data is DS:Offset

 mov ds,ax    ; This can not be loaded directly it has to be in two steps.

              ; 'mov ds, 0000h' will NOT work due to limitations on the CPU

 mov si,offset HelloWorld     ; Load the string into position for the procedure.

 call PutStr    ; Call/start the procedure

jmp $             ; Never ending loop

; Procedures

PutStr:           ; Procedure label/start

 ; Set up the registers for the interrupt call

 mov ah,0Eh  ; The function to display a chacter (teletype)

 mov bh,00h  ; Page number

 mov bl,07h   ; Normal text attribute

nextchar: ; Internal label (needed to loop round for the next character)

 lodsb            ; I think of this as LOaD String Block

              ; (Not sure if thats the real meaning though)

              ; Loads [SI] into AL and increases SI by one

 ; Check for end of string '0'

 or al,al   ; Sets the zero flag if al = 0

              ; (OR outputs 0's where there is a zero bit in the register)

 jz return ; If the zero flag has been set go to the end of the procedure.

              ; Zero flag gets set when an instruction returns 0 as the answer.

 int 10h   ; Run the BIOS video interrupt

 jmp nextchar ; Loop back round to the top

return:            ; Label at the end to jump to when complete

 ret         ; Return to main program

; Data

HelloWorld db 'Hello World',13,10,0

db 510-($-start) dup(0)  ; Fill the rest of the sector with zero's

dw 0AA55h ; Add the boot loader signature to the end

code ends

end start

6.2 用数据定义的形式实现代码指令

前面用到的EA 00 00 00 F0就是按照这样的方式实现的

jmp 1000h:0 可以直接填写机器码
Loop s1
db 0EAH ;长跳
DW 0 ;偏移
DW 1000H ;

///

led_port      equ   800h

   org  0h

start:

      nop

         ;MOV DX,800H   ;800H是板子上8LED的端口地址号

         mov dx,led_port

      MOV AL,0aaH   ;一亮一灭间隔点亮

      OUT DX,AL

         jmp start

   nop

   nop

   nop

   nop

   TIMES 0FFF0H-($-$$) DB 0

   ;JMP  word 0F000H:label ;Not clear why but need long jump for board hardware

   jmp word 0f000h:0000h

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

iCxhust

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值