[TI Asm] Vertical-Scroll Intro
Moderator: MaxCoderz Staff
- nepmarauder
- Regular Member
- Posts: 119
- Joined: Thu 14 Apr, 2005 7:02 pm
- Location: Ann Arbor, MI
- Contact:
[TI Asm] Vertical-Scroll Intro
Hello,
I am working on my game A Life of Crime, and I want to make a scrolling intro picture, kinda like "Part II" of Ben's Pixel Madness 2 (the part with the moving cloud-like objects and the mountain; if you have seen it you know what I am talkin about).
I would like my picture to be two screens tall, now how can I do this. Do I have to use tiles?
Or could I draw a pic on Paint that is 96*128, use CalcGS or iStudio to convert to hex. Then make the pic display at row 0, then display at 255, then at 254, etc. to make it scroll.
I'm not sure, and I don't want to do a ton of work for nothin!
Thanks
I am working on my game A Life of Crime, and I want to make a scrolling intro picture, kinda like "Part II" of Ben's Pixel Madness 2 (the part with the moving cloud-like objects and the mountain; if you have seen it you know what I am talkin about).
I would like my picture to be two screens tall, now how can I do this. Do I have to use tiles?
Or could I draw a pic on Paint that is 96*128, use CalcGS or iStudio to convert to hex. Then make the pic display at row 0, then display at 255, then at 254, etc. to make it scroll.
I'm not sure, and I don't want to do a ton of work for nothin!
Thanks
IT'S GREAT TO BE A MICHIGAN WOLVERINE!
- Jim e
- Calc King
- Posts: 2457
- Joined: Sun 26 Dec, 2004 5:27 am
- Location: SXIOPO = Infinite lives for both players
- Contact:
That's quite simple!
Convert the data just like you said so it's 12 bytes wide and 128 rows high.
Now you just ldir. Heres some example code.
That code will scroll from the top to the bottom.
Simple, no?
Convert the data just like you said so it's 12 bytes wide and 128 rows high.
Now you just ldir. Heres some example code.
Code: Select all
ld hl,INTROPIC
ld b,64
introloop:
push bc
push hl
ld de,gbuf
ld bc,768
ldir ;copy this part to screen
call ionfastcopy ;update lcd
pop hl
ld de,12
add hl,de ;move down 1 row
pop bc
djnz introloop ;loop
Simple, no?
- nepmarauder
- Regular Member
- Posts: 119
- Joined: Thu 14 Apr, 2005 7:02 pm
- Location: Ann Arbor, MI
- Contact:
- nepmarauder
- Regular Member
- Posts: 119
- Joined: Thu 14 Apr, 2005 7:02 pm
- Location: Ann Arbor, MI
- Contact:
- Jim e
- Calc King
- Posts: 2457
- Joined: Sun 26 Dec, 2004 5:27 am
- Location: SXIOPO = Infinite lives for both players
- Contact:
Im assuming you mean you want to display at a given row.
Code: Select all
;a - the row you wish to start on
;bc - location of the picture to display.
displaypic:
ld l,a
ld h,0
add hl,hl ;x2
add hl,hl ;x4
ld e,l
ld d,h
add hl,hl ;x8
add hl,de ;x12
add hl,bc ;add pic loc
ld de,gbuf
ld bc,768
ldir
call ionfastcopy ;update lcd if you want
ret
To draw a portion of a 96*X image, use the row * 12 as the offset to the start position.
Example:
You need to make sure the row number is in bounds, drawing from out of bounds looks like ugly garbage. So if your image is 192 pixels high, don't draw from row 129 or higher.
You can still play around with this, if you want to cut off 8 pixels off the top and bottom for a widescreen effect, you can change the size (subtract 16*12), and change the destination copy address (add 8*12 to plotsscreen)
Edit: Wow, posted nearly the same exact code, despite starting the post before there was a visible reply.
Example:
Code: Select all
draw_image:
;a = Y position to take the source from
;Step 1: Transfer A to HL, and multiply by 12
ld l,a
ld h,0
;*4
add hl,hl
add hl,hl
ld c,l
ld b,h
;*8
add hl,hl
;+*4 = *12
add hl,bc
;Step 2: Add the base
ld bc,my_picture
add hl,bc
;Step 3: Copy to the graph screen
ld bc,768
ld de,plotsscreen
ldir
;Step 4: Copy to LCD
call ionfastcopy
ret
You can still play around with this, if you want to cut off 8 pixels off the top and bottom for a widescreen effect, you can change the size (subtract 16*12), and change the destination copy address (add 8*12 to plotsscreen)
Edit: Wow, posted nearly the same exact code, despite starting the post before there was a visible reply.
You know your hexadecimal output routine is broken when it displays the character 'G'.
- nepmarauder
- Regular Member
- Posts: 119
- Joined: Thu 14 Apr, 2005 7:02 pm
- Location: Ann Arbor, MI
- Contact:
- tr1p1ea
- Maxcoderz Staff
- Posts: 4141
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: I cant seem to get out of this cryogenic chamber!
- Contact:
For some reason ive always done it like:
There is of course no difference speed/size wise, just thought id mention it .
Code: Select all
ld l,a
ld h,0
ld c,l
ld b,h
add hl,hl ; x 2
add hl,bc ; x 3
add hl,hl ; x 6
add hl,hl ; x 12
- nepmarauder
- Regular Member
- Posts: 119
- Joined: Thu 14 Apr, 2005 7:02 pm
- Location: Ann Arbor, MI
- Contact: