主题:[原创]小程序,图画板
鼠标按住画线条,“T”是退出,左侧方块里选颜色,因为鼠标指针没弄出来,所以画了一横一竖两个红线就算是座标吧(但是不清楚,哎)
DECLARE SUB showpix ()
DECLARE SUB getclor ()
DECLARE SUB clorbox ()
DECLARE SUB getmouse ()
DIM SHARED asmprog(0 TO 27)
DEFINT A-Z
COMMON SHARED x, y, z, duanaddr, offset, clor
SCREEN 12
clor = 2
DATA &h55,&h89,&he5,&hb8
DATA &h03,&h00,&hcd,&h33,&h53,&h8b
DATA &h5e,&h06,&h89,&h0f,&h8b,&h5e,&h08
DATA &h89,&h17,&h8b
DATA &h5e,&h0a,&h5a,&h89,&H17
DATA &h5d,&hca,&h02
RESTORE
duanaddr = VARSEG(asmprog(0))
offset = VARPTR(asmprog(0))
DEF SEG = duanaddr
FOR i = 0 TO 27
READ j
POKE (offset + i), j
NEXT i
DEF SEG
CALL clorbox
DO
CALL getmouse
CALL showpix
CALL getclor
LOOP UNTIL INKEY$ = "t"
END
SUB clorbox
FOR B = 1 TO 2
FOR a = 1 TO 8
LINE (B * 30 + 10, a * 30 + 50)-(B * 30 + 30, a * 30 + 70), a * B - 1, BF
NEXT a
NEXT B
LINE (40, 80)-(90, 310), 2, B
END SUB
SUB getclor
IF y > 40 AND y < 60 AND x > 80 AND x < 100 AND z = 1 THEN
clor = 0
ELSEIF y > 40 AND y < 60 AND x > 110 AND x < 130 AND z = 1 THEN
clor = 1
ELSEIF y > 40 AND y < 60 AND x > 140 AND x < 160 AND z = 1 THEN
clor = 2
ELSEIF y > 40 AND y < 60 AND x > 170 AND x < 190 AND z = 1 THEN
clor = 3
ELSEIF y > 40 AND y < 60 AND x > 200 AND x < 220 AND z = 1 THEN
clor = 4
ELSEIF y > 40 AND y < 60 AND x > 230 AND x < 250 AND z = 1 THEN
clor = 5
ELSEIF y > 40 AND y < 60 AND x > 260 AND x < 280 AND z = 1 THEN
clor = 6
ELSEIF y > 40 AND y < 60 AND x > 290 AND x < 310 AND z = 1 THEN
clor = 7
ELSEIF y > 70 AND y < 90 AND x > 80 AND x < 100 AND z = 1 THEN
clor = 8
ELSEIF y > 70 AND y < 90 AND x > 110 AND x < 130 AND z = 1 THEN
clor = 9
ELSEIF y > 70 AND y < 90 AND x > 140 AND x < 160 AND z = 1 THEN
clor = 10
ELSEIF y > 70 AND y < 90 AND x > 170 AND x < 190 AND z = 1 THEN
clor = 11
ELSEIF y > 70 AND y < 90 AND x > 200 AND x < 220 AND z = 1 THEN
clor = 12
ELSEIF y > 70 AND y < 90 AND x > 230 AND x < 250 AND z = 1 THEN
clor = 13
ELSEIF y > 70 AND y < 90 AND x > 260 AND x < 280 AND z = 1 THEN
clor = 14
ELSEIF y > 70 AND y < 90 AND x > 290 AND x < 310 AND z = 1 THEN
clor = 15
END IF
END SUB
SUB getmouse
DEF SEG = duanaddr
LINE (y, 0)-(y, 35), 0
LINE (100, x)-(140, x), 0
CALL absolute(z, x, y, offset)
LOCATE 1, 1
PRINT z; x; y
END SUB
SUB showpix
IF z = 1 THEN
LINE (y, x)-(y + 3, x + 3), clor, BF
END IF
LINE (y, 0)-(y, 35), 12
LINE (100, x)-(140, x), 12
END SUB
有些地方还是不太明白,所以做的不好,大家千万不要笑话啊,权当是抛砖引玉吧
DECLARE SUB showpix ()
DECLARE SUB getclor ()
DECLARE SUB clorbox ()
DECLARE SUB getmouse ()
DIM SHARED asmprog(0 TO 27)
DEFINT A-Z
COMMON SHARED x, y, z, duanaddr, offset, clor
SCREEN 12
clor = 2
DATA &h55,&h89,&he5,&hb8
DATA &h03,&h00,&hcd,&h33,&h53,&h8b
DATA &h5e,&h06,&h89,&h0f,&h8b,&h5e,&h08
DATA &h89,&h17,&h8b
DATA &h5e,&h0a,&h5a,&h89,&H17
DATA &h5d,&hca,&h02
RESTORE
duanaddr = VARSEG(asmprog(0))
offset = VARPTR(asmprog(0))
DEF SEG = duanaddr
FOR i = 0 TO 27
READ j
POKE (offset + i), j
NEXT i
DEF SEG
CALL clorbox
DO
CALL getmouse
CALL showpix
CALL getclor
LOOP UNTIL INKEY$ = "t"
END
SUB clorbox
FOR B = 1 TO 2
FOR a = 1 TO 8
LINE (B * 30 + 10, a * 30 + 50)-(B * 30 + 30, a * 30 + 70), a * B - 1, BF
NEXT a
NEXT B
LINE (40, 80)-(90, 310), 2, B
END SUB
SUB getclor
IF y > 40 AND y < 60 AND x > 80 AND x < 100 AND z = 1 THEN
clor = 0
ELSEIF y > 40 AND y < 60 AND x > 110 AND x < 130 AND z = 1 THEN
clor = 1
ELSEIF y > 40 AND y < 60 AND x > 140 AND x < 160 AND z = 1 THEN
clor = 2
ELSEIF y > 40 AND y < 60 AND x > 170 AND x < 190 AND z = 1 THEN
clor = 3
ELSEIF y > 40 AND y < 60 AND x > 200 AND x < 220 AND z = 1 THEN
clor = 4
ELSEIF y > 40 AND y < 60 AND x > 230 AND x < 250 AND z = 1 THEN
clor = 5
ELSEIF y > 40 AND y < 60 AND x > 260 AND x < 280 AND z = 1 THEN
clor = 6
ELSEIF y > 40 AND y < 60 AND x > 290 AND x < 310 AND z = 1 THEN
clor = 7
ELSEIF y > 70 AND y < 90 AND x > 80 AND x < 100 AND z = 1 THEN
clor = 8
ELSEIF y > 70 AND y < 90 AND x > 110 AND x < 130 AND z = 1 THEN
clor = 9
ELSEIF y > 70 AND y < 90 AND x > 140 AND x < 160 AND z = 1 THEN
clor = 10
ELSEIF y > 70 AND y < 90 AND x > 170 AND x < 190 AND z = 1 THEN
clor = 11
ELSEIF y > 70 AND y < 90 AND x > 200 AND x < 220 AND z = 1 THEN
clor = 12
ELSEIF y > 70 AND y < 90 AND x > 230 AND x < 250 AND z = 1 THEN
clor = 13
ELSEIF y > 70 AND y < 90 AND x > 260 AND x < 280 AND z = 1 THEN
clor = 14
ELSEIF y > 70 AND y < 90 AND x > 290 AND x < 310 AND z = 1 THEN
clor = 15
END IF
END SUB
SUB getmouse
DEF SEG = duanaddr
LINE (y, 0)-(y, 35), 0
LINE (100, x)-(140, x), 0
CALL absolute(z, x, y, offset)
LOCATE 1, 1
PRINT z; x; y
END SUB
SUB showpix
IF z = 1 THEN
LINE (y, x)-(y + 3, x + 3), clor, BF
END IF
LINE (y, 0)-(y, 35), 12
LINE (100, x)-(140, x), 12
END SUB
有些地方还是不太明白,所以做的不好,大家千万不要笑话啊,权当是抛砖引玉吧