I am creating a program, and I want to make it have a movable map. I could give you all the sprites, but I want it to have it in asm because it is fast. I could also give you the entire map. Someone please help. I will give credit to anyone who does.
Do you mind telling us what its for? You could attach the sprites to this forum for everyone to see.
I just want to know how to do it in asm. It's for a game. I want to be able to make a sprite and put it in the program. I also want the ability to say that if the character's coordinates is at a certain point, then load a different map into hl and change the coordinates. It would be a large map with 8 by 8 sprites. The map would be bigger than what you can put on screen, so when the person moves, it moves with him. I also need to make a "no go" spaces so that it doesn't go off the screen.
8*8??? the screen is 8*12…
annyway:
the #sprite is the Nth number in the array that contains sprite data:
array:
.db 1,1,1,1,1,1,1,1
.db 1,0,0,0,0,0,0,1
.db 1,0,0,0,0,0,0,1
.db 1,0,0,0,0,0,0,1
.db 1,0,0,0,0,0,0,1
.db 1,0,0,0,0,0,0,1
.db 1,0,0,0,0,0,0,1
.db 1,1,1,1,1,1,1,1
ycoord:0
xcoord:0
spirte :
*BINARY JUNK HERE*
the deal i simple:
you load ycoord into HL
you multiply HL by 8
you load xcoord into DE
you add DE into HL
you load (array) into DE
you add DE into HL
you load (HL) into DE
congrulations! DE does now contain the # of the sprite! yay (1 in this chase..)
now, all you have to do is displaying the sprite…
scrolling maps? just mess whit xcoord and ycoord… (suggest creating temp vars)
actually, I was thinking of making the map location be hl. Also, I meant 8X8 sprites and an 8X12 screen. I know how to make a sprite, but I don't know how to put it up on the screen.
P.s. Don't you have to do:
Sprite:
.db 8,1
it dispay a sprite, you do someting like this:
this routine asumes the adress of the sprite is already in HL, and the adress of plotscreen is already in DE
start:
LD B,8 ;8 =hight of sprite
LD a,8
sub a,b
CALL sprite ;or just copy/paste "sprite" routine here
DJNZ start
RET
sprite:
LD (DE),(HL)
INC hl
INC de \ INC de \ INC de \ INC de \ INC de \ INC de
INC de \ INC de \ INC de \ INC de \ INC de \ INC de ;or whateer method you feel using to do DE+12….
RET
if you want a tilemap, call this routine 8*12 times (dont forget to update HL and DE each time… temp vars ftw)
that's all well and good, but I now am using xlib. When I am done, I will show you the entire basic code and everything. Would there be any way to turn it into assembly?
It doesn't have to be direct translation, It just has to do the same thing.
doing it yourself is the only way…
edit: there might be some kind ppl that can port it for you…
but really, asm is not as hard as you think
"Think", I've tried it!!!
ld hl,mapdata
mapdata:
.db blacksprite,whitesprite,blacksprite,whitesprite
.db whitesprite,blacksprite,whitesprite,blacksprite
blacksprite:
.db 8,1
.db %11111111
.db %11111111
.db %11111111
.db %11111111
.db %11111111
.db %11111111
.db %11111111
.db %11111111
whitesprite:
.db 8,1
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
I just don't know how to put that up on the screen.
P.s. Since nothing is coming to mind, what is ppl?
people…
in asm you need to update the screen before it shows up
BCALL(_grbufcpy)
oh, and the method you are using to hold the tilemap data sucks
it takes 2 bytes per tile
if you post the prog, i might be able to port is (afther i finish lights out ^^)