This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - ZippyDee
Pages: 1 ... 23 24 [25] 26 27 ... 51
361
« on: May 14, 2011, 05:31:06 am »
Do you want the "© 2001 Natsume Inc. Developed by Neverland Co. Lufia™ Licensed from Taito Corp." stuff in there, too? Also, Welcome to the forums! I hope we can help you out! Also.....How many levels of grayscale (if any)?
362
« on: May 12, 2011, 04:06:14 pm »
I understand the use for a #def token, but I don't really understand why you'd need #undef... By being able to reassign a value to a CONSTANT, it's no longer CONSTANT. That makes it function just like any other variable, I'd think... Am I wrong?
363
« on: May 12, 2011, 02:21:06 pm »
Sorry, I had to
364
« on: May 11, 2011, 06:10:47 pm »
365
« on: May 11, 2011, 05:54:27 pm »
Well... that's a really big routine and I can't really keep track of the whole thing. But one thing I did notice is that you didn't put the color value in L before PROGRAM_START.
Yeah, I found that, too, and a few more issues as well. Here's my most recent version... #include ti83plus.inc #define ProgStart $9D95 #define BUFF1 plotSScreen ; Location of drawing buffer 1 #define BUFF2 0 ; Location of drawing buffer 2 (for grayscale implementation) .org ProgStart-2 .db $BB, $6D
InitTestData: ;; INIT DATA FOR TESTING ld hl, 20 push hl push hl ld hl, 1 PROGRAM_START: ;; L contains the fill color ;; stack: ;; [0]: y-coordinate ;; [1]: x-coordinate ; Get the fill color and save it to (color) ld a, l ld (color), a ; Calculate the byte address for the pixel ; and save it to (addr) pop hl ld a, 64 cp l pop de ret c push de ld d, 0 ld e, l add hl, hl add hl, de add hl, hl add hl, hl pop de ld a, 96 cp e ret c ld d, 0 srl e srl e srl e ld a, e ld (xbyte), a ;save the byte column to (xbyte) add hl, de ld (addr), hl ; Calculate the bitmask for the pixel ; and save it to (mask) and 7 ld b, a ld a, $80 jr z, ___skiploop ___loop: rrca djnz ___loop ___skiploop: ld (mask), a ; make sure the starting color is not the fill color ld de, BUFF1 add hl, de and (hl) cp 0 jr z, ___zero ld a, 1 ___zero: ld (icolor), a ld b, a ld a, (color) cp b ret z ; return if the starting point is the fill color call TurnByRule call Loop bcall(_getkey) ;just to pause it... ret Loop: call GetBoundsPainted ld a, b cp 1 jp nz, _1bound cp 2 jp nz, _2bounds cp 3 jp nz, _3bounds cp 4 jp nz, _4bounds _0bounds: call Paint jp EndLoop _4bounds: call Paint ret _3bounds: call GetAddr_Mask or (hl) ld (hl), a ;remove the mark, and reset rule and findpassage to defaults xor a ld (m_mask),a ld (bool), a ld a, $0F jp EndLoop _2bounds: ; jesus, this one will be tough... ld a, (m_mask) cp 0 jr nz, ___skip_place_mark ld a, (bool) and 1 cp 0 jr nz, ___skip_place_mark ld (findpassage), a ld a, (mask) ld (m_mask), a ld hl, (addr) ld (m_addr), hl ld a, (dir) ld (m_dir), a ___skip_place_mark: call MoveByRule ld a, (m_mask) cp 0 jr nz, ___null_mark ld b, a ld a, (mask) cp b jp nz, Loop ld hl, (m_addr) ld a, h ld b, l ld hl, (addr) cp h jp nz, Loop ld a, b cp l jp nz, Loop ld a, (dir) ld b, a ld a, (m_dir) cp b jr z, ___null_mark ld (dir), a ld a, (bool) xor 1 ld (bool), a xor a ld (findpassage), a ___null_mark: xor a ld (m_mask), a ld a, (bool) and 1 cp 0 call nz, Paint jp Loop _1bound: ld a, (bool) and 1 jr z, __1bound_else ld a, 1 ld (findpassage), a jr EndLoop __1bound_else: ; get opposite corners... ; if both are open ld a, (dir) ld b, 4 dec a push af ___find_bound: pop af inc a push af push bc call GetPixelInDir ld b, a ld a, (icolor) cp b pop bc jr nz, ___found djnz ___find_bound pop af xor a ret ___found: pop af inc a inc a call GetDirOffset push af push de ex de, hl dec a call GetDirOffset ld a, h or d ld d, a ld a, l or e ld e, a call GetPixel ld b, a ld a, (icolor) cp b pop hl pop af jr nz, EndLoop inc a call GetDirOffset ld a, h or d ld d, a ld a, l or e ld e, a call GetPixel ld b, a ld a, (icolor) cp b call z, Paint EndLoop: call MoveByRule jp Loop Paint: ;; Paints the current pixel the fill color ld a, (color) cp 0 ;jr z, __paint_off call GetAddr_Mask or (hl) ld (hl), a bcall(_GRBufCpy) ; just for testing purposes. ret __paint_off: call GetAddr_Mask xor $FF and (hl) ld (hl), a bcall(_GRBufCpy) ; again just for testing purposes. ret
MoveByRule: ;; Move to next location based on rule ;; OUT: ;; B is 0 if no tile was found to move to. Otherwise, non-zero. call GetCurPixel ld b, a ld a, (icolor) cp b jr nz, ___move_dir ; if the current pixel is filled, just move foward ld a, (dir) call GetPixelInDir ld b, a ld a, (icolor) cp b jr nz, ___no_move ; if the pixel at dir is filled, don't move ; check the corner between the pixel at dir and the pixel to the side specified by rule ; if the pixel is on, just move forward ; otherwise move to that pixel ld a, (bool) and 1 ld c, a ld a, (dir) call GetDirOffset push de inc a sub c sub c call GetDirOffset pop hl push af ld a, h or d ld d, a ld a, l or e ld e, a push de call GetPixel ld b, a ld a, (icolor) cp b pop de pop af jr nz, ___move_dir push af call GetPixelAddr ld (mask), a ld a, d ld (xbyte), a ld (addr), hl pop af ld (dir), a call TurnByRule ld b, 1 ret ___move_dir: ld a, (dir) call GetDirOffset call GetPixelAddr ld (mask), a ld a, d ld (xbyte), a ld (addr), hl ld a, (bool) and 1 ld b, a ld a, (dir) inc a sub b sub b call remap_dir ld (dir), a call TurnByRule ld b, 1 ret ___no_move: ld b, 0 ret
TurnByRule: ;; OUT: ;; B is 0 if no tile was found to turn to. Otherwise non-zero. ld b, 4 ___turn_loop: push bc ld a, (dir) call GetPixelInDir ;if pixel is on, dec ld b, a ld a, (icolor) cp b jr z, __chk_side_turn ld a, (bool) and 1 ld b, a ld a, (dir) dec a add a, b add a, b call remap_dir ld (dir), a pop bc djnz ___turn_loop ret __chk_side_turn: ;jump from push bc ld a, (bool) and 1 ld b, a ld a, (dir) inc a sub b sub b call remap_dir push af call GetPixelInDir ld b, a ld a, (icolor) cp b pop af pop bc ret nz ld (dir), a djnz ___turn_loop ret remap_dir: ;; Maps the value in A to the range of 0 <= A < 4 cp 4 ret nc cp 128 jr c, ___add sub 4 jr remap_dir ___add: add a, 4 jr remap_dir GetDirOffset: ;; IN: ;; A contains the direction call remap_dir ld b, a xor a cp b jr z, __dir_right inc a cp b jr z, __dir_down inc a cp b jr z, __dir_left __dir_up: ld a, b ld de, $0100 ret __dir_right: ld a, b ld de, $0001 ret __dir_down: ld a, b ld de, $FF00 ret __dir_left: ld a, b ld de, $00FF ret GetPixelInDir: ;; IN: ;; A contains the direction call GetDirOffset jp GetPixel
GetAddr_Mask: ;; OUT: ;; HL contains the addr of the pixel ;; A contains the mask of the pixel ld hl, (addr) ld de, BUFF1 add hl, de ld a, (mask) ret
GetBoundsPainted: ;; OUT: ;; B contains the number of painted boundaries ;; bits 0-3 of C contain which bounds are painted (0:right,1:left,2:top,3:bottom) ld bc, 0 push bc ld de, $0001 call GetPixel ld b, a ld a, (icolor) cp b jr nz, ___skip1 pop bc inc b ld a, 1 or c ld c, a push bc ___skip1: ld de, $00FF call GetPixel ld b, a ld a, (icolor) cp b jr nz, ___skip2 pop bc inc b ld a, 2 or c ld c, a push bc ___skip2: ld de, $0100 call GetPixel ld b, a ld a, (icolor) cp b jr nz, ___skip3 pop bc inc b ld a, 4 or c ld c, a push bc ___skip3: ld de, $FF00 call GetPixel ld b, a ld a, (icolor) cp b pop bc ret nz inc b ld a, 8 or c ld c, a ret GetCurPixel: ;; OUT: ;; A contains the color of the current pixel ld hl, (addr) ld de, BUFF1 add hl, de ld a, (mask) and (hl) cp 0 ret z ld a, 1 ret
GetPixelAddr: ;; IN: ;; D contains y offset ;; E contains x offset ;; OUT: ;; HL contains the addr of the pixel ;; A contains the mask for the pixel, or 0 if the pixel is off screen ;; D contains the xbyte for the pixel ld hl, (addr) __x_offset: ld a, (mask) ld b, e ld e, a ld a, b cp 0 jr z, __y_offset cp 1 ld a, (xbyte) jr z, __shiftRight rlc e jr nc, __chk_side dec a jr __chk_side __shiftRight: rrc e jr nc, __chk_side inc a __chk_side: cp 12 jr c, __edgeaddr __y_offset: push af ld a, d cp 0 jr z, __return_addr cp 1 jr z, __shiftUp ld bc, -24 add hl, bc jr __chk_top __shiftUp: ld bc, 12 add hl, bc __chk_top: push hl ld bc, -768 add hl, bc pop hl pop af jr c, __edgeaddr __return_addr: push af ld a, e pop de ret __edgeaddr: ld a, 0 ret GetPixel: ;; IN: ;; D contains y offset ;; E contains x offset ;; OUT: ;; A contains the color of the pixel (1 or 0) call GetPixelAddr cp 0 jr z, __edgepxl __getpxl: ld de, BUFF1 add hl, de and (hl) ret __edgepxl: ld a, (color) ; pixel is off-screen, so return (color) ret
addr: ; Initial address (no buffer address added) of the byte containing the current pixel (Y*12+X/8) .dw 0 mask: ; Bitmask for the current pixel .db 0 xbyte: ; The byte column containing the pixel (basically X/8) .db 0 dir: .db 0
m_addr: .dw 0 m_mask: .db 0 ;0 means no mark m_xbyte: .db 0 m_dir: .db 0 bool: ; bit 0=rule ;;;;;I dunno why but I had this and findpassage as the same thing before. I still haven't taken all the "and 1" lines out from when I was testing rule... .db 0 findpassage: .db 0 color: ; The fill color (currently 0 or 1. If I implement grayscale it will be 0-3) .db 1 icolor: .db 0 ; The color of the starting fill point .end At KermM's suggestion I indented pushes and pops. That helped me catch multiple issues. But it's still not working right. For some reason the Paint routine is never even called. I'm not sure why. Edit: Here's my pseudocode for the routine. It may help to understand it better: This algorithm: http://en.wikipedia.org/wiki/Flood_fill#Fixed_memory_method_.28right-hand_fill_method.29
RULE = right MARK = null MARKDIR = null FINDPASSAGE = false -----
if 4 bounds painted paint cur stop else if 3 bounds painted MARK = null FINDPASSAGE = false RULE = right paint cur move to open bound //####################### else if 2 bounds painted if MARK == null && RULE == right MARK = cur MARKDIR = dir FINDPASSAGE = false move based on RULE //after moving //set "dir" to the next direction //according to RULE (right hand rule or left hand rule) if cur == MARK if dir == MARKDIR MARK = null else RULE = left dir = MARKDIR MARK = null FINDPASSAGE = false if MARK == null && RULE == right paint cur //###################### else if 1 bound painted if RULE == left //then we''re in a loop, and this triggers the second stage FINDPASSAGE = true else if both opposite corners are open && MARK == null paint cur move base on RULE else if 0 bounds painted if RULE == left FINDPASSAGE = true paint cur move anywhere :P //_0_ how do you follow the right hand rule? Which is next? //_#_ //___ //first way //_#0 //If the current pixel is painted before moving, move here //_#_ //___ //second way //___ //but if the pixel is NOT painted before moving, move around to the //_#0 //next edge because going to the corner would make it now have //___ //no borders.
366
« on: May 11, 2011, 10:04:38 am »
Or maybe darken the right-facing slant wall so that the shadows pop a bit more?
367
« on: May 11, 2011, 09:02:33 am »
well, I think if you're going to have trees be that size, then they shouldn't be triangular. That suggests that they're redwood trees, which tend to grow to be gigantic...
368
« on: May 11, 2011, 08:48:11 am »
Alright, thanks. I'll try that then, too.
369
« on: May 11, 2011, 08:42:16 am »
I haven't been able to figure out what part is causing the issue yet...
370
« on: May 11, 2011, 08:14:39 am »
So, I've been working on this floodfill routine that uses zero stack, and I've finally finished it........or so I thought. It seems to not be working. It just freezes the calc. When I go to debug in wabbitemu it seems to be frozen at $0CAF, on the line jp $0B65
Here's my hopefully-not-too-hard-to-read code:
#include ti83plus.inc #define ProgStart $9D95 #define BUFF1 plotSScreen ; Location of drawing buffer 1 #define BUFF2 0 ; Location of drawing buffer 2 (for grayscale implementation) .org ProgStart-2 .db $BB, $6D
InitTestData: ;; INIT DATA FOR TESTING ld hl, 1 push hl ld hl, 20 push hl PROGRAM_START: ;; L contains the fill color ;; stack: ;; [0]: y-coordinate ;; [1]: x-coordinate ; Get the fill color and save it to (color) ld a, l ld (color), a ; Calculate the byte address for the pixel ; and save it to (addr) pop hl ld a, 64 cp l ret c ld d, 0 ld e, l add hl, hl add hl, de add hl, hl add hl, hl pop de ld a, 96 cp e ret c ld d, 0 srl e srl e srl e ld a, e ld (xbyte), a ;save the byte column to (xbyte) add hl, de ld (addr), hl ; Calculate the bitmask for the pixel ; and save it to (mask) and 7 ld b, a ld a, $80 jr z, ___skiploop ___loop: rrca djnz ___loop ___skiploop: ld (mask), a ; make sure the starting color is not the fill color ld de, BUFF1 add hl, de and (hl) cp 0 jr z, ___zero ld a, 1 ___zero: ld (icolor), a ld b, a ld a, (color) cp b ret z ; return if the starting point is the fill color call TurnByRule Loop: call GetBoundsPainted ld a, b cp 1 jp nz, _1bound cp 2 jp nz, _2bounds cp 3 jp nz, _3bounds cp 4 jp nz, _4bounds _0bounds: call Paint jp EndLoop _4bounds: call Paint ret _3bounds: call GetAddr_Mask or (hl) ld (hl), a ;remove the mark, and reset rule and findpassage to defaults xor a ld (m_mask),a ld (bool), a ld a, $0F jp EndLoop _2bounds: ; jesus, this one will be tough... ld a, (m_mask) cp 0 jr nz, ___skip_place_mark ld a, (bool) and 1 cp 0 jr nz, ___skip_place_mark ld (findpassage), a ld a, (mask) ld (m_mask), a ld hl, (addr) ld (m_addr), hl ld a, (dir) ld (m_dir), a ___skip_place_mark: call MoveByRule ld a, (m_mask) cp 0 jr nz, ___null_mark ld b, a ld a, (mask) cp b jp nz, Loop ld hl, (m_addr) ld a, h ld b, l ld hl, (addr) cp h jp nz, Loop ld a, b cp l jp nz, Loop ld a, (dir) ld b, a ld a, (m_dir) cp b jr z, ___null_mark ld (dir), a ld a, (bool) xor 1 ld (bool), a xor a ld (findpassage), a ___null_mark: xor a ld (m_mask), a ld a, (bool) and 1 cp 0 call nz, Paint jp Loop _1bound: ld a, (bool) and 1 jr z, __1bound_else ld a, 1 ld (findpassage), a jr EndLoop __1bound_else: ; get opposite corners... ; if both are open ld a, (dir) dec a push af ___find_bound: pop af inc a push af call GetPixelInDir ld b, a ld a, (icolor) cp b jr z, ___find_bound pop af inc a inc a call GetDirOffset push af push de ex de, hl dec a call GetDirOffset ld a, h or d ld d, a ld a, l or e ld e, a call GetPixel ld b, a ld a, (icolor) cp b pop hl pop af jr nz, EndLoop inc a call GetDirOffset ld a, h or d ld d, a ld a, l or e ld e, a call GetPixel ld b, a ld a, (icolor) cp b call z, Paint EndLoop: call MoveByRule jp Loop Paint: ;; Paints the current pixel the fill color ld a, (color) cp 0 jr z, __paint_off call GetAddr_Mask or (hl) ld (hl), a bcall(_GRBufCpy) ; just for testing purposes. ret __paint_off: call GetAddr_Mask xor $FF and (hl) ld (hl), a bcall(_GRBufCpy) ; again just for testing purposes. ret
MoveByRule: ;; Move to next location based on rule ;; OUT: ;; B is 0 if no tile was found to move to. Otherwise, non-zero. call GetCurPixel ld b, a ld a, (icolor) cp b jr nz, ___move_dir ; if the current pixel is filled, just move foward ld a, (dir) call GetPixelInDir ld b, a ld a, (icolor) cp b jr nz, ___no_move ; if the pixel at dir is filled, don't move ; check the corner between the pixel at dir and the pixel to the side specified by rule ; if the pixel is on, just move forward ; otherwise move to that pixel ld a, (bool) and 1 ld c, a ld a, (dir) call GetDirOffset push de inc a sub c sub c call GetDirOffset pop hl push af ld a, h or d ld d, a ld a, l or e ld e, a push de call GetPixel ld b, a ld a, (icolor) cp b pop de pop af jr nz, ___move_dir push af call GetPixelAddr ld (mask), a ld a, d ld (xbyte), a ld (addr), hl pop af ld (dir), a call TurnByRule ld b, 1 ret ___move_dir: ld a, (dir) call GetDirOffset call GetPixelAddr ld (mask), a ld a, d ld (xbyte), a ld (addr), hl ld a, (bool) and 1 ld b, a ld a, (dir) inc a sub b sub b call remap_dir ld (dir), a call TurnByRule ld b, 1 ret ___no_move: ld b, 0 ret
TurnByRule: ;; OUT: ;; B is 0 if no tile was found to turn to. Otherwise non-zero. ld b, 4 ___turn_loop: push bc ld a, (dir) call GetPixelInDir ;if pixel is on, dec ld b, a ld a, (icolor) cp b jr z, __chk_side_turn ld a, (bool) and 1 ld b, a ld a, (dir) dec a add a, b add a, b call remap_dir ld (dir), a pop bc djnz ___turn_loop ret __chk_side_turn: ld a, (bool) and 1 ld b, a ld a, (dir) inc a sub b sub b call remap_dir push af call GetPixelInDir ld b, a ld a, (icolor) cp b pop af pop bc ret nz ld (dir), a djnz ___turn_loop ret remap_dir: ;; Maps the value in A to the range of 0 <= A < 4 cp 4 ret nc cp 128 jr c, ___add sub 4 jr remap_dir ___add: add a, 4 jr remap_dir GetDirOffset: ;; IN: ;; A contains the direction call remap_dir ld b, a xor a cp b jr z, __dir_right inc a cp b jr z, __dir_down inc a cp b jr z, __dir_left __dir_up: ld a, b ld de, $0100 ret __dir_right: ld a, b ld de, $0001 ret __dir_down: ld a, b ld de, $FF00 ret __dir_left: ld a, b ld de, $00FF ret GetPixelInDir: ;; IN: ;; A contains the direction call GetDirOffset jp GetPixel
GetAddr_Mask: ;; OUT: ;; HL contains the addr of the pixel ;; A contains the mask of the pixel ld hl, (addr) ld de, BUFF1 add hl, de ld a, (mask) ret
GetBoundsPainted: ;; OUT: ;; B contains the number of painted boundaries ;; bits 0-3 of C contain which bounds are painted (0:right,1:left,2:top,3:bottom) ld bc, 0 push bc ld de, $0001 call GetPixel ld b, a ld a, (icolor) cp b jr nz, $+9 pop bc inc b ld a, 1 or c ld c, a push bc ld de, $00FF call GetPixel ld b, a ld a, (icolor) cp b jr nz, $+9 pop bc inc b ld a, 2 or c ld c, a push bc ld de, $0100 call GetPixel ld b, a ld a, (icolor) cp b jr nz, $+9 pop bc inc b ld a, 4 or c ld c, a push bc ld de, $FF00 call GetPixel ld b, a ld a, (icolor) cp b pop bc ret nz inc b ld a, 8 or c ld c, a ret GetCurPixel: ;; OUT: ;; A contains the color of the current pixel ld hl, (addr) ld de, BUFF1 add hl, de ld a, (mask) and (hl) cp 0 ret z ld a, 1 ret
GetPixelAddr: ;; IN: ;; D contains y offset ;; E contains x offset ;; OUT: ;; HL contains the addr of the pixel ;; A contains the mask for the pixel, or 0 if the pixel is off screen ;; D contains the xbyte for the pixel ld hl, (addr) __x_offset: ld a, (mask) ld b, e ld e, a ld a, b cp 0 jr z, __y_offset cp 1 ld a, (xbyte) jr z, __shiftRight rlc e jr nc, __chk_side dec a jr __chk_side __shiftRight: rrc e jr nc, __chk_side inc a __chk_side: cp 12 jr c, __edgeaddr __y_offset: push af ld a, d cp 0 jr z, __return_addr cp 1 jr z, __shiftUp ld bc, -24 add hl, bc jr __chk_top __shiftUp: ld bc, 12 add hl, bc __chk_top: push hl ld bc, -768 add hl, bc jr c, __edgeaddr __return_addr: pop hl ld a, e pop de ret __edgeaddr: ld a, 0 ret GetPixel: ;; IN: ;; D contains y offset ;; E contains x offset ;; OUT: ;; A contains the color of the pixel (1 or 0) call GetPixelAddr cp 0 jr z, __edgepxl __getpxl: ld de, BUFF1 add hl, de and (hl) ret __edgepxl: ld a, (color) ; pixel is off-screen, so return (color) ret
addr: ; Initial address (no buffer address added) of the byte containing the current pixel (Y*12+X/8) .dw 0 mask: ; Bitmask for the current pixel .db 0 xbyte: ; The byte column containing the pixel (basically X/8) .db 0 dir: .db 0
m_addr: .dw 0 m_mask: .db 0 ;0 means no mark m_xbyte: .db 0 m_dir: .db 0 bool: ; bit 0=rule ;;;;;I dunno why but I had this and findpassage as the same thing before. I still haven't taken all the "and 1" lines out from when I was testing rule... .db 0 findpassage: .db 0 color: ; The fill color (currently 0 or 1. If I implement grayscale it will be 0-3) .db 1 icolor: .db 0 ; The color of the starting fill point .end I wouldn't be surprised if it's something reeeeeally stupid. I'm new to ASM, so I'm sure I made multiple mistakes.
371
« on: May 11, 2011, 08:07:52 am »
That looks a lot better! Wow, adding the dithered castle tiles make it pop out just that much more. And the water is much more recognizable. Great job!
372
« on: May 11, 2011, 06:57:15 am »
Looks good. I agree with Ashbad though about the proportionality.
373
« on: May 10, 2011, 06:26:07 pm »
Yeah, it's played without touching it. Probably one of the most psychologically empowering instruments you can play. You feel like a magician.
374
« on: May 10, 2011, 05:03:19 pm »
YEAH! Definitely one of my favorite, if not my favorite game ever.
375
« on: May 10, 2011, 05:02:40 pm »
That's a Theremin with lots of reverb. But that's actually not me singing. That's still my friend. I was going to sing for it, but he need to sing more. (He thinks he's a terrible singer, so I make him sing)
Pages: 1 ... 23 24 [25] 26 27 ... 51
|