This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
james


Member


Joined: 25 May 2003
Posts: 114

Posted: 28 May 2003 04:55:16 pm    Post subject:

HELLO EVERYONE

WOW,THE FIRST PERSON TO ASK A QUESTION.ANYWAYZ I AM HAVING A LITTLE TROUBLE WITH TILE MAPS.I HAVE A FULLY FUNTIONAL SPRITE THAT CAN MOVE AROUND.NOW HOW WOULD I GO ABOUT MAKING THE BACKROUND SCROLL WHEN THE SPRITE SCROLLS.I HAVE SEEN THE SOURCE CODE FROM VOID ON 8X8 AND 12X12 TILE MAPS,BUT THATS FOR THE 83 NO THE 83+(WHICH IM WORKING WITH).ALSO FOR ION,BUT IF ITS EASIER TO EXPLAIN IT IN MIRAGE THATS FINE TO.ANY TUTORIALS OR EXAMPLES(SOURCE) WOULD BE MUCH APPRECIATED.

THX IN ADVANCE

JAMES
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 28 May 2003 06:41:38 pm    Post subject:

Well James for starters not only are you going to need a tilemap routine you'll also have to have it smooth scrolling( I know this is for Gap Skater). Are you ready for the super long tutorial I'm gonna have to give you?
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 28 May 2003 06:48:31 pm    Post subject:

You ahead and post regardless as to wheater or not he is ready.

For example, I could write my own tile toruitne quite quickly, but mine would likely scroll to the left and right one byte at a time.
Back to top
james


Member


Joined: 25 May 2003
Posts: 114

Posted: 28 May 2003 07:08:38 pm    Post subject:

HEY,JUSTIN

ITS NOT FOR GAPSKATER,THAT DOESNT SCROLL ITS JUST LIKE THE COMPUTER PORT,IF U HAVE EVER PLAYED THAT

THIS IS FOR A TOP SECRET GAME
Very Happy


BUT U WILL HEAR A LOT MORE ABOUT IT IN THE FUTURE

AS FOR GAPSKATER I NEED TO KNOW HOW TO MAKE ANIMATED SCREEN SHOTS SO THAT I CAN POST ONE IN THE FORUM,LIKE FBF
SO PEOPLE CAN GET AN IDEA OF THE GAME
THATS LATER THOUGH CAUSE IM WORKING ON TILE MAPS NOW
O AND ANY TITLE MAP ROUTINE WILL HELP
Back to top
james


Member


Joined: 25 May 2003
Posts: 114

Posted: 29 May 2003 02:18:34 pm    Post subject:

jkbirk

i know your on,have any ideas or tutorials
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 29 May 2003 03:42:04 pm    Post subject:

I have an interrupt tutorial, and I could write a tutorial on direct LCD communication, or using the plotSScreen.

Put simply:

You have an 8x8 tile

%01010101
%11111111
%10100011
%01010101
%11111111
%10100011
%01010101
%11111111

Now, you have the plotsscreen which is 96 horizontal pixels by 64 verticle pixels

So, 96/8 is 12 bytes of data across and 64 rows

To place this tile in the upper most right corner, simply copy the bytes

e.g.
The first byte to the plotSScreen
The seocnd to plotSScreen+12 because we want it to be on the next row... et cetera

You wright a routine, and when called, it puts the tile where you tell it.

Now, you make a map of where to put the tiles

.db 1,2,3,4,5,6,7,8,9,0,1,2
.db 1,2,3,4,5,6,7,8,9,0,1,2
.db 1,2,3,4,5,6,7,8,9,0,1,2
.db 1,2,3,4,5,6,7,8,9,0,1,2
.db 1,2,3,4,5,6,7,8,9,0,1,2
.db 1,2,3,4,5,6,7,8,9,0,1,2
.db 1,2,3,4,5,6,7,8,9,0,1,2
.db 1,2,3,4,5,6,7,8,9,0,1,2

64/8 dictates that you can have 8 rows of tiles.

So, the routine goes through the map placing each tile. After all the tiles are copied to the plotsscreen, you use grfbufcpy or ionfastcopy.

Then the user sees your map.
Back to top
Sfar


Newbie


Joined: 29 May 2003
Posts: 13

Posted: 29 May 2003 06:39:50 pm    Post subject:

cool...I want to learn how to make a super duper scrolling tilemap that will only scroll one pixel at a time. This is because I may want to make a RPG and I don't want it to be like Zelda for the 83+(scrolls entire screen when you touch a side...quite annoying if you ask me)
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 29 May 2003 10:54:28 pm    Post subject:

Well, you could scroll 1/12 of the screen at a time left or right.

You could also scroll 1/8 of a screen up or down.

In other words, you could do quite well be scrolling one tile at a time.
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 29 May 2003 11:23:50 pm    Post subject:

As in the case with my rpg. Very Happy I was thinking of making it smooth scrolling but it would take up even more code. I do not have much time online for about 2 days so I will post about how to do smooth scrolling then.
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 30 May 2003 10:30:22 am    Post subject:

Ok here's how it is done. Note this my technique and may not be as effective as others.

Instead of the normal 768 byte buffer(12bytes*64bytes screen) you must use a 1120byte buffer(14bytes*80bytes)

The reason being is you're going to need to scroll the screen into place.

What you'll need to do is place the entire graphics into the giant buffer.

The idea is to place all the tiles in order. James I know you are capable of this so I'm not gonna post the source (yet, if you really need help I'll tell more) but I will tell you what needs to be done.

You'll need a sprite routine. All the Ion one's write to the plotsscreen. And you want to write to your big buffer. You can change this by copying the sprite routine into your code and modifying the line ld de,gbuf
with ld de,yourbuffer

the idea is to place a series of sprites, You use an array to determine which tile to place.

.db 0,1,1,2,3,4,2,3,4 ect.

The creat an offset to get the sprite. usually multiplying the tile number by 8 because I'm assuming your tiles will be 8*8. Then you place it at the coordinates you choose. usually this is in succession. You keep trach of the x and y coords of the sprite using a temp var.

Now how to read from a tilemap.

You should know that ld a,(hl) gets the byte at the address in hl and puts that byte into a

You must specify how many bytes wide your map is , then you must multiply that by your y coord, and your xcoord must be added to the previous

example(8byte*4byte array)

.db 0,0,0,0,0,0,0,0,0
.db 1,1,1,1,1,1,1,1,1
.db 2,2,2,2,2,2,2,2,2
.db 3,3,3,3,3,3,3,3,3

ycoord .equ 2
xcoord .equ 3

ld h,$00
ld de,$0000
ld a,(ycoord)
ld l,a
add hl,de
add hl,de
add hl,de
;----------------------------
; .db 0,0,0,0,0,0,0,0,0
; .db 1,1,1,1,1,1,1,1,1
; .db 2,2,2,2,2,2,2,2,2 This is the row you specified above
; .db 3,3,3,3,3,3,3,3,3
;----------------------------

ld d,0
ld a,(xcoord)
ld e,a
add hl,de
;-------------------------------------
; .db 0,0,0,0,0,0,0,0,0
; .db 1,1,1,1,1,1,1,1,1
; .db 2,2,2,2,2,2,2,2,2; the bolded byte is the one we're going to read
; .db 3,3,3,3,3,3,3,3,3
;-------------------------------------
ex de,hl ;now we must add this offset to the location of the array so we are reading from the right spot
ld hl,array
add hl,de
ld a,(hl)

If you need more help ask.


Last edited by Guest on 30 May 2003 10:34:41 am; edited 1 time in total
Back to top
james


Member


Joined: 25 May 2003
Posts: 114

Posted: 31 May 2003 12:43:35 pm    Post subject:

more explanition ,on the actual programming
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 31 May 2003 01:58:03 pm    Post subject:

I think he was clear.

He said that a tile is 8*8, there aer 12 horizontal by 8 vertical tiles, and he uses a map to draw the tiles.

To find the place in the map, he said he keeps track of the upper left cornerand multiplies by 8.

In other words, if the user presses right, the horizontal coordinate is changed by one.

1*8=8 (A tile)

So, the screen is redrawn from a different location in the map.
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 31 May 2003 02:31:11 pm    Post subject:

Only one thing JBirk.

He want's smooth scrolling not tile scrolling. Also my above post was for 4 way smooth scrolling. He only wants it to move the screen left giving the appearance he's moving right so I'll explain that. He'll need a 13 byte wide buffer by 64 bytes high. In other words a 832 byte buffer.

After copying all the graphical data to the buffer he has to do the following. He has to rl each row to shift the bits over 1.

shiftleft:
ld hl,your_buffer+831
ld bc,64
shiftleftloop:
push bc
ld bc,13
shiftleftloop1:
rl (hl)
dec hl
djnz shiftleftloop1
res 7,(hl)
pop bc
djnz shiftleftloop
ret


He also needs to have a counter that will redraw the 13th row after he has shifted 8 times (the number will be 7) meaning every time he redraws the map he has to reset the counter.

Now when it comes to placing this buffer onto the graphscreen he has to copy the first 12 bytes of every row to the plotsscreen (gbuf for Ion).
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 02 Jun 2003 02:57:07 am    Post subject:

Yeah, I get the picture.

You are wrighting a rotine to place a picture bigger than the screen size on the screen.

Sience it cannot all fit, you scroll it by drawing it from a given point.

The theoretical concept is quite simple Very Happy
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 04 Jun 2003 07:11:54 pm    Post subject:

theoretically it is easy, physically, it is not as easy, but it shouldn't be too hard for someone who is at least intermediate assembly!
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 05 Jun 2003 02:19:41 am    Post subject:

Displaying a scrolling pic is intermideat asm, but doing it with interlaced greyscale using interrupts is advanced assembly.
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 05 Jun 2003 12:12:15 pm    Post subject:

ya, because the grayscale routines are easier to use than _DisplayImage in my opinion, they are just plain self explanitory... but i dont dare try...
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 05 Jun 2003 04:44:46 pm    Post subject:

Greayscale is not so bad once you have a packaged kit containing all of the neccessary routines.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement