Does anyone know how to write an assmebly language program to display a chessboard? Please give me something to start with or give me some ideas. I'm going crazy here not knowing how to do this.
Posted on 2004-09-21 21:15:40 by trueazian


insert this into the resource section then load it and bitblt it ;)

:twisted:
Posted on 2004-09-21 21:29:59 by JimmyClif
Do you mean for Windows or DOS?

If it's for Windows you can actually do what Jimmy says :P but with a vector graphic (wmf) if you need resizing.

Another way would be using FillRect in a loop. It ain't so hard really :) post some code and we'll be of more help, maybe we can see what's failing in yours.
Posted on 2004-09-22 16:41:42 by QvasiModo
Thinking about it, if you used a tiny grid, each square only a pixel then it could be easily sized with StretchBlt. Intrestingly I was using a grid in a current program and this didn't occur to me till now :).
Posted on 2004-09-22 17:45:44 by Eóin
INCLUDE Irvine32.inc

CR = 0Dh
LF = 0Ah

.data
Image BYTE 200 dup(?)
X BYTE ?
Y BYTE ?
count BYTE ?
;array BYTE 0CDh, 0BAh, 0DBh, 0FFh, 0
String0 BYTE 0CDh, 0
String1 BYTE 0BAh, 0
String2 BYTE 4 DUP (0FFh, 0FFh, 0FFh, 0DBh, 0DBh, 0DBh), 0
String3 BYTE 4 DUP (0DBh, 0DBh, 0DBh, 0FFh, 0FFh, 0FFh), 0

.code
main PROC

mov eax, black + (white * 16)
call SetTextColor
call Clrscr
mov Y, 3
mov X, 26

;L0:
;mov dh, Y
;mov dl, X
;call Gotoxy
;mov edx, OFFSET String0
;call WriteString
;inc X
;cmp X, 52
;jne L0

;L1:
;mov dh, Y
;mov X, 26
;mov dl, X
;call Gotoxy
;mov edx, OFFSET String1
;call WriteString
;inc Y
;cmp Y, 21
;jne L1;

;L2:
;mov Y, 21
;mov dh, Y
;mov dl, X
;call Gotoxy
;mov edx, OFFSET String0
;call WriteString
;inc X
;cmp X, 52
;jne L2

;L3:
;mov Y, 3
;mov dh, Y
;mov X, 52
;mov dl, X
;call Gotoxy
;mov edx, OFFSET String1
;call WriteString
;inc Y
;cmp Y, 21
;jne L3


mov count, 4
A1:


L1:mov dh, Y
mov dl, X
call Gotoxy
mov edx, OFFSET string2
call Writestring
call crlf
add Y, 1
cmp Y, 5
jne L1

mov Y, 5
L2:mov dh, Y
mov dl, X
call Gotoxy
mov edx, OFFSET string3
call Writestring
call crlf
add Y, 1
cmp Y, 7
jne L2


add Y, 4
mov dh, Y
mov dl, X
call Gotoxy
dec count
cmp count, 0
jnz A1




exit
main ENDP
END main
Posted on 2004-09-22 23:35:33 by trueazian
Thinking about it, if you used a tiny grid, each square only a pixel then it could be easily sized with StretchBlt. Intrestingly I was using a grid in a current program and this didn't occur to me till now :).

Won't that depend too much on the stretching mode of the DC? :?
Posted on 2004-09-25 10:51:07 by QvasiModo
I suppose, havn't actually tried it but I imagine it could be made to work.
Posted on 2004-09-25 11:42:20 by Eóin
Wow, my account still works.
For every pixel on the screen just calculate
X+Y
then pick a bit in that sum and if that's 0 make that pixel black and if its 1 make that pixel white. The bit you pick will determine how big your squares are, so if you pick the first bit then every other pixel will be black. I'd pick something like the 5th bit, you'd get nice 16x16 squares.
Posted on 2004-09-25 20:50:37 by Satrukaan
That would give you diagonal stripes. Don't you mean X XOR Y?
Posted on 2004-09-26 05:10:14 by Sephiroth3