Day 24: 341 days left..
No, just my internet connection hates me. In the intervening 11 days went about things old school hitting the books while I was unable to access
the 'world wide web'.
It's surprising what a push that gave things actually, I got all of the graphics finished for crap chess, re-factored the code, created an animated intro screen and played around with a tech demo for copying board layouts from memory. (that was for something completely different but then it struck me this was exactly what I needed for crapchess and controlling the screen!)
Well despite this progress things have been slow, with a combination of no internet and the cat sabotaging my laptop any chance he gets. Its at times like these it shows just how dependent we all have become on the net for a research tool. There were tons of times I was catching myself trying to go onto google to solve a pickle I was in.
In the end I just had to hit the books (usually pointless for specifics) or just brute force a solution by trying every variation of a routine I could to try and get it to work. That is how the board copier 'spawned'. The code is not the prettiest, having used all of the registers already and not really understanding enough to get me out of trouble and the books giving woolly ivory tower explanations like 'manage your stack'
I just used memory locations to store variables.
It was at this point I discovered what was worst than spaghetti goto code... tons of magic numbers for memory locations with values sprinkled willy nilly. Somehow it worked. but I shudder thinking about it...
Music was something that brought a little sanity into the mix. I composed a few little ditties on beepola but the issue was first getting it to load in the program. For very short music its ok. But when things got long or complicated the size of the file was ballooning to 12-15k. When I tried to add it to crap chess I suspect there is not enough room.
I can get the simple tracks to play continuously at the start of the program, but trying the NEXTNOTE code my potato brain seems to not be able to get it to work right.
For crapchess I want to get the background ditty down to a more manageable level so I can have it playing in the background during the game. But I guess its not the end of the world if there is no music.
The other way around this is to radically redactor the code, take out my potato beginners memory mistakes and get the space i need that way.. I am getting to the point where I did everything I can by myself. A little bit of polish I think I can learn a lot from seeing how someone would fix my mess of a program
A big part of the problem is routines that I have just copy pasta'ed into the project that I don't really understand that use/affect registers. This stops basic stuff like DJNZ working as expected and making me having to resort to non-loopy methods to get things to work. If I could figure out how to preserve the registers, do my loops and replace them I could go on a re-factoring rampage
Still while its been frustrating and many times I felt like I was making little progress, at the end of the 11 days I am much further along than when I started. The dragon warrior tile loader was something I couldn't have done at the start of this project. I think its the first time I really sat down and thought 'ooh I did that, damn'
Whole reason behind the tech demo was I was getting cheesed off looking at the same damn green and white board and ugly chessmen every day. Needed something new to fire my braincells. So I figured why not do a tile loader for one of my fav games, dragon quest.
As a project its totally beyond my ability to code, but for stuff like proof of concept and tech demos to teach myself its ok. One day I will make it.
All sprites are done and in the bag, have a number of new routines to handle screen stuff like timers, player indicator, the animated screens, some music. And of course loading the tiles from a list of values in a memory location that can be updated in real time.
Other things that got completed - pause functions, these were used in the animation sequence for the start screen. I wanted to avoid fitting in the viewers so needed to slow down the rate that the attribute data was switched. Sadly this took almost a day of fiddling to get right, all the time I was cursing my internet thinking how easy it would have been to have gotten a solution with google. Still watching the little animation wiggle on the screen was satisfaction at the end of the day.
The animation is just two attribute pages, I got the idea from a spectrum book - that in turn was exposing a 'trade secret' from 1984
I thought 'ooh 768x2 bytes' that sure beats 12.2k.. I want some of that action.
That was a great learning tool. Its a very simple technique but looks nice. I am no artist anyway so attribute blocks are more my speed.
Still to do..
I need to figure out what is going on with the input routine, it must be some problem with the way the project is set up but I can't get the multi input routines to work in the program from how to write spectrum games. As a sanity check I wrote out the example game that the code was used in and it works ok. So it must be my project and not a book that has been used by thousands of people to code spectrum games
(but at 3am when nothing is working, these dark thoughts enter the mind none-the-less..)
Will implement the routine from the dragon quest tile loader into crap-chess. It should be easier as its only 8x8 locations compared to 16x12.. (famous last words).
One thing I wanted to master was how to have menus appear on the screen. I have achieved this in a simplistic potato way, but I need to learn masking so the ugly edges can be hidden and it blends better into the scene. At the moment I am just replacing the tiles with blanks. But that is not an elegent solution I think. And still suffering from a lack of loops in my life.
the code for the tech demo is bellow, you can see its hot mess of non-optimised stuff. I would like to learn how to make it better and more efficient. Figure out how to really master this looping business and taking care of my registers instead of praying that I don't negatively impact the rest of the program every time I make a change haha.
I have been trying to get the graphic tile printer (ROLF) to also adjust the attribute memory at the same time but not been having any luck. I remember one of the spectrum books had a routine to determine the attr location of any point on screen so It would be a matter of trying to get the attr from the tile printing function..
Code: Select all
ORG 33000
MAIN:
; SETS MEMORY LOCATION 50000 TO 0 AND 50001 TO 0, USED IN PRINT TILE. B C
LD A,1
LD (60000),A
LD A,120
LD (23693),A
CALL 3503
LD A,0
CALL 8859
GAMELOOP:
LD A,0
LD HL,40000
LD (HL),0
INC HL
LD (HL),0
INC HL
LD (HL),32000
CALL SETMAP
;CALL MENUS
CALL DRAWMAP
JP GAMELOOP
MENUS:
; 20 IS LEFT TOP CORNER, 21 IS RIGHT TOP CORNER
; 22 IS LEFT BOTTOM CORNER, 23 IS RIGHT BOTTOM CORNER
; 24 IS VERTICAL, 25 HORIZONTAL
LD A,25
LD (32017),A
LD A,25
LD (32018),A
LD A,25
LD (32019),A
LD A,25
LD (32020),A
LD A,21
LD (32021),A
LD A,20
LD (32016),A
LD A,24
LD (32032),A
LD A,26
LD (32033),A
LD A,26
LD (32034),A
LD A,26
LD (32035),A
LD A,26
LD (32036),A
LD A,24
LD (32048),A
LD A,26
LD (32049),A
LD A,26
LD (32050),A
LD A,26
LD (32051),A
LD A,26
LD (32052),A
LD A,24
LD (32064),A
LD A,26
LD (32065),A
LD A,26
LD (32066),A
LD A,26
LD (32067),A
LD A,26
LD (32068),A
LD A,24
LD (32080),A
LD A,26
LD (32081),A
LD A,26
LD (32082),A
LD A,26
LD (32083),A
LD A,26
LD (32084),A
LD A,24
LD (32096),A
LD A,26
LD (32097),A
LD A,26
LD (32098),A
LD A,26
LD (32099),A
LD A,26
LD (32100),A
LD A,22
LD (32112),A
LD A,25
LD (32113),A
LD A,25
LD (32114),A
LD A,25
LD (32115),A
LD A,25
LD (32116),A
LD A,23
LD (32117),A
LD A,24
LD (32101),A
LD A,24
LD (32085),A
LD A,24
LD (32069),A
LD A,24
LD (32053),A
LD A,24
LD (32037),A
LD A,21
LD (32021),A
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
FOREST:
CALL YX2CELL
LD HL,TILE_FORREST
CALL DRAWTILE
RET
SEA:
CALL YX2CELL
LD HL,TILE_SEA
CALL DRAWTILE
RET
GRASS:
CALL YX2CELL
LD HL,TILE_GRASS
CALL DRAWTILE
RET
VLINE:
CALL YX2CELL
LD HL,TILE_VLINE
CALL DRAWTILE
RET
HLINE:
CALL YX2CELL
LD HL,TILE_HLINE
CALL DRAWTILE
RET
TLCOR:
CALL YX2CELL
LD HL,TILE_TLCOR
CALL DRAWTILE
RET
TRCOR:
CALL YX2CELL
LD HL,TILE_TRCOR
CALL DRAWTILE
RET
BLCOR:
CALL YX2CELL
LD HL,TILE_BLCOR
CALL DRAWTILE
RET
BRCOR:
CALL YX2CELL
LD HL,TILE_BRCOR
CALL DRAWTILE
RET
WALL:
CALL YX2CELL
LD HL,TILE_WALL
CALL DRAWTILE
RET
BRICKFLOOR:
CALL YX2CELL
LD HL,TILE_FLOOR
CALL DRAWTILE
RET
STAIRSU:
CALL YX2CELL
LD HL,TILE_STAIRSU
CALL DRAWTILE
RET
STAIRSD:
CALL YX2CELL
LD HL,TILE_STAIRSD
CALL DRAWTILE
RET
TABLE:
CALL YX2CELL
LD HL,TILE_TABLE
CALL DRAWTILE
RET
DOOR:
CALL YX2CELL
LD HL,TILE_DOOR
CALL DRAWTILE
RET
MOUNTAIN:
CALL YX2CELL
LD HL,TILE_MOUNTAIN
CALL DRAWTILE
RET
HILLS:
CALL YX2CELL
LD HL,TILE_HILLS
CALL DRAWTILE
RET
STRIPES:
CALL YX2CELL
LD HL,TILE_STRIPES
CALL DRAWTILE
RET
SWAMP:
CALL YX2CELL
LD HL,TILE_SWAMP
CALL DRAWTILE
RET
CHEST:
CALL YX2CELL
LD HL,TILE_CHEST
CALL DRAWTILE
RET
INN:
CALL YX2CELL
LD HL,TILE_INN
CALL DRAWTILE
RET
ARMOURER:
CALL YX2CELL
LD HL,TILE_ARMOURER
CALL DRAWTILE
RET
OLDMAN:
CALL YX2CELL
LD HL,TILE_OLDMAN
CALL DRAWTILE
RET
GUARD:
CALL YX2CELL
LD HL,TILE_GUARD
CALL DRAWTILE
RET
KING:
CALL YX2CELL
LD HL,TILE_KING
CALL DRAWTILE
RET
TOWNSPEOPLE:
CALL YX2CELL
LD HL,TILE_TOWNSPEOPLE
CALL DRAWTILE
RET
TBLANK:
CALL YX2CELL
LD HL,TILE_BLANK
CALL DRAWTILE
RET
PLAYER:
CALL YX2CELL
LD HL,TILE_PLAYER
CALL DRAWTILE
RET
SETMAP: ; sets the main screen background
LD BC,192 ; length of block to copy
LD HL,ROOM_TANTEGEL_1_2 ; source address
LD DE,32000 ; destination address
LDIR ; copy BC bytes from HL to DE
RET
ROLF:
CP 0
JP Z,BRICKFLOOR
CP 1
JP Z,WALL
CP 2
JP Z,STAIRSU
CP 3
JP Z,GRASS
CP 4
JP Z,SEA
CP 5
JP Z,FOREST
CP 6
JP Z,TABLE
CP 7
JP Z,DOOR
CP 8
JP Z,STAIRSD
CP 9
JP Z,MOUNTAIN
CP 10
JP Z,HILLS
CP 11
JP Z,STRIPES
CP 12
JP Z,SWAMP
CP 13
JP Z,INN
CP 14
JP Z,OLDMAN
CP 15
JP Z,GUARD
CP 16
JP Z,KING
CP 17
JP Z,TOWNSPEOPLE
CP 18
JP Z,CHEST
CP 19
JP Z,ARMOURER
CP 20
JP Z,TLCOR
CP 21
JP Z,TRCOR
CP 22
JP Z,BLCOR
CP 23
JP Z,BRCOR
CP 24
JP Z,VLINE
CP 25
JP Z,HLINE
CP 26
JP Z,TBLANK
CP 99
JP Z,PLAYER
RET ; return
ROO16:
LD IX,16
NMFR:
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
CALL ROO
DEC (IX)
LD e,(IX)
CP 0
JP Z,NMFR
RET
DRAWMAP:
LD IY,32000
LD A,0
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,2
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,4
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,6
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,8
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,10
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,12
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,14
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,16
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,18
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,20
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
LD A,22
LD (50000),A
LD A,0
LD (50002),A
CALL ROO16
RET
ROO:
LD A,(50000)
LD B,A
LD (50000),A
LD A,(50002)
LD C,A
ADD A,2
LD (50002),A
LD A,(IY)
CALL ROLF
INC IY
RET
;Tantegel castle Top left. (1 of 6)
ROOM_TANTEGEL_2_1:
DEFB 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DEFB 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DEFB 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
DEFB 1,1,1,1,0,0,0,0,0,18,0,0,1,1,1,1
DEFB 1,1,1,1,0,6,6,6,6,6,6,0,1,1,1,1
DEFB 1,1,1,1,0,6,16,6,6,0,6,0,1,1,1,1
DEFB 1,1,1,1,0,0,0,18,18,0,0,0,1,1,1,1
DEFB 1,1,1,1,0,0,0,0,0,0,0,15,1,1,1,1
DEFB 1,1,1,1,0,0,15,0,15,0,0,0,1,1,1,1
DEFB 1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1
DEFB 1,1,1,1,0,0,0,0,0,0,0,8,1,1,1,1
DEFB 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
ROOM_TANTEGEL_1_1:
DEFB 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
DEFB 3,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3
DEFB 3,1,0,0,0,0,0,1,3,5,3,5,5,3,5,3
DEFB 3,1,0,0,0,0,0,1,3,3,3,3,3,3,3,3
DEFB 3,1,0,0,1,0,0,1,1,1,1,0,0,1,1,1
DEFB 3,1,0,0,0,0,0,15,0,0,0,0,0,0,0,0
DEFB 3,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1
DEFB 3,1,1,1,1,1,0,1,15,0,0,0,0,0,0,0
DEFB 3,1,0,0,0,1,0,1,2,0,0,0,0,0,1,0
DEFB 3,1,0,17,0,0,0,1,15,0,0,0,0,0,0,0
DEFB 3,1,0,0,0,1,0,1,1,1,0,0,0,0,1,1
DEFB 3,1,1,1,1,1,0,1,5,5,0,0,0,0,5,5
ROOM_TANTEGEL_1_2:
DEFB 3,1,0,0,0,1,0,1,5,5,0,0,0,0,5,5
DEFB 3,1,0,0,15,1,0,1,5,3,0,0,0,0,3,5
DEFB 3,1,18,0,0,7,17,1,3,3,0,0,0,0,3,3
DEFB 3,1,0,18,0,1,0,1,3,3,0,0,0,0,3,3
DEFB 3,1,18,0,18,1,0,1,3,0,0,0,0,0,0,3
DEFB 3,1,1,1,1,1,0,1,3,0,4,4,4,4,0,3
DEFB 3,1,0,0,0,0,0,0,0,0,4,11,11,4,0,0
DEFB 3,1,0,0,0,0,0,0,0,0,4,11,11,4,0,0
DEFB 3,1,1,1,0,0,1,1,1,0,4,4,4,4,0,1
DEFB 3,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1
DEFB 3,1,0,0,0,0,0,0,1,1,0,0,0,0,1,1
DEFB 3,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0
TILE_FLOOR:
DEFB 8, 8, 8, 8,255,255,128,128
DEFB 128,128,128,128,255,255, 8, 8
DEFB 8, 8, 8, 8,255,255,128,128
DEFB 128,128,128,128,255,255, 8, 8
DEFB 16, 16, 16, 16
TILE_WALL:
DEFB 252, 63,200, 19,128, 1,144, 1
DEFB 224, 1,184, 1,204, 5,166, 3
DEFB 192, 1,160, 1,176, 1,209, 83
DEFB 194, 37,230, 17,200, 11,255,255
DEFB 56, 56, 56, 56
TILE_CHEST:
DEFB 0, 0, 0, 0,115,156,127,252
DEFB 241,140,216,198,140, 99,140, 99
DEFB 255,255,140, 99,141,251,141, 11
DEFB 141,251,204, 99,236, 99,255,255
DEFB 16, 16, 16, 16
TILE_SWAMP:
DEFB 189,219,218,107,167, 53, 52,134
DEFB 219,181,169, 85,118,203,101,106
DEFB 139, 21,108,237,149, 52,209,163
DEFB 237,157, 21,110,182,181,185,219
DEFB 4, 4, 4, 4
TILE_FORREST:
DEFB 24, 24, 62, 52,117,122,254,255
DEFB 250,253,255,251,254,253,247,253
DEFB 253,123,251,254,255,247,110,126
DEFB 60, 56, 24, 24,126,126, 0, 0
DEFB 32, 32, 32, 32
TILE_INN:
DEFB 255,255, 0, 0,255,255,247,239
DEFB 128, 1,128, 1,172,165,172,165
DEFB 170,181,170,181,169,173,169,173
DEFB 168,165,168,165,128, 1,255,255
DEFB 56, 56, 56, 56
TILE_ARMOURER:
DEFB 255,255,248, 57,243,145,228, 99
DEFB 204, 71,158,139,175, 29,166, 53
DEFB 164,101,232,245,153,253,207, 57
DEFB 198, 19,147,231, 58, 15,127,255
DEFB 56, 56, 56, 56
TILE_STAIRSU:
DEFB 244, 4, 20, 4, 31, 4, 17,244
DEFB 17, 31, 17, 17, 17, 17, 17, 17
DEFB 17, 17, 17, 17, 17, 17, 17, 17
DEFB 241, 17,255, 17,255,241,255,255
DEFB 56, 56, 56, 56
TILE_STAIRSD:
DEFB 255,255, 31,255, 31,255, 31,255
DEFB 17,255, 17,255, 17,255, 17, 31
DEFB 17, 31, 17, 31, 17, 19, 17, 19
DEFB 17, 19, 17, 18, 17, 18, 17, 18
DEFB 56, 56, 56, 56
TILE_SEA:
DEFB 0, 0, 0, 0, 60, 56, 30, 28
DEFB 0, 0, 7,192, 3,248, 0,192
DEFB 0, 0, 0, 0, 96, 0, 49,192
DEFB 0,248, 0, 0, 0, 0, 0, 0
DEFB 15, 15, 15, 15
TILE_MOUNTAIN:
DEFB 6, 0, 5, 0, 4,176, 12,232
DEFB 9,136, 24,196, 16,132, 35,148
DEFB 33,212, 47, 54,103,146,110,218
DEFB 100,138, 76,218, 56, 78, 31,248
DEFB 56, 56, 56, 56
TILE_HILLS:
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0,224, 3,208, 6,136, 8,196
DEFB 49, 98, 68, 49, 74,153,114,158
DEFB 62, 48, 3, 32, 1,192, 0, 0
DEFB 32, 32, 32, 32
TILE_GRASS:
DEFB 0, 2, 40, 32, 72, 68, 0, 4
DEFB 16,129, 33, 8, 0, 18,100, 16
DEFB 68, 2, 8, 2, 0, 64, 8,132
DEFB 32, 8, 65, 1, 18, 24, 32, 32
DEFB 48, 48, 48, 48
TILE_STRIPES:
DEFB 227,142,199, 28,142, 56, 28,113
DEFB 56,227,113,199,227,142,199, 28
DEFB 142, 56, 28,113, 56,227,113,199
DEFB 227,142,199, 28,142, 56, 28,113
DEFB 49, 49, 49, 49
TILE_TABLE:
DEFB 255,255,128, 1,191,253,160, 5
DEFB 160, 5,160, 5,160, 5,160, 5
DEFB 160, 5,160, 5,160, 5,160, 5
DEFB 160, 5,191,253,128, 1,255,255
DEFB 48, 48, 48, 48
TILE_DOOR:
DEFB 0, 0, 31,248, 51,204, 97,134
DEFB 65,130,193,131,129,129,145,137
DEFB 145,137,185,157,255,255,129,129
DEFB 129,129,129,129,129,129,255,255
DEFB 56, 56, 56, 56
TILE_VLINE:
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 56, 56, 56, 5
TILE_HLINE:
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0,255,255
DEFB 255,255, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 56, 56, 56, 56
TILE_TLCOR:
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0,255
DEFB 1,255, 1,128, 1,128, 1,128
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 56, 56, 56, 56
TILE_TRCOR:
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0,255, 0
DEFB 255,128, 1,128, 1,128, 1,128
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 56, 56, 56, 56
TILE_BRCOR:
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 1,128, 1,128, 1,128,255,128
DEFB 255, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 56, 56, 56, 56
TILE_BLCOR:
DEFB 1,128, 1,128, 1,128, 1,128
DEFB 1,128, 1,128, 1,128, 1,255
DEFB 0,255, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 56, 56, 56, 56
TILE_PLAYER:
DEFB 255,255,248, 31,240, 15,224, 7
DEFB 238,119,224, 7,206,115,202, 83
DEFB 206,115,192, 3,162, 69, 96, 6
DEFB 243,207,249,159,252, 63,255,255
DEFB 56, 56, 56, 56
TILE_OLDMAN:
DEFB 1,224, 2, 56, 6, 14, 12, 2
DEFB 8, 51, 63,253, 20, 31, 52, 48
DEFB 24,112, 17,216, 31, 8, 48, 12
DEFB 35, 4, 46, 4, 56, 12, 16, 8
DEFB 56, 56, 56, 56
TILE_GUARD:
DEFB 3,240, 6, 20, 12, 20, 8, 20
DEFB 8, 20, 31, 22, 21, 20, 53, 20
DEFB 25,244, 17, 28, 31, 4,112,228
DEFB 32,164, 40,228, 56,140, 18, 8
DEFB 56, 56, 56, 56
TILE_KING:
DEFB 0, 0, 2,168, 5, 84, 8, 2
DEFB 8, 2, 30, 4, 53, 4, 33, 4
DEFB 23, 4, 61,252, 34, 4,124,164
DEFB 96,164, 40,196, 56,172, 18, 8
DEFB 56, 56, 56, 56
TILE_TOWNSPEOPLE:
DEFB 0, 0, 15,240, 8, 92, 8,212
DEFB 8, 20, 30, 52, 53, 4, 39, 4
DEFB 23, 4, 61,252, 34, 4, 61,250
DEFB 17, 18, 9, 20, 8,172, 18, 72
DEFB 56, 56, 56, 56
TILE_BLANK:
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 0,0,0,0
END MAIN
What I have been trying and failing to do is read the memory locations starting from 32000 -> 32192 that contain all of the tiles on the screen at the time. The idea is I just poke values into these locations when I want to update the screen and as the code can read the locations and print to the screen it should update whenever the memory is changed. This all works.
But What I can't get to work is a simple nestled loop so that the outer loop handles the rows (12) and the inner loop handles the columns (16). to print the tiles on the screen. At the moment I am having to use the manual method of a kind of half way house between a loop and a mess.
The other thing I cannot get to work is a attribute 'diddler', what I want it to do as its reading the value of the memory location, it at the same time as printing the tile, also updates that locations attribute value from a CP ladder. I have tried and I can't seem to figure out a way to get it to work.
So for example, the brick floor, chest should be red paper, black ink, the walls should be white, the sea blue, the grass, trees, green, well you get the idea.
While this is a perfect project for a NIRVANA program, I just want to get the basics down first before jumping off the deep end.