Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 03:31:27 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: Sprite is not showing up right -  (Read 280 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
blue_bear_94
LV7 Elite (Next: 700)
*******
Online Online

Gender: Male
Last Login: Today at 03:06:56
Date Registered: 09 May, 2012, 02:45:26
Location: Earth
Posts: 586


Topic starter
Total Post Ratings: +3

View Profile
« on: 21 May, 2012, 03:03:36 »
0

I was making a movement example and everything works except that the sprite is showing up as a line instead of a box. If anyone could help me, thanks in advance!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include    "ti83plus.inc"
#define     progStart   $9D95
.org        progStart-2
.db         $BB,$6D
x .equ AppBackUpScreen
y .equ AppBackUpScreen+1
push bc
    push de
    ld hl,x
    ld (hl),0
    ld hl,y
    ld (hl),0
MainLoop:
    call EraseSpr
    ld a,%11111110
    out ($01),a
    in a,($01)
    ld b,a
    bit 0,b
    call z,Down
    bit 1,b
    call z,Left
    bit 2,b
    call z,Right
    bit 3,b
    call z,Up
    call DrawSpr
    ld a,%11111101
    out ($01),a
    in a,($01)
    cp %10111111
    jr nz,MainLoop
    pop de
    pop bc
    ret
Down:
    ld hl,y
    ld a,(hl)
    cp 55
    ret z
    inc (hl)
    ret
Up:
ld hl,y
    ld a,(hl)
    cp 0
    ret z
dec (hl)
    ret
Left:
ld hl,x
    ld a,(hl)
    cp 0
    ret z
dec (hl)
    ret
Right:
ld hl,x
    ld a,(hl)
    cp 87
    ret z
inc (hl)
    ret
BoxPic:
.db 1,8
.db %11111111
.db %10000001
.db %10000001
.db %10000001
.db %10000001
.db %11111111
BoxErase:
.db 1,8
.db 0
.db 0
.db 0
.db 0
.db 0
.db 0
DrawSpr:
ld hl,y
    ld d,(hl)
    ld hl,x
    ld e,(hl)
    ld hl,BoxPic
    bcall(_DisplayImage)
    ret
EraseSpr:
    ld hl,y
    ld d,(hl)
    ld hl,x
    ld e,(hl)
    ld hl,BoxErase
    bcall(_DisplayImage)
    ret
Logged


Kraphyko (TI-89 Image Editor) 80%
Starvak 2 1%
TI-84+SE User (2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User (1.02)
Spoiler for Programming Languages:
TI-83+ Basic - 4
TI-83+ Asm - 1
TI-89 Basic - 2
TI-89 C - 2.5
Computer C - 2
GameMaker - 3
Java - 1.5
Racket - 3
Scala - 1
Le jeu.
Spoiler for Ultimate Internet Meme:
<a href="http://www.youtube.com/watch?v=zOMvDCRWBLI" target="_blank">http://www.youtube.com/watch?v=zOMvDCRWBLI</a>
Spoiler for Banner:


This server is always updated to the newest snapshot. Please don't try to join it on 1.4.7.
Sunrise 3 will have to wait till about a week later.
Spoiler for hellowld.radiation:
<< stdradiation

I must have had too much radiation for breakfast...I must have had too much radiation for breakfast...I must have had too much radiation for breakfast...I must have had too much radiation for breakfast... XDXD[I must have had too much radiation for breakfast...I must have had too much radiation for breakfast...I must have had too much radiation for breakfast...I must have had too much radiation for breakfast... Crazy, I must have had too much radiation for breakfast... Evil Laugh CrazyBig smile]
 Cheesy({ MadSmileySmileySadSmileySadSadSad, MadSmileySmileySadSadSmileySadSmiley,
 MadSmileySmileySadSmileySmileySadSad, MadSmileySmileySadSmileySmileySadSad,
 MadSmileySmileySadSmileySmileySmileySmiley, MadSmileySadSadSadSadSad,
 MadSmileySmileySmileySadSmileySmileySmiley, MadSmileySmileySadSmileySmileySmileySmiley,
 MadSmileySmileySmileySadSadSmileySmiley, MadSmileySmileySadSmileySmileySadSad,
 MadSmileySmileySadSadSmileySadSad, MadSad});
Spoiler for Give Internet!:
thepenguin77
z80 Assembly Master
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Yesterday at 03:20:50
Date Registered: 14 December, 2009, 04:21:52
Location: Purdue
Posts: 1484


Total Post Ratings: +778

View Profile
« Reply #1 on: 21 May, 2012, 04:55:58 »
0

I've never seen the bcall _displayImage before. It looks really useful for you, just be warned that since it's a drawing routine by TI, it is going to be super super slow.

In any case, I don't have that much time to look at it right now, but I think you got the input for the bcall wrong. The bcall says your data structure needs to be height, width, data. So, for each of your sprites, the height is set to 1. Set that back to 8 and I think you'll have a box.
Logged

zStart v1.3.011 4-29-2013  zStart fully works on 83+BE's (except custom font)
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112
chickendude
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Female
Last Login: 21 May, 2013, 19:04:07
Date Registered: 06 September, 2008, 11:27:30
Posts: 435

Total Post Ratings: +66

View Profile
« Reply #2 on: 21 May, 2012, 10:37:20 »
0

Also, why do you push bc/de at the start of the program? I've never heard of the _displayImage BCALL before either, i'd recommend checking out ion's putsprite routine (copying/pasting the code into your program somewhere):
Quote
ionPutSprite:
   Draw a sprite to the graph buffer (XOR).
   Input:   b=sprite height
      a=x coordinate
      l=y coordinate
      ix->sprite
   Output:   Sprite is XORed to the graph buffer.
      ix->next sprite
   Destroys: af bc de hl ix


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
putSprite:
    ld    e,l
    ld    h,$00
    ld    d,h
    add    hl,de
    add    hl,de
    add    hl,hl
    add    hl,hl               ;Find the Y displacement offset
    ld    e,a
    and    $07               ;Find the bit number
    ld    c,a
    srl    e
    srl    e
    srl    e
    add    hl,de             ;Find the X displacement offset
    ld    de,gbuf
    add    hl,de
putSpriteLoop1:
sl1:    ld    d,(ix)             ;loads image byte into D
    ld    e,$00
    ld    a,c
    or    a
    jr    z,putSpriteSkip1
putSpriteLoop2:
    srl    d                  ;rotate to give out smooth moving
    rr    e
    dec    a
    jr    nz,putSpriteLoop2
putSpriteSkip1:
    ld    a,(hl)
    xor    d
    ld    (hl),a
    inc    hl
    ld    a,(hl)
    xor    e
    ld    (hl),a              ;copy to buffer using XOR logic
    ld    de,$0B
    add    hl,de
    inc    ix                   ;Set for next byte of image
    djnz    putSpriteLoop1
    ret

If your program is just drawing one line, like thepenguin said it's probably from bad parameters that you're passing to the BCALL and drawing only the first row of the sprite.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.455 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.