面向对象相关
2016-01-27 18:00
260 查看
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;filename bios.inc
;asm macro about the bios
;create on 06.3.10 by yqg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;**************setmode macro*****************;
setmode macro var
push ax
mov ah,0
mov al,var
int 10h ;set the screen mode
pop ax
endm
;*************setmode endm********************;
;***********setpixel macro**********************;
;notice that this is can use in 13mode
;it direct set rom from 0xa0000000
;notice the x,y only can use reg by bl,al
setpixel MACRO x,y,color
PUSH ES
PUSH DI
PUSH AX
push dx
MOV AX,0a000h
MOV ES,AX
mov al,y
mov ah,0
mov bl,160
mul bl
mov bx,2
mul bx ;this here will made dx 0
pop dx
push dx
mov bl,x
mov bh,0
add ax,bx ;location,only a 1 kb,don't afraid to overflow
mov DI,ax
MOV AL,color
MOV ES:[DI],AL ;set color
pop dx
POP AX
POP DI
POP ES
ENDM
;***********setpixel endm*************************;
;--------------------------------------------------;
;***********setbkcolor macro************************;
setbkcolor macro color
local again
PUSH ES
PUSH DI
PUSH AX
push cx
MOV AX,0a000h
MOV ES,AX
XOR DI,DI
MOV AL,color
mov cx,64000
again:
MOV ES:[DI],AL ;set color
inc di
loop again
pop cx
POP AX
POP DI
POP ES
endm
;***********line macro*****************************;
;notice the line now only can draw straight
;that meant that x1=x2 or y1=y2
line macro x1,y1,x2,y2,color
local again,again1
PUSH ES
PUSH DI
PUSH AX
push cx
MOV AX,0a000h
MOV ES,AX
XOR DI,DI
mov di,x1+y1*320 ;across line
MOV AL,color
mov cx,x2-x1+1
again:
MOV ES:[DI],AL ;set color
inc di
loop again
mov di,x1+y1*320
MOV AL,color
mov cx,y2-y1+1
again1:
MOV ES:[DI],AL
add di,320
loop again1
pop cx
POP AX
POP DI
POP ES
endm
;***********line endm****************************;
;---------------------------------------------------;
;**************box endm******************************;
box macro x1,y1,x2,y2,color
line x1,y1,x2,y1,color
line x1,y1,x1,y2,color
line x1,y2,x2,y2,color
line x2,y1,x2,y2,color
endm
;***************box endm******************************;
;************outchar macro********************;
outchar macro x,y,char,color
local again,again1,next
push es
push bp
push ax
push bx
push cx
push dx
mov ax,0f000h
mov es,ax
mov bp,0fa6eh
add bp,char*8 ;get the char address
mov cx,8
mov dl,x
mov dh,y
again1:
push cx
mov ah,es:[bp]
mov cx,8
again:
rcl ah,1
jnc next
setpixel dl,dh,color
next:
inc dl
loop again
mov dl,x
pop cx
inc dh
inc bp
loop again1
pop dx
pop cx
pop bx
pop ax
pop bp
pop es
endm
;*************outchar endm*******************;
;filename bios.inc
;asm macro about the bios
;create on 06.3.10 by yqg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;**************setmode macro*****************;
setmode macro var
push ax
mov ah,0
mov al,var
int 10h ;set the screen mode
pop ax
endm
;*************setmode endm********************;
;***********setpixel macro**********************;
;notice that this is can use in 13mode
;it direct set rom from 0xa0000000
;notice the x,y only can use reg by bl,al
setpixel MACRO x,y,color
PUSH ES
PUSH DI
PUSH AX
push dx
MOV AX,0a000h
MOV ES,AX
mov al,y
mov ah,0
mov bl,160
mul bl
mov bx,2
mul bx ;this here will made dx 0
pop dx
push dx
mov bl,x
mov bh,0
add ax,bx ;location,only a 1 kb,don't afraid to overflow
mov DI,ax
MOV AL,color
MOV ES:[DI],AL ;set color
pop dx
POP AX
POP DI
POP ES
ENDM
;***********setpixel endm*************************;
;--------------------------------------------------;
;***********setbkcolor macro************************;
setbkcolor macro color
local again
PUSH ES
PUSH DI
PUSH AX
push cx
MOV AX,0a000h
MOV ES,AX
XOR DI,DI
MOV AL,color
mov cx,64000
again:
MOV ES:[DI],AL ;set color
inc di
loop again
pop cx
POP AX
POP DI
POP ES
endm
;***********line macro*****************************;
;notice the line now only can draw straight
;that meant that x1=x2 or y1=y2
line macro x1,y1,x2,y2,color
local again,again1
PUSH ES
PUSH DI
PUSH AX
push cx
MOV AX,0a000h
MOV ES,AX
XOR DI,DI
mov di,x1+y1*320 ;across line
MOV AL,color
mov cx,x2-x1+1
again:
MOV ES:[DI],AL ;set color
inc di
loop again
mov di,x1+y1*320
MOV AL,color
mov cx,y2-y1+1
again1:
MOV ES:[DI],AL
add di,320
loop again1
pop cx
POP AX
POP DI
POP ES
endm
;***********line endm****************************;
;---------------------------------------------------;
;**************box endm******************************;
box macro x1,y1,x2,y2,color
line x1,y1,x2,y1,color
line x1,y1,x1,y2,color
line x1,y2,x2,y2,color
line x2,y1,x2,y2,color
endm
;***************box endm******************************;
;************outchar macro********************;
outchar macro x,y,char,color
local again,again1,next
push es
push bp
push ax
push bx
push cx
push dx
mov ax,0f000h
mov es,ax
mov bp,0fa6eh
add bp,char*8 ;get the char address
mov cx,8
mov dl,x
mov dh,y
again1:
push cx
mov ah,es:[bp]
mov cx,8
again:
rcl ah,1
jnc next
setpixel dl,dh,color
next:
inc dl
loop again
mov dl,x
pop cx
inc dh
inc bp
loop again1
pop dx
pop cx
pop bx
pop ax
pop bp
pop es
endm
;*************outchar endm*******************;
相关文章推荐
- 2、vuejs五脏
- 新手入门之DirectX入门
- 元胞自动机
- jQuery动态绑定
- $.getJSON设置异步请求和同步请求
- bitbucket入门手册
- Hdu 2012 素数判定
- js022-高级技巧
- 干货博客
- js位置对浏览器加载页面的影响
- Oracle:ORA-28056: Writing audit records to Windows Event Log failed
- 什么是垃圾回收
- apache tomcat 集群!
- js021-Ajax与Comet
- PopupWindow上弹出另一个PopupWindow报异常解决办法
- Sharepoint部署配置向导
- OnTrimMemory的使用
- 浅谈Activity的常用Flags
- 多个storyboard开发应用程序,封装.bundle和.a不用xib使用storyboard!!!
- 初学IOS之启动页面