📄 mscg12232.lib
字号:
0000
0000
This function is non-reentrant and and is an internal
function.
PARAMETER1: Page (0-3) location of data byte to be displayed.
PARAMETER2: Column (0-121) location of the data byte displayed.
RETURN VALUE: Data byte for the LCD display representing 8 pixels.
SEE ALSO: _glSwapData
END DESCRIPTION **********************************************************/
nodebug
root useix char _glData(int page, int col)
{
static int row_offset;
#asm
ld a,xpc ; Save current XPC on the stack
push af
ld a,(glbuf_xpc) ; Get XPC of LCD buffer
ld xpc,a ; Map-in the LCD XMEM buffer 0xE000 range
exx ; Use ALT reg for mask values
ld d,LCDMASK ; ALT D = lcd bit mask
ld a,(ix+col) ; Get display col value
and GLMASKCNT ; Use 0-7 to generate bufmask
ld b,a ; Load B with shift count
ld a,GLBUFMASK ; ALT E = glbuf bit mask starting point
jr z,.noshift ; If 0-7 = 0 then don't shift bufmask
; Flag was set by previous AND instruction
.maskshift:
rra ; Shift mask X1
djnz .maskshift ; Shift until B = 0
.noshift:
ld e,a ; Save bufmask in reg E
exx ; Move bufmask & lcdmask values to ALT reg's
ld hl,0x0000
ld iy,hl
ld b,0 ; Load BC with the LCD page to be accessed
ld c,(ix+page) ; addr = row_offset + col_offset + (col/8);
; row_offset = page * PIXEL_XS;
ld de,PIXEL_XS ; DE = buffer row offset value
mul ; BC = starting row to be accessed
ld h,0 ; HL = (col/8)
ld l,(ix+col)
srl l ; Shift X3 to do the divide by 8
srl l
srl l
add hl,bc ; Add row and col offsets
; Setup loop for 8 iterations
ld b,8
xor a ; Clear lcd data byte
ex af,af' ; Save in ALT register
ex de,hl
; This routine is now setup to access the same pixel column in glBuf
; memory. The bitloop will bump thru 8 pixel rows in glBuf to build-up
; a byte for the LCD display.
.bitloop:
push de
ld hl,iy
add hl,de
; Note: The data buffer size for this display is 512 bytes, the glBuf
; memory calculation will never cause the offset to wrap-around more
; than once.
ld de,(glbuf_offset)
add hl,de
bit 4,h
jr z,.skipXPC ; Check if ptr has crossed the F000 boundary
res 4,h ; Set offset back to 0xE000 4k memory page
ld a,xpc ; Get current XPC value
inc a ; Bump the XPC value to the next 4K block
ld xpc,a ; Update XPC
; Check if the pixel bit needs to be set low or high
.skipXPC:
ld a,(hl)
exx
and e
jr z,.maskand
; Set pixel bit high
.maskor:
ex af,af' ; Retrieve lcddata byte
or d
ex af,af' ; Save lcddata byte in ALT reg
jr .maskdone
; Set pixel bit low
.maskand:
ld a,d
cpl
ld b,a
ex af,af' ; Retrieve lcddata byte
and b
ex af,af' ; Save lcddata byte in ALT reg
; Shift lcd_mask to the next pixel bit position
.maskdone:
sla d
exx
; Bump to the next pixel row
ld hl,iy
ld de,PIXGROUP
add hl,de
ld iy,hl
; Loop until a byte containing 8 pixels has been created
pop de
djnz .bitloop
pop af ; Retrieve XPC value
ld xpc,a ; Restore XPC
ex af,af'
ld h,0 ; Load lcddata in HL for return value
ld l,a
#endasm
}
/*** BeginHeader _glSwapData */
void _glSwapData(void);
/*** EndHeader */
/* START _FUNCTION DESCRIPTION *******************************************
_glSwapData <MSCG12232.LIB>
SYNTAX: _glSwapData(void);
DESCRIPTION: This function takes the LCD display data from the graphic
buffer (glBuf) and writes it to the LCD display. This
function is non-reentrant and is an internal function.
PARAMETER1: None.
RETURN VALUE: None.
SEE ALSO: graphic.lib, _glInit, _glDispOnOff, _glContrast,
_glBackLight
END DESCRIPTION **********************************************************/
nodebug
void _glSwapData(void)
{
static int col, page;
// Update the entire LCD display screen
for(page = 0; page < 4; page++)
{
// Initialize the display page that will be updated
_glCommand( (LCDSETPAGE | page), LCDMASTER );
_glCommand( (LCDSETPAGE | page), LCDSLAVE );
// Set display column to zero
_glCommand( LCDSETCOLUMN + 0, LCDMASTER );
// Update the Master side of the display, which is columns 0 - 60.
for( col=0; col<=60; col++)
{
#asm
; Get LCD data byte to be displayed, data returned in HL
c _glData(page, col);
ld a,l ; Return value is in HL
; Change Interrupt level to protect I/O access
push ip ;save off IP state
ipset 1 ;set interrupt priority to level 1
ioe ld (LCDMWRITEDATA), a
pop ip
#endasm
}
// Update the Slave side of the display, which is columns 61 - 121.
_glCommand( LCDSETCOLUMN, LCDSLAVE );
for(col = 61 ; col<=121; col++ )
{
#asm
; Get LCD data byte to be displayed, data returned in HL
c _glData(page,col);
ld a,l ; Return value is in HL
; Change Interrupt level to protect I/O access
push ip ;save off IP state
ipset 1 ;set interrupt priority to level 1
ioe ld (LCDSWRITEDATA), a
pop ip
#endasm
}
}
}
/*** BeginHeader glBackLight */
void glBackLight(int onOff);
/*** EndHeader */
/* START FUNCTION DESCRIPTION *******************************************
glBackLight <MSCG12232.LIB>
SYNTAX: void glBackLight(int onOff);
DESCRIPTION: Sets the backlight to either the ON or OFF state.
This function is non-reentrant and is an internal function,
which is called by the function glBackLight located in the
graphic library.
PARAMETER1: 0 sets the backlight OFF.
1 sets the backlight ON.
RETURN VALUE: None.
SEE ALSO: glDispOnOff, glSetContrast
END DESCRIPTION **********************************************************/
nodebug
void glBackLight(int onOff)
{
// The only options for the MSCG12232 display backlight is to either
// turn it ON or OFF.
if( onOff )
{
#asm
push ip ;save off IP state
ipset 1 ;set interrupt priority to level 1
ld a,(LEDShadow)
or a,0x80
ioe ld (LCDBACKLIGHT), a
ld (LEDShadow),a
pop ip
#endasm
}
else
{
#asm
push ip ;save off IP state
ipset 1 ;set interrupt priority to level 1
ld a,(LEDShadow)
and a,0x7F
ioe ld (LCDBACKLIGHT), a
ld (LEDShadow),a
pop ip
#endasm
}
}
/*** BeginHeader glDispOnOff */
void glDispOnOff(int onOff);
/*** EndHeader */
/* START FUNCTION DESCRIPTION *******************************************
glDispOnOff <MSCG12232.LIB>
SYNTAX: void glDispOnOff(int onOff);
DESCRIPTION: Sets the screen ON or OFF. Data will not be cleared from
the screen.
This function is non-reentrant and is an internal function,
which is called by the function glDispOnOff located in the
graphic library.
PARAMETER1: Set to 0 to turn the display OFF. Set to 1 to turn the
display ON.
RETURN VALUE: None.
SEE ALSO: glSetContrast, glBackLight
END DESCRIPTION **********************************************************/
nodebug
void glDispOnOff(int onOff)
{
if( onOff )
{
// Turn the LCD display ON
_glCommand( LCDON, LCDMASTER );
_glCommand( LCDON, LCDSLAVE );
}
else
{
// Turn the LCD display OFF
_glCommand( LCDOFF, LCDMASTER );
_glCommand( LCDOFF, LCDSLAVE );
}
}
/*** BeginHeader glSetContrast */
void glSetContrast (int onOff);
/*** EndHeader */
/* START FUNCTION DESCRIPTION *******************************************
glSetContrast <MSCG12232.LIB>
SYNTAX: void glSetContrast (int onOff);
DESCRIPTION: Sets the contrast, if the circuitry is installed.
PARAMETER: Low to high values (0 - 255) will give you low to high
contrast, repectively.
RETURN VALUE: None.
SEE ALSO: glDispOnOff, glBackLight
END DESCRIPTION **********************************************************/
nodebug
void glSetContrast (int onOff)
{
// Contrast is currently not supported...
// The graphic library requires that you provide a NULL function
// if the feature isn't supported.
}
/*** BeginHeader _glPlotRealtime */
void _glPlotRealtime (char pixel, long phydispAddr);
/*** EndHeader */
/* START _FUNCTION DESCRIPTION *******************************************
_glPlotRealtime <MSCG12232.LIB>
SYNTAX: void _glPlotRealtime (char pixel, long phydispAddr)
DESCRIPTION: // This feature not support by this driver, however the
// graphic library requires that you provide a NULL
// function when the feature isn't supported.
This function takes a byte of data and writes it to the
LCD specified by the dipslay address. This function is
non-reentrant and is an internal function.
PARAMETER1: LCD pixel byte to be written to the LCD display.
PARAMETER2: Physical address of where to write the pixel data on
the LCD display.
RETURN VALUE: None.
SEE ALSO: graphic.lib, _glInit, _glDispOnOff, _glContrast,
_glBackLight
END DESCRIPTION **********************************************************/
nodebug
void _glPlotRealtime (char pixel, long phydispAddr)
{
}
/*** BeginHeader */
#endif
/*** EndHeader */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -