+-Discord Shoutbox


Alternatively, join us on Discord directly.
You can help CodeWalrus stay online by donating here.

Help with ASM Christmas Tree project [z80]

Started by caleb1997, December 31, 2015, 07:35:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

caleb1997

December 31, 2015, 07:35:39 PM Last Edit: January 14, 2016, 06:17:29 PM by DJ Omnimaga
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.

Am I right? Or am I doing something wrong in the above code?
  • Calculators owned: CSE, CE

Unicorn

Sounds like a good start to ASM! Will the lights be blinking?
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

alexgt

Good luck but I can't really help :/ I have no experience with ASM, sorry ._.
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

caleb1997

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.
  • Calculators owned: CSE, CE

DJ Omnimaga

Note, @caleb1997 , that CodeWalrus etiquette is different from Cemetech.
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo Wii U

novenary

Yeah, encouragement is welcome here. There is nothing wrong with his post, it's not counter productive so it's a valid comment.

caleb1997

January 04, 2016, 08:58:15 PM #6 Last Edit: January 14, 2016, 03:41:29 PM by caleb1997
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?
  • Calculators owned: CSE, CE

DJ Omnimaga

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.
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo Wii U

Powered by EzPortal