Replace invalid characters with HTML entities
— with — ’ with ’ + with + × with x ç with ç “ with “ ” with ” ‘ with ‘ • with • – with - µ with µ † with † Fix C++ θ with θ Yen symbol instead of times Fix broken apos Bullet again E-circumflex
This commit is contained in:
parent
9e52de9586
commit
500e7f5654
353 changed files with 5091 additions and 5091 deletions
70
32-02.html
70
32-02.html
|
|
@ -39,15 +39,15 @@
|
|||
<P><B>LISTING 32.1 L32-1.ASM</B></P>
|
||||
<!-- CODE //-->
|
||||
<PRE>
|
||||
; Borland C/C++ tiny/small/medium model-callable assembler
|
||||
; Borland C/C++ tiny/small/medium model-callable assembler
|
||||
; subroutines to:
|
||||
;* Set 360×480 256-color VGA mode
|
||||
;* Draw a dot in 360×480 256-color VGA mode
|
||||
;* Read the color of a dot in 360×480 256-color VGA mode
|
||||
;* Set 360x480 256-color VGA mode
|
||||
;* Draw a dot in 360x480 256-color VGA mode
|
||||
;* Read the color of a dot in 360x480 256-color VGA mode
|
||||
;
|
||||
; Assembled with TASM
|
||||
;
|
||||
; The 360×480 256-color mode set code and parameters were provided
|
||||
; The 360x480 256-color mode set code and parameters were provided
|
||||
; by John Bridges, who has placed them into the public domain.
|
||||
;
|
||||
VGA_SEGMENT equ 0a000h ;display memory segment
|
||||
|
|
@ -57,12 +57,12 @@ MAP_MASK equ 2 ;Map Mask register index in SC
|
|||
READ_MAP equ 4 ;Read Map register index in GC
|
||||
SCREEN_WIDTH equ 360 ;# of pixels across screen
|
||||
WORD_OUTS_OK equ 1 ;set to 0 to assemble for
|
||||
; computers that can’t handle
|
||||
; computers that can’t handle
|
||||
; word outs to indexed VGA registers
|
||||
;
|
||||
_DATAsegmentpublic byte ‘DATA’
|
||||
_DATAsegmentpublic byte ‘DATA’
|
||||
;
|
||||
; 360×480 256-color mode CRT Controller register settings.
|
||||
; 360x480 256-color mode CRT Controller register settings.
|
||||
; (Courtesy of John Bridges.)
|
||||
;
|
||||
vptbl dw 06b00h ; horz total
|
||||
|
|
@ -100,18 +100,18 @@ else
|
|||
endif
|
||||
endm
|
||||
;
|
||||
_TEXTsegment byte public ‘CODE’
|
||||
_TEXTsegment byte public ‘CODE’
|
||||
assumecs:_TEXT, ds:_DATA
|
||||
;
|
||||
; Sets up 360×480 256-color mode.
|
||||
; Sets up 360x480 256-color mode.
|
||||
; (Courtesy of John Bridges.)
|
||||
;
|
||||
; Call as: void Set360By480Mode()
|
||||
;
|
||||
; Returns: nothing
|
||||
;
|
||||
public _Set360×480Mode
|
||||
_Set360×480Modeprocnear
|
||||
public _Set360x480Mode
|
||||
_Set360x480Modeprocnear
|
||||
push si ;preserve C register vars
|
||||
push di
|
||||
mov ax,12h ; start with mode 12h
|
||||
|
|
@ -154,9 +154,9 @@ _Set360×480Modeprocnear
|
|||
_Set360x480Modeendp
|
||||
;
|
||||
; Draws a pixel in the specified color at the specified
|
||||
; location in 360×480 256-color mode.
|
||||
; location in 360x480 256-color mode.
|
||||
;
|
||||
; Call as: void Draw360×480Dot(int X, int Y, int Color)
|
||||
; Call as: void Draw360x480Dot(int X, int Y, int Color)
|
||||
;
|
||||
; Returns: nothing
|
||||
;
|
||||
|
|
@ -169,9 +169,9 @@ Color dw ? ;color in which to draw (in the
|
|||
; range 0-255; upper byte ignored)
|
||||
DParms ends
|
||||
;
|
||||
public _Draw360×480Dot
|
||||
_Draw360×480Dotprocnear
|
||||
push bp ;preserve caller’s BP
|
||||
public _Draw360x480Dot
|
||||
_Draw360x480Dotprocnear
|
||||
push bp ;preserve caller’s BP
|
||||
mov bp,sp ;point to stack frame
|
||||
push si ;preserve C register vars
|
||||
push di
|
||||
|
|
@ -181,12 +181,12 @@ _Draw360×480Dotprocnear
|
|||
;there are 4 pixels at each address, so
|
||||
; each 360-pixel row is 90 bytes wide
|
||||
; in each plane
|
||||
mul [bp+DrawY] ;point to start of desired row
|
||||
mov di,[bp+DrawX] ;get the X coordinate
|
||||
mul [bp+DrawY] ;point to start of desired row
|
||||
mov di,[bp+DrawX] ;get the X coordinate
|
||||
shr di,1 ;there are 4 pixels at each address
|
||||
shr di,1 ; so divide the X coordinate by 4
|
||||
add di,ax ;point to the pixel’s address
|
||||
mov cl,byte ptr [bp+DrawX] ;get the X coordinate again
|
||||
add di,ax ;point to the pixel’s address
|
||||
mov cl,byte ptr [bp+DrawX] ;get the X coordinate again
|
||||
and cl,3 ;get the plane # of the pixel
|
||||
mov ah,1
|
||||
shl ah,cl ;set the bit corresponding to the plane
|
||||
|
|
@ -195,18 +195,18 @@ _Draw360×480Dotprocnear
|
|||
mov dx,SC_INDEX
|
||||
OUT_WORD ;set to write to the proper plane for
|
||||
; the pixel
|
||||
mov al,byte ptr [bp+Color] ;get the color
|
||||
mov al,byte ptr [bp+Color] ;get the color
|
||||
stosb ;draw the pixel
|
||||
pop di ;restore C register vars
|
||||
pop si
|
||||
pop bp ;restore caller’s BP
|
||||
pop bp ;restore caller’s BP
|
||||
ret
|
||||
_Draw360×480Dotendp
|
||||
_Draw360x480Dotendp
|
||||
;
|
||||
; Reads the color of the pixel at the specified
|
||||
; location in 360×480 256-color mode.
|
||||
; location in 360x480 256-color mode.
|
||||
;
|
||||
; Call as: int Read360×480Dot(int X, int Y)
|
||||
; Call as: int Read360x480Dot(int X, int Y)
|
||||
;
|
||||
; Returns: pixel color
|
||||
;
|
||||
|
|
@ -217,9 +217,9 @@ ReadX dw ? ;X coordinate from which to read
|
|||
ReadY dw ? ;Y coordinate from which to read
|
||||
RParms ends
|
||||
;
|
||||
public _Read360×480Dot
|
||||
_Read360×480Dotprocnear
|
||||
push bp ;preserve caller’s BP
|
||||
public _Read360x480Dot
|
||||
_Read360x480Dotprocnear
|
||||
push bp ;preserve caller’s BP
|
||||
mov bp,sp ;point to stack frame
|
||||
push si ;preserve C register vars
|
||||
push di
|
||||
|
|
@ -229,12 +229,12 @@ _Read360×480Dotprocnear
|
|||
; each 360-pixel row is 90 bytes wide
|
||||
; in each plane
|
||||
|
||||
mul [bp+DrawY] ;point to start of desired row
|
||||
mov si,[bp+DrawX] ;get the X coordinate
|
||||
mul [bp+DrawY] ;point to start of desired row
|
||||
mov si,[bp+DrawX] ;get the X coordinate
|
||||
shr si,1 ;there are 4 pixels at each address
|
||||
shr si,1 ; so divide the X coordinate by 4
|
||||
add si,ax ;point to the pixel’s address
|
||||
mov ah,byte ptr [bp+DrawX] ;get the X coordinate again
|
||||
add si,ax ;point to the pixel’s address
|
||||
mov ah,byte ptr [bp+DrawX] ;get the X coordinate again
|
||||
and ah,3
|
||||
;get the plane # of the pixel
|
||||
mov al,READ_MAP
|
||||
|
|
@ -245,9 +245,9 @@ _Read360×480Dotprocnear
|
|||
sub ah,ah ;make the return value a word for C
|
||||
pop di ;restore C register vars
|
||||
pop si
|
||||
pop bp ;restore caller’s BP
|
||||
pop bp ;restore caller’s BP
|
||||
ret
|
||||
_Read360×480Dot endp
|
||||
_Read360x480Dot endp
|
||||
_TEX Tends
|
||||
end
|
||||
</PRE>
|
||||
|
|
|
|||
Loading…
Reference in a new issue