📄 splc501sys.asm
字号:
.external _line_x1 //直线终点X值
.external _line_y0 //直线起点Y值
.external _line_y1 //直线终点Y值
.external _line_x //直线上点X值
.external _line_y //直线上点Y值
.external _lineparameter_a //直线参数A
.external _lineparameter_b //直线参数B
.external _lineparameter_a_temp //直线参数A
.external _lineparameter_b_temp //直线参数B
.PUBLIC _FG_LineTo
_FG_LineTo:
PUSH BP,BP TO [SP]
r1=sp
r2=bp
[bp_temp]=r2
r2-=r1
L_LINE_Parameters_two:
cmp r2,0x06
jne L_LINE_Parameters_four
call F_LINE_Parameters_two
jmp L_LINE
L_LINE_Parameters_four:
cmp r2,0x08
jne L_LINE
call F_LINE_Parameters_four
L_LINE:
call DISPLAY_A_LINE
pop bp from [sp]
retf
//----------------------------------------
F_LINE_Parameters_two:
r1=[R_GraphicMode_temp]
r1&=dotted_mode_bit_clear
[R_GraphicMode_temp]=r1
r1=[R_GraphicMode]
r1&=dotted_mode_bit
r1|=[R_GraphicMode_temp]
[R_GraphicMode_temp]=r1
r1=[_x0]
[_line_x0]=r1
r1=[_y0]
[_line_y0]=r1
r2=[bp_temp]
r2-=0x01
r1=[r2]
[_line_y1]=r1
r2-=0x01
r1=[r2]
[_line_x1]=r1
retf
//----------------------------------------
F_LINE_Parameters_four:
r1=[R_GraphicMode_temp]
r1&=dotted_mode_bit_clear
[R_GraphicMode_temp]=r1
r1=[R_GraphicMode]
r1&=dotted_mode_bit
r1|=[R_GraphicMode_temp]
[R_GraphicMode_temp]=r1
r2=[bp_temp]
r2-=0x01
r1=[r2]
[_line_y1]=r1
r2-=0x01
r1=[r2]
[_line_x1]=r1
r2-=0x01
r1=[r2]
[_line_y0]=r1
r2-=0x01
r1=[r2]
[_line_x0]=r1
retf
//----------------------------------------
DISPLAY_A_LINE: .PROC
r1=[R_GraphicMode_temp]
r1&=0x0004
jz DISPLAY_no_dotted_LINE
r1=[sign]
r1|=0x0010
[sign]=r1
jmp DISPLAY_LINE_mode_end
DISPLAY_no_dotted_LINE:
r1=[sign]
r1&=0xffef
[sign]=r1
DISPLAY_LINE_mode_end:
line_parameter_adjust:
r1=[_line_x0]
cmp r1,[_line_x1]
jb line_begin
je line_begin
r1=[_line_x0]
r2=[_line_x1]
[_line_x1]=r1
[_line_x0]=r2
r1=[_line_y0]
r2=[_line_y1]
[_line_y1]=r1
[_line_y0]=r2
jmp line_parameter_adjust
line_begin:
r1=[_line_y1]
cmp r1,[_line_y0]
jb line_slopeplus
//>= \ //
call line_slope_negative //line_a
retf
line_slopeplus:
//< /
call line_slope_plus
RETF
.ENDP
/////////////////////////////////////////////////////////////////////////////
// line_slope_negative
//////////////////////////////////////////////////////////////////////////////
line_slope_negative: .proc
//得到a b [1]
r1=[_line_x1]
r2=[_line_x0]
r1-=r2
[_lineparameter_b]=r1
[_lineparameter_b_temp]=r1
r1=[_line_y1]
r2=[_line_y0]
r1-=r2
[_lineparameter_a_temp]=r1
[_lineparameter_a]=r1
//////////////////////////
cmp r1,[_lineparameter_b]
jae line_slope_negative_yfrist
//小于
call line_slope_neg_xfrist //line_process3
retf
line_slope_negative_yfrist:
//大于等于
call line_slope_neg_yfrist //line_process1
RETF
.ENDP
/////////////////////////////////////////////////////////////////////////////
// line_slope_plus
//////////////////////////////////////////////////////////////////////////////
line_slope_plus: .proc
//得到a b [2]
r1=[_line_x1]
r2=[_line_x0]
r1-=r2
[_lineparameter_b]=r1
[_lineparameter_b_temp]=r1
r1=[_line_y0]
r2=[_line_y1]
r1-=r2
[_lineparameter_a_temp]=r1
[_lineparameter_a]=r1
//////////////////////////
cmp r1,[_lineparameter_b]
jae line_slopeplus_yfrist
//小于
call line_slope_plus_xfrist // line_process5
retf
line_slopeplus_yfrist:
//大于等于
call line_slope_plus_yfrist //line_process4
RETF
.ENDP
/////////////////////////////////////////////////////////////////////////////
// line_slope_neg_yfrist
//////////////////////////////////////////////////////////////////////////////
//line_process1: .proc
line_slope_neg_yfrist:
//y先加 a>b
r1=[_line_x0]
[_line_x]=r1
r1=[_line_y0]
[_line_y]=r1
call line_display_a_point //line_process2
//line_process1_1:
slope_neg_yfrist_begin:
r1=[_lineparameter_a]
r1-=[_lineparameter_b]
cmp r1,[_lineparameter_b_temp]
ja slope_neg_yfrist_addy //line_process1_2
r1=[_line_y]
r1+=0x01
[_line_y]=r1
r1=[_line_x]
r1+=0x01
[_line_x]=r1
r1=[_lineparameter_b_temp]
r1+=[_lineparameter_b]
r1-=[_lineparameter_a]
[_lineparameter_b_temp]=r1
call line_display_a_point //line_process2
r1=[_line_y]
cmp r1,[_line_y1]
jae slope_neg_yfrist_end //line_process1_3
goto slope_neg_yfrist_begin //line_process1_1
//line_process1_2:
slope_neg_yfrist_addy:
r1=[_line_y]
r1+=0x01
[_line_y]=r1
r1=[_lineparameter_b_temp]
r1+=[_lineparameter_b]
[_lineparameter_b_temp]=r1
call line_display_a_point //line_process2
r1=[_line_y]
cmp r1,[_line_y1]
jae slope_neg_yfrist_end //line_process1_3
goto slope_neg_yfrist_begin //line_process1_1
//line_process1_3:
slope_neg_yfrist_end:
RETF
/////////////////////////////////////////////////////////////////////////////
// line_display_a_point //line_process2
//////////////////////////////////////////////////////////////////////////////
line_display_a_point:
r1=[_line_x]
[_x]=r1
r1=[_line_y]
[_y]=r1
call DISPLAY_A_POINT
RETF
/////////////////////////////////////////////////////////////////////////////
// line_slope_neg_xfrist
//////////////////////////////////////////////////////////////////////////////
line_slope_neg_xfrist:
//x先加 a>b
r1=[_line_x0]
[_line_x]=r1
r1=[_line_y0]
[_line_y]=r1
call line_display_a_point //line_process2
line_slope_neg_xfrist_begin:
r1=[_lineparameter_b]
r1-=[_lineparameter_a]
cmp r1,[_lineparameter_a_temp]
ja slope_neg_xfrist_addx //line_process3_2
r1=[_line_x]
r1+=0x01
[_line_x]=r1
r1=[_line_y]
r1+=0x01
[_line_y]=r1
r1=[_lineparameter_a_temp]
r1+=[_lineparameter_a]
r1-=[_lineparameter_b]
[_lineparameter_a_temp]=r1
call line_display_a_point //line_process2
r1=[_line_x]
cmp r1,[_line_x1]
jae slope_neg_xfrist_end //line_process3_3
goto line_slope_neg_xfrist_begin //line_process3_1
slope_neg_xfrist_addx:
r1=[_line_x]
r1+=0x01
[_line_x]=r1
r1=[_lineparameter_a_temp]
r1+=[_lineparameter_a]
[_lineparameter_a_temp]=r1
call line_display_a_point //line_process2
r1=[_line_x]
cmp r1,[_line_x1]
jae slope_neg_xfrist_end //line_process3_3
goto line_slope_neg_xfrist_begin //line_process3_1
slope_neg_xfrist_end:
RETF
/////////////////////////////////////////////////////////////////////////////
// line_slope_plus_yfrist
//////////////////////////////////////////////////////////////////////////////
line_slope_plus_yfrist:
//y先加 a>b
r1=[_line_x0]
[_line_x]=r1
r1=[_line_y0]
[_line_y]=r1
call line_display_a_point
slope_plus_yfrist_begin:
r1=[_lineparameter_a]
r1-=[_lineparameter_b]
cmp r1,[_lineparameter_b_temp]
ja slope_plus_yfrist_suby
r1=[_line_y]
r1-=0x01
[_line_y]=r1
r1=[_line_x]
r1+=0x01
[_line_x]=r1
r1=[_lineparameter_b_temp]
r1+=[_lineparameter_b]
r1-=[_lineparameter_a]
[_lineparameter_b_temp]=r1
call line_display_a_point
r1=[_line_y]
cmp r1,[_line_y1]
jbe slope_plus_yfrist_end
goto slope_plus_yfrist_begin
slope_plus_yfrist_suby:
r1=[_line_y]
r1-=0x01
[_line_y]=r1
r1=[_lineparameter_b_temp]
r1+=[_lineparameter_b]
[_lineparameter_b_temp]=r1
call line_display_a_point
r1=[_line_y]
cmp r1,[_line_y1]
jbe slope_plus_yfrist_end
goto slope_plus_yfrist_begin
slope_plus_yfrist_end:
RETF
/////////////////////////////////////////////////////////////////////////////
// line_slope_plus_xfrist
//////////////////////////////////////////////////////////////////////////////
line_slope_plus_xfrist:
//x先加 a>b
r1=[_line_x0]
[_line_x]=r1
r1=[_line_y0]
[_line_y]=r1
call line_display_a_point //line_process2
slope_plus_xfrist_begin:
r1=[_lineparameter_b]
r1-=[_lineparameter_a]
cmp r1,[_lineparameter_a_temp]
ja slope_plus_xfrist_addx //line_process5_2
r1=[_line_x]
r1+=0x01
[_line_x]=r1
r1=[_line_y]
r1-=0x01
[_line_y]=r1
r1=[_lineparameter_a_temp]
r1+=[_lineparameter_a]
r1-=[_lineparameter_b]
[_lineparameter_a_temp]=r1
call line_display_a_point //line_process2
r1=[_line_x]
cmp r1,[_line_x1]
jae slope_plus_xfrist_end //line_process5_3
goto slope_plus_xfrist_begin //line_process5_1
slope_plus_xfrist_addx:
r1=[_line_x]
r1+=0x01
[_line_x]=r1
r1=[_lineparameter_a_temp]
r1+=[_lineparameter_a]
[_lineparameter_a_temp]=r1
call line_display_a_point //line_process2
r1=[_line_x]
cmp r1,[_line_x1]
jae slope_plus_xfrist_end //line_process5_3
goto slope_plus_xfrist_begin //line_process5_1
slope_plus_xfrist_end:
RETF
//////////////////////////////////////////////////////////////////////////////
// GIVE A POINT TO (X,Y)DISPLAY A POINT ON LCD
// Give x->[_x],y->[_y];
// call _DISPLAY_A_POINT
//////////////////////////////////////////////////////////////////////////////
.external _x //点X坐标
.external _y //点Y坐标
.external _page_place_bit //点在PAGE place上位置
.external _page //点所在PAGE
.external _page_place //点在PAGE上 place
.external _public_area_sign //点坐标显示范围标志
.external _point_value
.external TAB_pixel
.PUBLIC DISPLAY_A_POINT
DISPLAY_A_POINT: .PROC
CALL get_a_point_address
r1=0xff
cmp r1,[_public_area_sign]
je DISPLAY_A_POINT_1
CALL display_a_point
DISPLAY_A_POINT_1:
RETF
.ENDP
//------------------------------------------------------------------------------
display_a_point: .proc
R1 =[_page]
CALL F_Set_LCD_Page_No
R2 =[_page_place]
CALL F_Set_LCD_Column_Addr
display_a_point_cover:
r4=[R_GraphicMode_temp]
r4&=line_mode_bit
cmp r4,draw_mode_COVER
jne display_a_point_erase
call display_point_cover
display_a_point_erase:
r4&=line_mode_bit
cmp r4,draw_mode_ERASE
jne display_a_point_solid
call display_point_erase
display_a_point_solid:
r4&=line_mode_bit
cmp r4,draw_mode_HOLLOW
jne display_a_point_dotted
call display_point_solid
display_a_point_dotted:
r4&=line_mode_bit
cmp r4,draw_mode_DOTTED
jne display_a_point_solid_cover
call display_point_dotted
display_a_point_solid_cover:
r4&=line_mode_bit
cmp r4,draw_mode_HOLLOW_ERASE
jne display_a_point_dotted_cover
call display_point_solid_cover
display_a_point_dotted_cover:
r4&=line_mode_bit
cmp r4,draw_mode_DOTTED_COVER
jne display_a_point_solid_xor
call display_point_dotted_cover
display_a_point_solid_xor:
r4&=line_mode_bit
cmp r4,draw_mode_SOLID_XOR
jne display_a_point_dotted_xor
call display_point_solid_xor
display_a_point_dotted_xor:
r4&=line_mode_bit
cmp r4,draw_mode_DOTTED_XOR
jne display_a_point_mod_end
call display_point_dotted_xor
display_a_point_mod_end:
R1 =[_page];
CALL F_Set_LCD_Page_No;
R2 =[_page_place]
CALL F_Set_LCD_Column_Addr;
r3=[_point_value]
call F_Display_point
retf
.endp
//----------------------------------------------------------------------------
display_point_cover:
r2=[_page_place_bit]
r1=TAB_pixel;
r1=r1+r2;
r1=[r1]
push r1 to [sp]
call _Read_Lcd_data
r3=r3 lsr 0x04
r3=r3 lsr 0x04
pop r1 from [sp]
r1|=r3
[_point_value]=r1
retf
//----------------------------------------------------------------------------
display_point_erase:
r2=[_page_place_bit]
r1=TAB_pixel;
r1=r1+r2;
r1=[r1]
push r1 to [sp]
call _Read_Lcd_data
r3=r3 lsr 0x04
r3=r3 lsr 0x04
pop r1 from [sp]
r1^=0xff
r3&=r1
[_point_value]=r3
retf
//----------------------------------------------------------------------------
display_point_solid:
r2=[_page_place_bit]
r1=TAB_pixel;
r1=r1+r2;
r1=[r1]
push r1 to [sp]
call _Read_Lcd_data
r3=r3 lsr 0x04
r3=r3 lsr 0x04
pop r1 from [sp]
r1|=r3
[_point_value]=r1
retf
//----------------------------------------------------------------------------
display_point_dotted:
r1=[sign]
r1&=0x0010
jz display_a_empty_point
call display_point_solid
r1=[sign]
r1&=0xffef
[sign]=r1
retf
display_a_empty_point:
// call display_point_erase
r2=[_page_place_bit]
r1=TAB_pixel;
r1=r1+r2;
r1=[r1]
push r1 to [sp]
call _Read_Lcd_data
r3=r3 lsr 0x04
r3=r3 lsr 0x04
pop r1 from [sp]
// r1^=0xff
// r3&=r1
[_point_value]=r3
r1=[sign]
r1|=0x0010
[sign]=r1
retf
//----------------------------------------------------------------------------
display_point_solid_cover:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -