📄 llagrp.asm
字号:
mov ss:ArraySeg,ds ;save updated array segment
pop ds
ASSUME DS:DGROUP
mov ArrayOff,si ; and offset
cEnd
;***
;B$PaintInit - Initialize for [b$ScanL] and [b$ScanR]
;OEM-interface routine
;
;Purpose:
; This routine is called once for each user paint request.
; It must determine if the boarder attribute is legal for
; the current screen mode, and if it is legal it should be
; stored for later use. It should also provide any
; initialization needed for the PAINT support routines
; [b$ScanL] and [b$ScanR].
;
; In general, painting is accomplished by starting from
; the entry point and painting right to the border then
; returning to the entry point and painting left to the
; border. Then go up one line and repeat the paint right
; paint left procedure. Next go down two lines and repeat.
; Since [b$ScanR] and [b$ScanL] are called so many times
; for this one function, it is important that they be
; optimized for speed. Any precomputations that can be done
; outside of these routines will have a measurable effect on
; the running time of a PAINT command.
;
; Note: The following OEM routines are only called during
; a PAINT command, thus will always be proceeded by B$PaintInit.
;
; [b$ChkDown]
; [b$ChkUp]
; [b$LeftC]
; [b$PaintBound]
; [b$ScanL]
; [b$ScanR]
; [b$SetTile]
;
;Entry:
; [AL] = prospective border attribute
;
;Exit:
; PSW.C = set implies legal border attribute
; PSW.C = reset implies illegal border attribute.
;
;Uses:
; Per convention.
;
;Exceptions:
; none
;****
cProc B$PaintInit,<PUBLIC,NEAR>
cBegin
; If b$Tiling=0 OR b$Tiling=2 then B$TileMod has not been called for
; this PAINT (PAINT without tiling). Set b$Tiling=0.
; If b$Tiling = 1 then B$TileMod has been called and a PAINT with
; tiling. Set b$Tiling=0FFh.
CMP b$Tiling,1 ;has tilmod been called?
MOV b$Tiling,0 ;default no tiling
JNE NO_TILE_PAINT
DEC b$Tiling ;if tiling, then b$Tiling=0FFh
NO_TILE_PAINT:
MOV CH,b$AttrC ;GET FILL COLOR
CALL [b$SetAttr] ;go calc color mask
MOV AL,b$AttrC ;GET ENCODED BORDER ATTRIBUTE
MOV b$PaintBorder,AL ;SAVE BORDER ATTRIBUTE
MOV b$AttrC,CH ;RESTORE OLD ATTRIB
cEnd
;***
;B$ImageSize - Calculate space needed for a GET command
;OEM-interface routine
;
;Purpose:
; This routine returns the number of bytes needed to
; store a rectangle of pixels in an array when a GET is
; performed.
;
; Formula used:
; Space required := ((xdim*bits/pixel+7)/8)*planes*ydim
;
; where:
;
; xdim = width, in pixels, of the rectangle
; ydim = height, in pixels, of the rectangle
; planes = number of planes for current graphics mode
; bits/pixel = number of bits required to represent
; a single pixel
;
; The division in the formula is an integer division, with
; the remainder ignored.
;
;
;Entry:
; [BX] = Y-pixel dimension of rectangle
; [DX] = X-pixel dimension of rectangle
;
;Exit:
; [CX:BX] = # of bytes necessary to store the rectangle
; [DX] = number of BITS needed for one row of the rectangle
; for a single plane. (xdim * bits/pixel)
; PSW.C set if overflow occurred and [BX], [DX] undefined.
;
;Uses:
; per convention
;
;Exceptions:
; none
;****
cProc B$ImageSize,<PUBLIC,NEAR>
cBegin
mov al,b$BitsPerPixel
cbw
mul dx ;xdim*bits/pixel
mov cx,ax ;save X bit dimension
add ax,7 ;() + 7
shr ax,1 ;() / 8
shr ax,1
shr ax,1
mov dl,b$Planes ;() * planes
xor dh,dh
mul dx
mul bx ;() * ydim
xchg bx,ax ;result to CX:BX
xchg cx,dx ; w/ X BIT dimension to DX
clc
cEnd
;***
;B$TileMod - Get modulus of tile string
;OEM-interface routine
;
;Purpose:
; This routine reports the modulus of the tile string
; interpretation for this screen mode. Since the tile
; string in PAINT is a bit map representation of the tile
; pattern, its interpretation depends on the number of
; planes of graphics memory. In single plane systems
; (including interlaced, single bit per pixel, or multiple
; bits per pixel), the tile string is interpreted as an
; eight bit wide tile, with a vertical dimension equal
; to the length of the string. On a multi-plane system,
; the tile string is interpreted as an eight bit wide
; tile, with a vertical dimension equal to the length
; of the string MOD number of planes. The first byte
; in the string represents the bits to be set in the first
; plane, the second byte represents the second plane,
; and so on.
;
; For example, given a six byte tile string:
;
; A single plane system interprets the string as a
; 6 pixel high tile.
;
; A 3 plane system interprets the string as a 2 pixel
; high tile.
;
; In order to maintain the alignment of the tile string
; along the Y axis and to pass the right number of tile
; bytes to the OEM dependent routine [B$SetTile], the runtime
; needs to know how many bytes are needed to represent a 1
; pixel high portion of the tile. This is usually the number
; of graphics planes available.
;
; The way that tiling will proceed is thus:
;
; For each line in the region to be tiled, pass to the OEM
; routines one byte for each plane. This byte will be
; replicated across the entire line by [b$ScanR] and
; [b$ScanL]. The bytes should be aligned such that
; two lines with the same tiling pattern will be aligned
; visually.
;
;Entry:
; None
;
;Exit:
; [AL] = modulus of tile string representation
;
;Uses:
; Per Convention
;
;Exceptions:
; None
;****
cProc B$TileMod,<PUBLIC,NEAR>
cBegin
MOV AL,b$Planes ;returns the # of bytes needed to represent
;a 1 pixel high portion of the tile
MOV b$Tiling,1 ;set tiling flag
cEnd
;***
;B$StoreC - Store values for graphics cursor
;OEM-interface routine
;
;Purpose:
; Set the graphics cursor to a previous value.
;
; The cursor specification passed to this routine will always be
; a copy obtained from B$FetchC or [b$ScanR]. The OEM independent
; code never modifies or interprets the values comprising cursor.
;
; If the graphics cursor does not need three words, this routine
; can just ignore the values that are not needed. The routines
; that return a cursor do not have to set the unneeded values.
;
;Entry:
; AX = first byte of cursor
; BX = second byte of cursor
; CX = third byte of cursor
;
;Exit:
; None.
;
;Uses:
; Per convention
;
;Preserves:
; DX
;
;Exceptions:
; none
;****
;
; In our implementation, we only use 3 bytes for the cursor. The
; values that are required are:
;
; AL = mask portion of cursor
; BX = offset portion of cursor
;
;#***
cProc B$StoreC,<PUBLIC,NEAR>
cBegin
MOV b$OffC,BX
MOV b$MaskC,AL
cEnd
;***
;B$FetchC - Get values for the graphics cursor
;OEM-interface routine
;
;Purpose:
; On return, AX, BX, and CX are loaded with the location of the
; graphics cursor. The values returned are not interpreted and
; are only used to set the cursor at a later point with a call
; to B$StoreC.
;
; The OEM has 6 bytes (3 words) in which to implement a graphics
; cursor. This should accommodate machines with very high resolution
; screens. The representation of the cursor is totally up to the
; OEM, however it is important to put effort into finding a representation
; that will allow accessing pixels on the screen as fast as
; possible.
;
; A couple of possible implementations are:
;
; a) first word: segment of cursor address in screen memory
; second word: offset into the segment
; third word: mask for position of cursor within byte/word
;
; b) first word: offset into segment (segment is constant)
; second word: mask for position of cursor within byte/word
; third word: column and row of cursor
;
; Note that the runtime code will preserve the order of the word
; for the cursor based on their names and not their registers.
; Thus for [b$ScanR], SI and DI are used to return parts of the
; cursor.
;
;Entry:
; none
;
;Exit:
; AX = first word of cursor
; BX = second word of cursor
; CX = third word of cursor
;
;Uses:
; Per Convention
;
;Preserves:
; DX
;
;Exceptions:
; none
;****
;
; In our implementation, we only use 3 bytes for the cursor. The
; values that are returned are:
;
; AL = mask portion of cursor
; BX = offset portion of cursor
;
; However, the code should still conform to the OEM specifications so
; that we do not have to change things when this is sent to the OEM.
;#****
cProc B$FetchC,<PUBLIC,NEAR>
cBegin
MOV AL,b$MaskC
MOV BX,b$OffC
cEnd
sEnd GR_TEXT
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -