Ahh so i end up with a 'cut out' from the background.. will need to figure out how to do that
Yes I guess it could be used for like a chess tutor / chess problems. Then there is always pawn apocalypse.
The problem with the attributes is ... well my theory really only works for the white squares as they would be the same colour.. I really am not sure what the issue is with the green squares...
Code: Select all
main: org $80e8 ; (33000)
jp start
start:
call SETHELPSCREEN
call SETMAINSCREEN ; calls the subroutine SETMAINSCREEN
call HIGHLIGHTBOARDA8
call SFX
call SETMAINSCREEN
call HIGHLIGHTBOARDB8
call SFX
call SETMAINSCREEN
call HIGHLIGHTBOARDC8
call SFX
call SETMAINSCREEN
call HIGHLIGHTBOARDD8
call SFX
call SETMAINSCREEN
call HIGHLIGHTBOARDE8
call SFX
call SETMAINSCREEN
call HIGHLIGHTBOARDF8
call SFX
call SETMAINSCREEN
call HIGHLIGHTBOARDG8
call SFX
call SETMAINSCREEN
call HIGHLIGHTBOARDH8
call SFX
call NEVERENDINGSTORY ; calls the subroutine NEVERENDINGSTORY
NEWGAMEPLACECHESSMEN:
ld b,4
ld c,4
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,4
ld c,6
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,4
ld c,8
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,4
ld c,10
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,4
ld c,12
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,4
ld c,14
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,4
ld c,16
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,4
ld c,18
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,6
ld c,4
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,6
ld c,6
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,6
ld c,8
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,6
ld c,10
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,6
ld c,12
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,6
ld c,14
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,6
ld c,16
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,6
ld c,18
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,18
ld c,4
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,18
ld c,6
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,18
ld c,8
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,18
ld c,10
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,18
ld c,12
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,18
ld c,14
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,18
ld c,16
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,18
ld c,18
call yx2cell
ld hl,tilegraphic_rook
call drawtile
ld b,16
ld c,4
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,16
ld c,6
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,16
ld c,8
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,16
ld c,10
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,16
ld c,12
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,16
ld c,14
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,16
ld c,16
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ld b,16
ld c,18
call yx2cell
ld hl,tilegraphic_pawn
call drawtile
ret
drawtile: ;arrive HL pointing at tile graphic, DE at screen memory
ld b,16 ;loop counter for 16 px high tile
drawtileloop:
ld a,(hl) ;get byte of graphic
ld (de),a ;plonk it in screen memory
inc hl ;next byte of graphic
inc e ;next column of screen
ld a,(hl) ;right hand side of tile
ld (de),a
inc hl ;next byte of graphic
dec e ;back to left hand side of tile
call nextlinedown ;move DE down one screen line
djnz drawtileloop
ret
;
nextlinedown: ;arrive DE at screen address, move it down one pixel line
inc d
ld a,d
and 7
ret nz
ld a,e
add a,32
ld e,a
ret c
ld a,d
sub 8
ld d,a
ret
yx2cell: ;arrive with b=y column 0-23, c=x column 0-31, point DE at corresponding screen address
ld a,b
rrca
rrca
rrca
and 224
or c
ld e,a
ld a,b
and 24
or 64
ld d,a
ret
tilegraphic_pawn:
db 0,0
db 0,0
db 0,0
db 0,0
db 0,0
db 3,192
db 7,224
db 7,224
db 7,224
db 3,192
db 1,128
db 1,128
db 1,128
db 3,192
db 7,224
db 0,0
tilegraphic_rook:
db 0,0
db 0,0
db 0,0
db 0,0
db 10,80
db 15,240
db 7,224
db 3,192
db 3,192
db 3,192
db 3,192
db 3,192
db 3,192
db 7,224
db 15,240
db 0,0
background_definition:
incbin "crapbkg2.scr" ; the background data is in this file
helpstring: defb 16, 8, 17, 0, 22, 3, 4, "If you have an issue, here is a tissue..."
defb 16, 7, 17, 0, 22, 4, 4, "If you have an issue, here is a tissue..."
defb 16, 6, 17, 0, 22, 5, 4, "If you have an issue, here is a tissue..."
defb 16, 5, 17, 0, 22, 6, 4, "If you have an issue, here is a tissue..."
defb 16, 4, 17, 0, 22, 7, 4, "If you have an issue, here is a tissue..."
defb 16, 3, 17, 0, 22, 8, 4, "If you have an issue, here is a tissue..."
defb 16, 2, 17, 0, 22, 9, 4, "If you have an issue, here is a tissue..."
defb 16, 1, 17, 0, 22, 10, 4, "If you have an issue, here is a tissue..."
defb 16, 8, 17, 0, 22, 11, 4, "If you have an issue, here is a tissue..."
defb 16, 7, 17, 0, 22, 12, 4, "If you have an issue, here is a tissue..."
defb 16, 6, 17, 0, 22, 13, 4, "If you have an issue, here is a tissue..."
infostring: defb 16, 2, 17, 6, 22, 21, 9, "White to move..." ; this is the information bar at the bottom of the screen
;this is the players moves - when the game is finished it will be updated from the input but for now its just placeholder stuff.
string: defb 16, 3, 17, 0, 22, 3, 21, "e4v bd6"
defb 22, 4, 21, "d4 Nf6"
defb 22, 5, 21, "Nc3 Nbd7"
defb 22, 6, 21, "Nf3 e5"
defb 22, 7, 21, "Bc4 exd4"
defb 22, 8, 21, "Nxd4 Ne5"
defb 22, 9, 21, "Be2 Be7"
defb 22, 10, 21, "O-O Bd7"
defb 22, 11, 21, "f4 Ng6"
defb 22, 12, 21, "Be3 O-O"
defb 22, 13, 21, "Qd3 c6"
defb 22, 14, 21, "h3 d5"
defb 22, 15, 21, "e5 Ne8"
defb 22, 16, 21, "g4 Nc7"
defb 22, 17, 21, "Nf3 Re8"
defb 22, 18, 21, "f5 Nf8"
defb 22, 19, 21, "g5 b5"
eostr: equ $
board: defb 2, 3, 4, 6, 5, 4, 3, 2
defb 1, 1, 1, 1, 1, 1, 1, 1
defb 0, 0, 0, 0, 0, 0, 0, 0
defb 0, 0, 0, 0, 0, 0, 0, 0
defb 0, 0, 0, 0, 0, 0, 0, 0
defb 0, 0, 0, 0, 0, 0, 0, 0
defb 1, 1, 1, 1, 1, 1, 1, 1
defb 2, 3, 4, 6, 5, 4, 3, 2
SETTEXT: ; sets up the text on the main screen
call SETPLAYERMOVELIST ; calls the subroutine SETPLAYERMOVELIST
call SETPROGRAMOUTPUT ; calls the subroutine SETPROGRAMOUTPUT
ret ; return
SETBORDER: ; sets the colour of the border
ld a,d ; Set the colour to red (2).
call $229b ; (8859) Set permanent border colours.
ret ; return
CLEARSCREEN: ; clears the screen
ld a,71 ; White ink (7), black paper (0), bright (64).
ld (23693),a ; Set our screen colours.
xor a ; Load accumulator with zero.
call 8859 ; Set permanent border colours.
call 3503 ; Clear the screen, open channel 2.
; call $daf ; (3503) Clear the screen, open channel 2.
ret ; return
SFX:
zap:
ld d,16 ;speaker = bit 4
ld e,0 ;distance between speaker move counter
ld b,255 ;overall length counter
blp0: ld a,d
;and 248 ;keep border colour the same
out (254),a ;move the speaker in or out depending on bit 4
cpl ;toggle, so we alternative between speaker in and out to make sound
ld d,a ;store it
ld c,e ;now a pause
blp1: dec c
jr nz,blp1
dec e ;change to inc e to reverse the sound, or remove to make it a note
djnz blp0 ;repeat B=255 times
ret
HIGHLIGHTBOARDA8:
ld hl, 22528+132
ld (hl), 30
ld hl, 22528+133
ld (hl), 30
ld hl, 22528+164
ld (hl), 30
ld hl, 22528+165
ld (hl), 30
ret
HIGHLIGHTBOARDB8:
ld hl, 22528+134
ld (hl), 30
ld hl, 22528+135
ld (hl), 30
ld hl, 22528+166
ld (hl), 30
ld hl, 22528+167
ld (hl), 30
ret
HIGHLIGHTBOARDC8:
ld hl, 22528+136
ld (hl), 30
ld hl, 22528+137
ld (hl), 30
ld hl, 22528+168
ld (hl), 30
ld hl, 22528+169
ld (hl), 30
ret
HIGHLIGHTBOARDD8:
ld hl, 22528+138
ld (hl), 30
ld hl, 22528+139
ld (hl), 30
ld hl, 22528+170
ld (hl), 30
ld hl, 22528+171
ld (hl), 30
ret
HIGHLIGHTBOARDE8:
ld hl, 22528+140
ld (hl), 30
ld hl, 22528+141
ld (hl), 30
ld hl, 22528+172
ld (hl), 30
ld hl, 22528+173
ld (hl), 30
ret
HIGHLIGHTBOARDF8:
ld hl, 22528+142
ld (hl), 30
ld hl, 22528+143
ld (hl), 30
ld hl, 22528+174
ld (hl), 30
ld hl, 22528+175
ld (hl), 30
ret
HIGHLIGHTBOARDG8:
ld hl, 22528+144
ld (hl), 30
ld hl, 22528+145
ld (hl), 30
ld hl, 22528+176
ld (hl), 30
ld hl, 22528+177
ld (hl), 30
ret
HIGHLIGHTBOARDH8:
ld hl, 22528+146
ld (hl), 30
ld hl, 22528+147
ld (hl), 30
ld hl, 22528+178
ld (hl), 30
ld hl, 22528+179
ld (hl), 30
ret
HIGHLIGHTBOARDA7:
ld hl, 22528+196
ld (hl), 30
ld hl, 22528+197
ld (hl), 30
ld hl, 22528+228
ld (hl), 30
ld hl, 22528+229
ld (hl), 30
ret
HIGHLIGHTBOARDA6:
ld hl, 22528+260
ld (hl), 30
ld hl, 22528+261
ld (hl), 30
ld hl, 22528+292
ld (hl), 30
ld hl, 22528+293
ld (hl), 30
ret
HIGHLIGHTBOARDA5:
ld hl, 22528+324
ld (hl), 30
ld hl, 22528+325
ld (hl), 30
ld hl, 22528+356
ld (hl), 30
ld hl, 22528+357
ld (hl), 30
ret
HIGHLIGHTBOARDA4:
ld hl, 22528+388
ld (hl), 30
ld hl, 22528+389
ld (hl), 30
ld hl, 22528+420
ld (hl), 30
ld hl, 22528+421
ld (hl), 30
ret
HIGHLIGHTBOARDA3:
ld hl, 22528+452
ld (hl), 30
ld hl, 22528+453
ld (hl), 30
ld hl, 22528+484
ld (hl), 30
ld hl, 22528+485
ld (hl), 30
ret
HIGHLIGHTBOARDA2:
ld hl, 22528+516
ld (hl), 30
ld hl, 22528+517
ld (hl), 30
ld hl, 22528+548
ld (hl), 30
ld hl, 22528+549
ld (hl), 30
ret
HIGHLIGHTBOARDA1:
ld hl, 22528+580
ld (hl), 30
ld hl, 22528+581
ld (hl), 30
ld hl, 22528+612
ld (hl), 30
ld hl, 22528+613
ld (hl), 30
ret
SETMAINBACKGROUND: ; sets the main screen background
ld bc,$1b00 ;length of block to copy
ld hl,background_definition ;source address
ld de,$4000 ;destination address
ldir ;copy BC bytes from HL to DE
ret ; return
SETPLAYERMOVELIST: ; prints the player move list
ld a, 2 ; loads 2 into register A
call $1601 ; (5633)
ld de, string ; get the players moves
ld bc, eostr-string ; figure the length
call $203c ; (8252) make the rom call
ret ; return
SETPROGRAMOUTPUT: ; prints the program output (prompts)
ld a, 2 ; loads 2 into register A
call $1601 ; (5633)
ld de, infostring ; get the infomation to player
ld bc, eostr-infostring ; figure the length
call $203c ; (8252) make the rom call
ret ; return
NEVERENDINGSTORY: ; infinite loopin'
jp NEVERENDINGSTORY ; round and round and round we go...
SETHELPSCREEN:
ld d,2 ; sets register d to 2 (used to tell SETBORDER we want red)
call SETBORDER
call CLEARSCREEN ; calls the subroutine CLEARSCREEN
;call SETMAINBACKGROUND ; calls the subroutine SETMAINBACKGROUND
call SETHELPTEXT ; sets the help text
ret
SETMAINSCREEN: ; sets up the main screen
ld d,1 ; sets register d to 1 (used to tell SETBORDER we want blue)
call SETBORDER ; calls the subroutine SETBORDER
call CLEARSCREEN ; calls the subroutine CLEARSCREEN
;call SETMAINBACKGROUND ; calls the subroutine SETMAINBACKGROUND
call NEWGAMEPLACECHESSMEN
call SETTEXT ; calls the subroutine SETTEXT
ret ; return
SETHELPTEXT: ; prints the help screen text
ld a, 2 ; loads 2 into register A
call $1601 ; (5633)
ld de, helpstring ; get the infomation to player
ld bc, eostr-helpstring ; figure the length
call $203c ; (8252) make the rom call
ret ; return
end main
Ok I figured out what was up - as Seven-FFF pointed out my attributes were all out of whack...