Hello! Because I am still learning ASM, I'll need a little bit of help here on a Christmas Tree project. It's on Cemetech, but I'd figured that it would be better to ask on other forums, and not just Cemetech.
HL is the sprite data
Somehow get A to be the sprite height and BC to be the sprite width
DE must point to the top-left pixel of where the sprite will go.
(Put the loop label here)
push bc ; Save the sprite width for later on
push de ; Save the current pixel for later on
ldir ; Does "ld (de),(hl) \ inc hl \ inc de \ dec bc" until BC=0 (so effectively it copies BC bytes from (HL) to (DE)
pop de ; Grab the far left pixel of the current row
ld bc,320
ex de,hl ; Swap HL and DE temporarily so we can add a number into DE
add hl,bc ; Add 320 to the screen pixel pointer (normally DE, but we swapped it with HL) to advance to the next row on the screen
ex de,hl ; Swap them back to normal
pop bc ; Retrieve the sprite width again
dec a
jr nz,LoopLabel
; "dec a \ jr nz" is basically DJNZ but using the A register instead of B
.nolist
#include "includes\ti84pce.inc"
.list
.org userMem-2
ProgramStart:
.db tExtTok,tAsm84CeCmp
;...
;---> 8bpp picture
ld a,lcdBpp8
ld (mpLcdCtrl),a
ld hl,christmastree_paletteStart ; palette mem
ld de,mpLcdPalette
ld bc,christmastree_paletteEnd-christmastree_paletteStart
ldir
ld hl,christmastree_sprite
call drawSprite8bpp
;...
ld a,lcdBpp16
ld (mpLcdCtrl),a
ret
#include "christmastree.bin"
And for reference, I would like it to look something like this, but minus the curves.
(http://media.use.com/images/s_1/142a588e5c23be241a9a.jpg) (http://www.use.com/Fdv1r)
Am I right? Or am I doing something wrong in the above code?
Sounds like a good start to ASM! Will the lights be blinking?
Good luck but I can't really help :/ I have no experience with ASM, sorry ._.
Yes, the lights will be blinking.
Quote from: alexgt on January 02, 2016, 11:33:13 PM
Good luck but I can't really help :/ I have no experience with ASM, sorry ._.
Thanks. But please... Next time, if you don't know anything, please don't post. Just trying to point something out.
Note,
@caleb1997 , that CodeWalrus etiquette is different from Cemetech.
Yeah, encouragement is welcome here. There is nothing wrong with his post, it's not counter productive so it's a valid comment.
My bad.
I apologize.
In light of that, I ask a question: Can somebody please help me develop a sprite routine? Because it looks like it'll be a while until I can get to a generator (I know of a few, though) that can make one for me, and rather than waiting for access to a generator, I've decided to write my own sprite routine. Plus it'll give me something to do.
So... How would I get started?
Hm you might need to ask on Cemetech, since CodeWalrus doesn't have any Z80 ASM programmer currently active. But in case one passes by I will rename your topic so that it looks like an actual help topic.