📄 pcrom.htm
字号:
;***********************************************************************
PTY _getvect
save ; Get Interrupt vector ROM version
push dx
mov al, byte ptr [bp+base] ; al has interrupt number to set
push bx
push es ; save segment registers
mov ah, 00h ; zero out ah
rol ax,1 ; *2
rol ax,1 ; *4
mov bx,ax ; use based addressing
xor ax,ax ; make es point to int table seg=0000
mov es,ax ; establish addressibility
mov dx, es:[bx+2] ; get segment
mov ax, es:[bx] ; get offset
pop es
pop bx
pop dx
restore
ret
_getvect ENDP
;***********************************************************************
; void setvect( int intnumber, unsigned int seg, unsigned int off )
; Set interrupt vector
;***********************************************************************
PTY _setvect
save ; Set Interrupt vector ROM version
mov al, byte ptr [bp+base] ; al has interrupt number to set
push bx
push dx
push es ; save segment registers
mov ah, 00h ; zero out ah
rol ax,1 ; *2
rol ax,1 ; *4
mov bx,ax ; use based addressing
xor ax,ax ; make es point to int table seg=0000
mov es,ax ; establish addressibility
mov dx,[bp+base+2] ; get segment parameter
mov es:[bx+2], dx ; store segment
mov dx,[bp+base+4] ; get offset parameter
mov es:[bx],dx ; store offset
pop es
pop dx
pop bx
restore
ret
_setvect ENDP
;***********************************************************************
; void setvmode( int videomode ) Set video screen mode
;***********************************************************************
PTY _setvmode
save ; Set Video Screen Mode
mov ah, 00h
mov al, byte ptr [bp+base]
int 10h
restore
ret
_setvmode ENDP
;***********************************************************************
; void setvcurs( int startline, int endline )
; Set video cursor type
;***********************************************************************
PTY _setvcurs
save ; Set Video Cursor Characteristics
push cx
mov ah, 01h
mov ch, byte ptr [bp+base]
mov cl, byte ptr [bp+base+2]
int 10h
pop cx
restore
ret
_setvcurs ENDP
;***********************************************************************
; void setvcpos( int xpos, int ypos, int vpage )
; Set video cursor position on specified page
;***********************************************************************
PTY _setvcpos
save ; Set Video Cursor Position
push cx
push bx
push dx
mov ah, 02h
mov dl, byte ptr [bp+base]
mov dh, byte ptr [bp+base+2]
mov bh, byte ptr [bp+base+4]
int 10h
pop dx
pop bx
pop cx
restore
ret
_setvcpos ENDP
;***********************************************************************
; int getvcpos( int vpage )
; Get video cursor position on specified page
; AH = row, AL = column
;***********************************************************************
PTY _getvcpos
save ; Get Video Cursor Position
push dx
push cx
push bx
mov ah, 03h
mov bh, byte ptr [bp+base]
int 10h
mov ax,dx
pop bx
pop cx
pop dx
restore
ret
_getvcpos ENDP
;***********************************************************************
; void setvpage( int vpage ) Set video to specified page
;***********************************************************************
PTY _setvpage
save ; Set Video Page
push dx
push cx
push bx
mov ah, 05h
mov al, byte ptr [bp+base]
int 10h
pop bx
pop cx
pop dx
restore
ret
_setvpage ENDP
;***********************************************************************
; void scrollvup( int top_leftx, int top_lefty, int btm_rghtx, int btm_rghty,
; int attribute, int lines_to_scroll )
; Scroll video page up
;***********************************************************************
PTY _scrollvup
save ; Scroll window up
push dx
push cx
push bx
mov ah, 06h
mov cl, byte ptr [bp+base]
mov ch, byte ptr [bp+base+2]
mov dl, byte ptr [bp+base+4]
mov dh, byte ptr [bp+base+6]
mov bh, byte ptr [bp+base+8]
mov al, byte ptr [bp+base+10]
int 10h
pop bx
pop cx
pop dx
restore
ret
_scrollvup ENDP
;***********************************************************************
; void scrollvdn( int top_leftx, int top_lefty, int btm_rghtx, int btm_rghty,
; int attribute, int lines_to_scroll )
; Scroll video page down
;***********************************************************************
PTY _scrollvdn
save ; Scroll window down
push dx
push cx
push bx
mov ah, 07h
mov cl, byte ptr [bp+base]
mov ch, byte ptr [bp+base+2]
mov dl, byte ptr [bp+base+4]
mov dh, byte ptr [bp+base+6]
mov bh, byte ptr [bp+base+8]
mov al, byte ptr [bp+base+10]
int 10h
pop bx
pop cx
pop dx
restore
ret
_scrollvdn ENDP
;***********************************************************************
; int getvattrchar( int video_page )
; Return attribute and character at current cursor position
; AH = attr, AL = char
;***********************************************************************
PTY _getvattrchar
save ; Read attribute and character
push bx
mov ah, 08h
mov bh, byte ptr [bp+base]
int 10h
pop bx
restore
ret
_getvattrchar ENDP
;***********************************************************************
; void setvattrchar( int video_page, int char, int attribute, int number )
; Write attribute and character(s) at current cursor position
;***********************************************************************
PTY _setvattrchar
save ; Write attribute and character
push bx
push cx
mov ah, 09h
mov bh, byte ptr [bp+base]
mov al, byte ptr [bp+base+2]
mov bl, byte ptr [bp+base+4]
mov cx, [bp+base+6]
int 10h
pop cx
pop bx
restore
ret
_setvattrchar ENDP
;***********************************************************************
; void setvchar( int video_page, int char, int number )
; Write character(s) at current cursor position
;***********************************************************************
PTY _setvchar
save ; Write character
push bx
push cx
mov ah, 0Ah
mov bh, byte ptr [bp+base]
mov al, byte ptr [bp+base+2]
mov cx, [bp+base+4]
int 10h
pop cx
pop bx
restore
ret
_setvchar ENDP
;***********************************************************************
; void setvpall( int palette_color, int color_value )
;***********************************************************************
PTY _setvpall
save ; Set palette, medium res CGA
push bx
mov ah, 0Bh
mov bh, byte ptr [bp+base]
mov bl, byte ptr [bp+base+2]
int 10h
pop bx
restore
ret
_setvpall ENDP
;***********************************************************************
; int setvdot( int xpos, int ypos, int color_value )
;***********************************************************************
PTY _setvdot
save ; Write pixel
push dx
push cx
mov ah, 0Ch
mov cx, [bp+base]
mov dx, [bp+base+2]
mov al, byte ptr [bp+base+4]
int 10h
pop cx
pop dx
restore
ret
_setvdot ENDP
;***********************************************************************
; int getvdot( int xpos, int ypos )
;***********************************************************************
PTY _getvdot
save ; Read pixel color value
push dx
push cx
mov ah, 0Dh
mov cx, [bp+base]
mov dx, [bp+base+2]
int 10h
pop cx
pop dx
restore
ret
_getvdot ENDP
;***********************************************************************
; void setvstring( int char, int video_page, int med_res_color_value )
;***********************************************************************
PTY _setvstring
save ; Write tty string
push bx
mov ah, 0Eh
mov al, byte ptr [bp+base]
mov bh, byte ptr [bp+base+2]
mov bl, byte ptr [bp+base+4]
int 10h
pop bx
restore
ret
_setvstring ENDP
;***********************************************************************
; int getvmode( void )
;***********************************************************************
PTY _getvmode
save ; Return Video Mode Status
mov ah, 0Fh ; BH = active_page
int 10h ; AL = Mode, AH = Columns
restore
ret
_getvmode ENDP
;***********************************************************************
; void savevscrn( char far *buffer, int screen_type )
; save video memory into buffer
; screen_type = 0 = mono, 1 for CGA
;***********************************************************************
PTY _savevscrn
save ; Save video memory
push ds
push es
push ax
push cx
push si
push di
mov ax, [bp+base+4]
cmp ax, 00h
jne short svid0
mov ax,0b800h
jmp short svid1
svid0: mov ax, 0b000h
svid1: mov ds,ax
mov ax, [bp+base+2]
mov es, ax
mov di, [bp+base]
xor si, si
mov cx, 4096
rep movsb
pop di
pop si
pop cx
pop ax
pop es
pop ds
restore
ret
_savevscrn ENDP
;***********************************************************************
; void getvscrn( char far *buffer, int screen_type )
; get video buffer into screen memory
; screen_type = 0 = mono, 1 for CGA
;***********************************************************************
PTY _getvscrn
save ; Restore video memory
push ds
push es
push ax
push cx
push si
push di
mov ax, [bp+base+4]
cmp ax, 00h
jne short gvid0
mov ax,0b800h
jmp short gvid1
gvid0: mov ax, 0b000h
gvid1: mov es,ax
mov ax, [bp+base+2]
mov ds, ax
mov si, [bp+base]
xor di, di
mov cx, 4096
rep movsb
pop di
pop si
pop cx
pop ax
pop es
pop ds
restore
ret
_getvscrn ENDP
;***********************************************************************
; void printstr( char *string )
; print a null terminated string
;***********************************************************************
PTY _printstr
save ;
push ds
push si
push bx
push cx
ifdef LARGE
mov ax, [bp+base+2]
mov ds, ax
endif
mov si, [bp+base] ; point to message
pstr0: mov al, [si] ; get character
cmp al, 00h ; end of string?
je short pstr1
call _getvmode ; get video page into bh
mov cx,0001h
push cx ; medium res color
push bx ; video page
push ax ; character
call _setvstring ; print character, bump cursor
add sp,6 ; readj stack
inc si ; point to next char in string
jmp short pstr0
pstr1: pop cx
pop bx
pop si
pop ds
restore
ret
_printstr ENDP
;***********************************************************************
; void beep( void )
; beep speaker at 1000hz for 500ms
;***********************************************************************
PTY _beep
save ; beep speaker
push ax
push cx
mov al,10110110b
out timer+3, al
mov ax, 533h
out timer+2, al
mov al, ah
out timer+2, al
in al, port_b
mov ah, al
or al, 03h
out port_b, al
sub cx, cx
beep0: loop beep0
mov al, ah
out port_b, al
pop cx
pop ax
restore
ret
_beep ENDP
;***********************************************************************
; void enable( void )
; enable interrupts
;***********************************************************************
PTY _enable
save ; enable interrupts
sti
restore
ret
_enable ENDP
;***********************************************************************
; void disable( void )
; disable interrupts
;***********************************************************************
PTY _disable
save ; disable interrupts
cli
restore
ret
_disable ENDP
CODE ENDS
END
</PRE>
<HR>
© Copyright Brian Brown, CIT, May 1989<BR>
<A HREF="default.htm"><IMG SRC="images/menu.gif" ALT="menu"></A>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -