Jeśli chcesz wziąć udział w dyskusjach na forum - zaloguj się. Jeżeli nie masz loginu - poproś o członkostwo.
Vanilla 1.1.4 jest produktem Lussumo. Więcej informacji: Dokumentacja, Forum.
Packer info:
6-bit word; dicFirstChar = 40; offset = packedString[1]
chessman matrix: 24x19
chessmanPawnW : string = '@((((((((((((((((((((()H((+X((+X(()H((+X((/`((/`((+X(()H(()H((+X((+X((Gf((Gf(';
chessmanPawnB : string = '@((((((((((((((((()H((*8((,0((,0((*8((,0((0,((0,((,0((*8((*8((,0((D6((H)((H)(';
chessmanRookW : string = '@(((((((((((((((((aO((aO((aO((gg((Gf((7d((7d((7d((7d((7d((7d((Gf((Gf()ggH)ggH';
chessmanRookB : string = '@(((((((((((()c_H)2<H)2<H)6DH)H)H(X+((8*((8*((8*((8*((8*((X+((H)(+H)X*((8*((8';
chessmanKnightB : string = '@(((((((((,H((38((10((8,((L2((H-()(-(*(-(*:-(*L-()0-((`,H(8*H(8*H(H*8)((8)((8';
chessmanKnightW : string = '@(((((((((((((,H((.X((7`((C\((Gb((gb()gb()Ub()Cb((_b((/c((7e((7e((GeH(ggH(ggH';
chessmanBishopW : string = '@(((((((((+X((,0((0,((1L((9J((II())HH)6DH))HH(II((9J((9J((0,((1L(+`/X,1L01J9L';
chessmanBishopB : string = '@(((((((((((((+X((/`((.@((6D((FF((fG((YK((fG((FF((6D((6D((/`((.@((/`(+^CX.EV@';
chessmanQueenW : string = '@(((((((((0,(*<28-J9P0\3,-<2P-::P,II0,II0,((0,((0,((0,gg0*((8*Gf8)((H)7dH(H)(';
chessmanQueenB : string = '@(((((((((((((0,(*D68/0,`*P-8*T58+FFX+FFX+ggX+ggX+ggX+((X)ggH)H)H(gg((X+((Gf(';
chessmanKingW : string = '@((((((((()H(()H(()H((/`((/`()IIH+YKX/eW`/d7`/We`+?bX)WeH)ggH(H)((gg((8*((Gf(';
chessmanKingB : string = '@((((()H((*8((*8((.@((0,()P-H*::8,6D00*8,0+X,08*,,P-0*8*8*((8)GfH)((H(We((H)(';
program chessboard;
//---------------------- LIBRARES ----------------------------
uses crt, fastgraph;
//---------------------- GLOBAL DATA -------------------------
const
chessmanPawnS = '@((((((((((((((((((((()H((+X((+X(()H((+X((/`((/`((+X(()H(()H((+X((+X((Gf((Gf(';
chessmanPawnE = '@((((((((((((((((()H((*8((,0((,0((*8((,0((0,((0,((,0((*8((*8((,0((D6((H)((H)(';
chessmanRookS = '@(((((((((((((((((aO((aO((aO((gg((Gf((7d((7d((7d((7d((7d((7d((Gf((Gf()ggH)ggH';
chessmanRookE = '@(((((((((((()c_H)2<H)2<H)6DH)H)H(X+((8*((8*((8*((8*((8*((X+((H)(+H)X*((8*((8';
chessmanKnightS = '@(((((((((((((,H((.X((7`((C\((Gb((gb()gb()Ub()Cb((_b((/c((7e((7e((GeH(ggH(ggH';
chessmanKnightE = '@(((((((((,H((38((10((8,((L2((H-()(-(*(-(*:-(*L-()0-((`,H(8*H(8*H(H*8)((8)((8';
chessmanBishopS = '@(((((((((((((+X((/`((.@((6D((FF((fG((YK((fG((FF((6D((6D((/`((.@((/`(+^CX.EV@';
chessmanBishopE = '@(((((((((+X((,0((0,((1L((9J((II())HH)6DH))HH(II((9J((9J((0,((1L(+`/X,1L01J9L';
chessmanQueenS = '@(((((((((((((0,(*D68/0,`*P-8*T58+FFX+FFX+ggX+ggX+ggX+((X)ggH)H)H(gg((X+((Gf(';
chessmanQueenE = '@(((((((((0,(*<28-J9P0\3,-<2P-::P,II0,II0,((0,((0,((0,gg0*((8*Gf8)((H)7dH(H)(';
chessmanKingS = '@((((((((()H(()H(()H((/`((/`()IIH+YKX/eW`/d7`/We`+?bX)WeH)ggH(H)((gg((8*((Gf(';
chessmanKingE = '@((((()H((*8((*8((.@((0,()P-H*::8,6D00*8,0+X,08*,,P-0*8*8*((8)GfH)((H(We((H)(';
//---------------------- GLOBAL VARIABLES --------------------
var
bmpAdr : word;
color : byte;
//---------------------- PROCEDURES --------------------------
procedure renderChessman(chessman: string; x, y, color: byte);
var i0b, i1b : byte;
x1b, loopEnd : byte;
offset, error : byte;
chessmanBlock : byte = %00000000;
dicFirstChar : byte = 40;
begin
x1b := x;
loopEnd := ord(chessman[0]);
offset := ord(chessman[1]) - dicFirstChar;
SetColor(color);
for i0b := 2 to loopEnd do begin
chessmanBlock := ord(chessman[i0b]) - dicFirstChar;
for i1b := 1 to 6 do begin
if (chessmanBlock and %100000 <> 0) then PutPixel(x1b,y);
chessmanBlock := chessmanBlock shl 1;
x1b := x1b + 1;
if (x1b = offset + x) then begin
x1b := x;
y := y + 1;
end;
end;
end;
end;
{* chessboard - square 24x19 *}
procedure drawBoard;
var i1b, i2b, i3b : byte;
color, modLine : byte;
x, y : word;
begin
modLine := 0;
y := 0;
for i3b := 1 to 8 do begin
for i2b := 1 to 19 do begin
x := 0;
for i1b := 1 to 8 do begin
color := 0;
if (i1b and %1 <> modLine) then color := $ff;
dpoke(bmpAdr + y + x, color);
dpoke(bmpAdr + y + x + 1, color);
dpoke(bmpAdr + y + x + 2, color);
x := x + 3;
end;
y := y + 40;
end;
if (i3b and %1 = 0) then modLine := 0
else modLine := 1;
end;
rectangle(0, 0, 192, 152);
end;
{* pieces matrix 24x19 *}
procedure drawPieces;
var x1w : word;
i1b : byte;
begin
x1w := 0;
for i1b := 0 to 7 do begin
if (i1b and %1 = 0) then begin
renderChessman(chessmanPawnE, x1w, 19, 1);
renderChessman(chessmanPawnE, x1w, 114, 0);
end else begin
renderChessman(chessmanPawnS, x1w, 19, 0);
renderChessman(chessmanPawnS, x1w, 114, 1);
end;
x1w := x1w + 24;
end;
renderChessman(chessmanRookS, 0, 0, 0);
renderChessman(chessmanRookS, 0, 133, 1);
renderChessman(chessmanRookE, 168, 0, 1);
renderChessman(chessmanRookE, 168, 133, 0);
renderChessman(chessmanKnightE, 24, 0, 1);
renderChessman(chessmanKnightE, 24, 133, 0);
renderChessman(chessmanKnightS, 144, 0, 0);
renderChessman(chessmanKnightS, 144, 133, 1);
renderChessman(chessmanBishopS, 48, 133, 1);
renderChessman(chessmanBishopS, 48, 0, 0);
renderChessman(chessmanBishopE, 120, 133, 0);
renderChessman(chessmanBishopE, 120, 0, 1);
renderChessman(chessmanQueenE, 72, 133, 0);
renderChessman(chessmanQueenE, 72, 0, 1);
renderChessman(chessmanKingS, 96, 133, 1);
renderChessman(chessmanKingS, 96, 0, 0);
end;
//---------------------- MAIN PROGRAM ------------------------
begin
// There are 192 rows of 320 dots in the full screen mode.
InitGraph(8);
bmpAdr := dpeek(88);
SetColor(1);
// colors: 2, 4, 80, 82, 96, 98, 112, 130, 132, 144, 146, 148, 150
color := 2;
SetBKColor(color);
TextBackground(color);
drawBoard;
drawPieces;
ReadKey;
end.
procedure renderChessman(var chessman: string; x, y, color: byte);
type TChessman = string[77];
...
procedure renderChessman(chessman: TChessman; x, y, color: byte);
150 lines compiled, 1.45 sec, 11753 tokens, 1098 idents, 309 blocks, 6 types
2 warning(s) issued
3 note(s) issued
ZPFREE: $0000..$007F ; $00D8..$00FF
SYSTEM: $23E0..$241F
CRT: $2420..$2443
FASTGRAPH: $2444..$2C28
CODE: $2000..$3281
DATA: $3282..$3AF4
Writing listing file...
Writing object file...
9655 lines of source assembled in 7 pass
6897 bytes written to the object file
kingE : array[0..56] of byte = (
$0,$0,$0,$0,$24,$0,$0,$36,$0,$0,$36,$0,$0,$102,$0,$0,$129,$0,$6,$129,$96,$9,$36,$144,$16,$231,$8,$32,$36,$4,$32,$60,$4,$33,$0,$132,$18,$129,$72,$9,$0,$144,$8,$0,$16,$5,$255,$160,$4,$0,$32,$2,$255,$64,$2,$0,$64
);
1. sam stół : 16 ticks
2. ramka : 9 ticks
3. 16 pionków : 39 ticks
4. pozostałe 16 figur : 45 ticks
procedure renderChessman(chessman: array[0..56] of byte; x, y, color: byte);
var i0b : byte;
gfxByte : byte;
chessmanBlock : byte;
x1w, y1w : word;
begin
y1w := y * 760;
x1w := x * 3;
gfxByte := 0;
SetColor(color);
for i0b := 0 to 18 do begin
dpoke(bmpAdr + x1w + y1w, chessman[gfxByte]);
dpoke(bmpAdr + x1w + y1w + 1, chessman[gfxByte + 1]);
dpoke(bmpAdr + x1w + y1w + 2, chessman[gfxByte + 2]);
gfxByte := gfxByte + 3;
y1w := y1w + 40;
end;
end;
dpoke(bmpAdr + x1w + y1w, chessman[gfxByte]);
dpoke(bmpAdr + x1w + y1w + 1, chessman[gfxByte + 1]);
dpoke(bmpAdr + x1w + y1w + 2, chessman[gfxByte + 2]);
dpoke(bmpAdr + x1w + y1w, chessman[gfxByte]);
dpoke(bmpAdr + x1w + y1w + 1, chessman[gfxByte + 1]);
program test;
uses crt, fastgraph;
var
bmpAdr : word;
i0b : byte;
begin
// There are 192 rows of 320 dots in the full screen mode.
InitGraph(8);
bmpAdr := dpeek(88);
SetColor(1);
for i0b := 0 to 255 do begin
dpoke(bmpAdr, i0b);
dpoke(bmpAdr + 1, i0b);
dpoke(bmpAdr + 2, i0b);
writeln(HexStr(i0b, 2));
Readkey;
end;
end.
program chessboard;
//---------------------- LIBRARES ----------------------------------
uses crt, fastgraph;
//---------------------- GLOBAL VARIABLES --------------------------
var
bmpAdr : word;
color : byte;
{* White square, invert Black square *}
wSquare : array[0..56] of byte = (...);
{* White pawn on black, invert Black pawn on white *}
pawnSe : array[0..56] of byte = (...);
{* Black pawn on black, invert White pawn on white *}
pawnEe : array[0..56] of byte = (...);
{* White king on black, invert Black king on white *}
kingSe : array[0..56] of byte = (...);
{* Black king on black, invert White king on white *}
kingEe : array[0..56] of byte = (...);
{* White queen on black, invert Black queen on white *}
queenSe : array[0..56] of byte = (...);
{* Black queen on black, invert White queen on white *}
queenEe : array[0..56] of byte = (...);
{* White rook on black, invert Black rook on white *}
rookSe : array[0..56] of byte = (...);
{* Black rook on black, invert White rook on withe *}
rookEe : array[0..56] of byte = (...);
{* White knight on black, invert Black knight on white *}
knightSe : array[0..56] of byte = (...);
{* Black knight on black, invert White knight on withe *}
knightEe : array[0..56] of byte = (...);
{* White bishop on black, invert Black bishop on white *}
bishopSe : array[0..56] of byte = (...);
{* Black bishop on black, invert White bishop on withe *}
bishopEe : array[0..56] of byte = (...);
//---------------------- PROCEDURES --------------------------------
procedure renderChessman(var chessman: array[0..56] of byte; x, y, invert: byte);
var i0b : byte;
gfxByte : byte;
x1w, y1w : word;
begin
y1w := y * 760;
x1w := x * 3;
gfxByte := 0;
for i0b := 0 to 18 do begin
poke(bmpAdr + x1w + y1w, chessman[gfxByte] xor invert);
poke(bmpAdr + x1w + y1w + 1, chessman[gfxByte + 1] xor invert);
poke(bmpAdr + x1w + y1w + 2, chessman[gfxByte + 2] xor invert);
gfxByte := gfxByte + 3;
y1w := y1w + 40;
end;
end;
procedure drawBoard;
var i0b, i1b, coordinate: byte;
begin
renderChessman(rookSe, 0, 0, $ff);
renderChessman(rookEe, 7, 0, 0);
renderChessman(rookSe, 0, 7, 0);
renderChessman(rookEe, 7, 7, $ff);
renderChessman(knightEe, 1, 0, 0);
renderChessman(knightSe, 6, 0, $ff);
renderChessman(knightEe, 1, 7, $ff);
renderChessman(knightSe, 6, 7, 0);
renderChessman(bishopSe, 2, 0, $ff);
renderChessman(bishopEe, 5, 0, 0);
renderChessman(bishopSe, 2, 7, 0);
renderChessman(bishopEe, 5, 7, $ff);
renderChessman(queenEe, 3, 0, 0);
renderChessman(queenEe, 3, 7, $ff);
renderChessman(kingSe, 4, 7, 0);
renderChessman(kingSe, 4, 0, $ff);
coordinate := 0;
for i0b := 0 to 7 do begin
if (i0b and %1 = 0) then begin
renderChessman(pawnEe, coordinate, 1, 0);
renderChessman(pawnEe, coordinate, 6, $ff);
end else begin
renderChessman(pawnSe, coordinate, 1, $ff);
renderChessman(pawnSe, coordinate, 6, 0);
end;
coordinate := coordinate + 1;
end;
for i1b := 0 to 1 do begin
coordinate := 0;
for i0b := 0 to 7 do begin
if (i0b and %1 = i1b) then begin
renderChessman(wSquare, coordinate, 2 + i1b, 0);
renderChessman(wSquare, coordinate, 5 - i1b, $ff);
end else begin
renderChessman(wSquare, coordinate, 2 + i1b, $ff);
renderChessman(wSquare, coordinate, 5 - i1b, 0);
end;
coordinate := coordinate + 1;
end;
end;
SetColor(1);
rectangle(0, 0, 192, 152);
end;
//---------------------- MAIN PROGRAM ------------------------------
begin
// There are 192 rows of 320 dots in the full screen mode.
InitGraph(8);
bmpAdr := dpeek(88);
SetColor(1);
// colors: 2, 4, 80, 82, 96, 98, 112, 130, 132, 144, 146, 148, 150
color := 2;
SetBKColor(color);
TextBackground(color);
drawBoard;
ReadKey;
end.
procedure drawRectangle;
var i0b : byte;
tmpBmpAdr : word;
y : word = 0;
begin
tmpBmpAdr := bmpAdr + 23;
for i0b := 0 to 152 do begin
poke(bmpAdr + y, peek(bmpAdr + y) or %10000000);
poke(tmpBmpAdr + y, peek(tmpBmpAdr + y) or %00000001);
y := y + 40;
end;
tmpBmpAdr := bmpAdr + 6080; // 19*8*40
for i0b := 0 to 23 do begin
poke(bmpAdr + i0b, $ff);
poke(tmpBmpAdr + i0b, $ff);
end;
end;
mp-build chessboard.pas run
Mad Pascal Compiler version 1.6.2 [2019/11/05] for 6502
Compiling chessboard.pas
/home/zbyti/Programs/MadPascal/lib/graph.inc (672) Warning: lo/hi(dword/qword) returns the upper/lower word/dword
/home/zbyti/Programs/MadPascal/lib/graph.inc (673) Warning: lo/hi(dword/qword) returns the upper/lower word/dword
chessboard.pas (39) Note: Local variable 'KINGEE' not used
chessboard.pas (45) Note: Local variable 'QUEENSE' not used
198 lines compiled, 1.18 sec, 12919 tokens, 1074 idents, 306 blocks, 6 types
2 warning(s) issued
2 note(s) issued
ZPFREE: $0000..$007F ; $00D8..$00FF
SYSTEM: $202C..$2062
CRT: $2063..$2086
GRAPH: $2087..$20F1
CODE: $2000..$278A
DATA: $278B..$2AB4
Writing listing file...
Writing object file...
8169 lines of source assembled in 6 pass
2732 bytes written to the object file
procedure drawRectangle;
var i0b : byte;
tmpBmpAdr : word;
y : word = 0;
y:=0;
procedure test;
var x,y: byte;
procedure test2;
begin
for x:=0 to 100 do ;
end;
begin
for x:=0 to 10 do ;
end;
type TChessman = array[0..56] of byte;
var chessboard = array[0..63] of TChessman;
type TChessman = string[57];
var chessboard = array[0..63] of TChessman;
;************************************************************
; BOARD -- Board Array. Used to hold the current position
; of the board during play. The board itself
; looks like:
; FFFFFFFFFFFFFFFFFFFF
; FFFFFFFFFFFFFFFFFFFF
; FF0402030506030204FF
; FF0101010101010101FF
; FF0000000000000000FF
; FF0000000000000000FF
; FF0000000000000060FF
; FF0000000000000000FF
; FF8181818181818181FF
; FF8482838586838284FF
; FFFFFFFFFFFFFFFFFFFF
; FFFFFFFFFFFFFFFFFFFF
; The values of FF form the border of the
; board, and are used to indicate when a piece
; moves off the board. The individual bits of
; the other bytes in the board array are as
; follows:
; Bit 7 -- Color of the piece
; 1 -- Black
; 0 -- White
; Bit 6 -- Not used
; Bit 5 -- Not used
; Bit 4 --Castle flag for Kings only
; Bit 3 -- Piece has moved flag
; Bits 2-0 Piece type
; 1 -- Pawn
; 2 -- Knight
; 3 -- Bishop
; 4 -- Rook
; 5 -- Queen
; 6 -- King
; 7 -- Not used
; 0 -- Empty Square
;**********************************************************
var chessboard : array[0..63, 0..56] of byte;
type TChessman = array[0..1] of byte;
var chessboard : array[0..1] of TChessman = ((0,1),(2,3));
var chessboard : array[0..63] of TChessman = (rook, knight, ...);