CLR of Assembly Source series

Source: Internet
Author: User

This is the past DOS era of the compilation of source code, although has passed, but for the study of the assembly is still helpful, assembly language is just a basic programmer language, most people can grasp, not necessarily in-depth research.

PAGE 60,132
; Clr. ASM 05/29/84
; Subroutine called by a basic program to scroll a window.
;
;
Dgroup GROUP dataseg
Dataseg SEGMENT PARA Public ' DATA '
funct DW 0; function 1=6,0=7
FG_COLR DW 0; Forground color
BG_COLR DW 0; Backround color
LINES DW 0; Number of LINES to scroll or 0 for clear
Ulrow DW 0; upper left row
Ulcol DW 0; upper left column
Lrrow DW 0; lower right row
Lrcol DW 0; lower left column
ATTRIB DB 0; temp hold for attribute byte
Calnu DB 0; temp hold for Call function 6 or 7
Dataseg ENDS
;
Cseg SEGMENT ' CODE '
Assume Cs:cseg
Public CLR
CLR PROC FAR
PUSH BP; BP Unknown (don ' t care)
MOV BP,SP set base for Parm list
PUSH DS;D s-> basic work area
PUSH es; es-> basic Work area
MOV ax,dataseg; Establish data addressability
MOV Ds,ax now DS-> my data
Assume Ds:dataseg
;
;
MOV si,ss:[bp+6]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Funct,ax
MOV si,ss:[bp+8]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Bg_colr,ax
MOV si,ss:[bp+10]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Fg_colr,ax
MOV si,ss:[bp+12]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Lines,ax
MOV si,ss:[bp+14]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Ulrow,ax
MOV si,ss:[bp+16]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Ulcol,ax
MOV si,ss:[bp+18]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Lrrow,ax
MOV si,ss:[bp+20]; get addr of parameter
MOV Ax,es:[si]; get value of Parm
MOV Lrcol,ax
;
MOV ax,1
SUB lrrow,ax; convert 1-80 cols
SUB Lrcol,ax; and 1-25 rows into
SUB Ulrow,ax; 0-79 cols and
SUB Ulcol,ax; 0-24 rows
;
; Change Forground & backround colors to single byte
;
MOV BX,FG_COLR Move foreground color to BX
MOV al,bl Move Lower byte to AL
MOV BX,BG_COLR Move backround color to BX
MOV ah,bl Move Lower byte to AH
CMP al,15 check for color > IE blinking
JG Blnk if > then set blink bit
and al,15; set normal FG Color
JMP N_blnk;
Blnk:or al,128 set Blink bit 7
and al,143 zero out bit 6,5,4 used for backround
N_blnk:and ah,7 zero out bit 7,6,5,4,3 used for Forground
MOV cl,4 4 Bit shift count
SHL AH,CL shift right 3 bits to POS 6,5,4
or Al,ah combine for & back to form attribute byte
MOV Attrib,al Move it to STORAGE
;
; Convert 1 and 0 to 6 and 7 for routine call
;
MOV bx,funct move function into BX
CMP bl,0; compare to one
JG F6 If 1 then function is 6
MOV ah,7h Set function 7
JMP OUT1; Jump Around
F6:mov ah,6h; Set function 6
Out1:mov Calnu,ah Move it to storage
;
;
; Set up to BIOS ROM call function 6 (scroll up)
;
PUSH BX
MOV Bx,lines Set # of LINES to scroll or 0 to clear
MOV AL,BL;p ut in pass Register
MOV Bx,ulrow Set upper left row of block 0-24
MOV CH,BL;p ut in pass Register
MOV Bx,ulcol set upper left column of block 0-79
MOV CL,BL;p ut in pass Register
MOV Bx,lrrow Set lower right row of block 0-24
MOV DH,BL;p ut in pass Register
MOV Bx,lrcol set lower right column of block 0-79
MOV DL,BL;p ut in pass Register
MOV Bl,calnu Set CALL number 6 to scroll up 7 down
MOV AH,BL;p ut in pass Register
MOV bl,attrib; set color attribute byte
MOV BH,BL;p ut in pass Register
INT 10H; Make BIOS call
POP BX
;
Finish:pop ES
POP DS
POP BP
RET to Basic
CLR ENDP
Cseg ENDS
End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.