Unfortunately no, chaining conditionals is not possible in z80 assembly. You could try some tricks with moving the f flag into another register and masking it, for example:


Code:
push af
    pop bc
ld a,%mask_for_z_and_c
xor c
jr z,was_nc_and_z
That's pretty awkward compared with just doing:


Code:
    jr nc,label
    jr z,label
Fall_through:

Code:
findloop:
   call cphlde
   call z,addhl
   call nz,addde
   call cphlde

addhl:
   inc hl
addde:
   inc de
   ret


I need to do a series of these jumps/calls based on the results of cphlde, but everytime i do something to a register, aren't the flags changed? Any ideas?

I need to move through the appvar, pointed to by de, until I find a match of de and hl. Then, I need to check the next four bytes of the appvar against the four bytes after hl. If a full match is found, I need to leave that subroutine with de. If one of them fails to match, I need to reset hl to its original value and start checking from the next de.

This is to find a particular user's calc ID for CALCnet in the appvar.
You could restructure it to something like this:


Code:
findloop:
   call cphlde
   push af
      call z,addhl
      pop af
   call nz,addde
   call cphlde
   ;possibly want a ret here?

addhl:
   inc hl
addde:
   inc de
   ret
Oh, yeah. I didn't think of pushing af. Final question of the day...
is there a quick way to make the screen flicker, then return to the state it was in beforehand (can just do RenderGUI to bring back screen)
ACagliano wrote:
Oh, yeah. I didn't think of pushing af. Final question of the day...
is there a quick way to make the screen flicker, then return to the state it was in beforehand (can just do RenderGUI to bring back screen)
I think you might have just answered your own question there, unless I'm misunderstand you. Wink
Well, I know how to bring the screen back, but how do I make it flicker?
ACagliano wrote:
Well, I know how to bring the screen back, but how do I make it flicker?
You want it to flicker as in blank? If so, you can just clear the screen, iFastCopy, then do a RenderGUI:


Code:
ld hl,gbuf
ld de,gbuf+1
ld (hl),0
ld bc,767
ldir
call iFastCopy
call RenderGUI
Well, I actually wanted to flicker twice (full white, full black, full white, full black, back to old). Using your code, I was able to deduce how that would be done. Thanks. Now, just have to get the searching of info done, then graphics, then were ready for a beta Smile
ACagliano wrote:
Well, I actually wanted to flicker twice (full white, full black, full white, full black, back to old). Using your code, I was able to deduce how that would be done. Thanks. Now, just have to get the searching of info done, then graphics, then were ready for a beta Smile
Presumably you just changed the 0 to an $FF? Actually, if you did it carefully and used cpl to invert the 0 to $FF and back repeatedly, you could do it with a single loop around that code. Searching of info and graphics and beta sounds great to me! Did you find out what you needed to know about SafeRAM areas?
Well, I know that you encourage the declaring of any RAM needed as programs/appvars when using the GUI API. However, the game uses the first 60 bytes of saferam2 (as defined by dcs7.inc), as well as the GUI API and CALCnet, and the main buffer. What area of saferam is left, and sufficient to hold 25 bytes of player data, per player (max of 10 players, total 250 bytes). Can I perhaps go to 20 players and find a saferam to fit that?
Quote:
Well, I know that you encourage the declaring of any RAM needed as programs/appvars when using the GUI API.
That's not accurate. I encourage the use of SafeRAM as much as possible, even when using the GUI API with CALCnet, and only switching to appvars when you're absolutely out of space. Here's what I use in Oblit:


Code:
MySafeRAM1      .equ   textShadow               ;128 bytes
MySafeRAM2      .equ   AppBackupScreen+129         ;[cf. GUI Memory Areas]   ;166 bytes total
MySafeRAM3      .equ   saferam2      ; saferam2 = 531 bytes (statRAM)
I need a quick way to render lines and circles. The DCS7_GUI will not suffice for this. Are there other calls/bcalls?
Use the MirageOS routine fastline.
http://dcs.cemetech.net/index.php?title=Fastline
souvik1997 wrote:
Use the MirageOS routine fastline.
http://dcs.cemetech.net/index.php?title=Fastline
Which is of course part of Doors CS. Smile And if you need a Bresenham Circle routine, I can give you the one from Obliterate.
Kerm, is it fast? Yes, I do need one...if you wouldn't mind.

Edit: I also need some suggestions/coding help with a n x m. Sprite editor. Using the DCS7 GUI API, you set the spinners to the dimensions of the sprite, and then get presented with a simple sprite editor, like the one in the new Axe Paint program. Any ideas??
ACagliano wrote:
Kerm, is it fast? Yes, I do need one...if you wouldn't mind.

Edit: I also need some suggestions/coding help with a n x m. Sprite editor. Using the DCS7 GUI API, you set the spinners to the dimensions of the sprite, and then get presented with a simple sprite editor, like the one in the new Axe Paint program. Any ideas??
Yes, my suggestion is that you do that. Very Happy And yes, the routine for circles is fast; please bug me on SAX or IRC to share it when I'm on my laptop, or just bump this topic.
Bump on the circles routine...
ACagliano wrote:
Bump on the circles routine...
Here's what I used, by Sigma:


Code:
.MODULE FASTCIRCLE
FastCircle:
;FastCircle
;
;Author:  Sean McLaughlin (sigma_zk@yahoo.com)
;Date:    01/18/04 (mm/dd/yy)
;Calc:    TI-83 Plus
;Notes:   Uses SMC
;
;D = center_x
;E = center_y
;C = radius
         ; REGS         STACK
   LD   A,C   ;
   OR   A   ;
   RET   Z   ;
   RET   M   ;
   LD   (_x),DE   ;
   LD   B,0   ; B = y
   LD   H,B   ;
   LD   L,C   ;
   ADD   HL,HL   ;
   LD   DE,3   ;
   EX   DE,HL   ;
   SBC   HL,DE   ;
   DI      ;
_loop:         ;
_x .equ $+1      ;
   LD   DE,0   ; DE = (xc,yc)
   LD   A,C   ; A = x
   CP   B   ; nc if (x <= y)
   RET   C   ;
;PSet(xc + x, yc + y)   ;
   LD   A,E   ; A = yc
   ADD   A,B   ; A = yc + y
   LD   E,A   ; E = yc + y
   EX   AF,AF'   ;
   LD   A,D   ; A = xc
   ADD   A,C   ; A = xc + x
   LD   D,A   ; DE = (xc+x,yc+y)
   CALL   PSet   ;
;PSet(xc + x, yc - y)   ;
   LD   A,E   ; A = yc + y
   SUB   B   ; A = yc
   SUB   B   ; A = yc - y
   LD   E,A   ; DE = (xc+x,yc-y)
   CALL   PSet   ;
;PSet(xc - x, yc - y)   ;
   LD   A,D   ; A = xc + x
   SUB   C   ; A = xc
   SUB   C   ; A = xc - x
   LD   D,A   ; DE = (xc-x,yc-y)
   CALL   PSet   ;
;PSet(xc - x, yc + y)   ;
   EX   AF,AF'   ;
   LD   E,A   ; DE = (xc-x,yc+y)
   CALL   PSet   ;
;PSet(xc + y, yc + x)   ;
   LD   A,E   ; A = yc + y
   SUB   B   ; A = yc
   ADD   A,C   ; A = yc + x
   LD   E,A   ; E = yc + x
   LD   A,D   ; A = xc - x
   ADD   A,C   ; A = xc
   ADD   A,B   ; A = xc + y
   LD   D,A   ; DE = (xc+y,yc+x)
   PUSH   AF   ;         [XC+Y]
   CALL   PSet   ;
;PSet(xc - y, yc + x)   ;
   LD   A,D   ; A = xc + y
   SUB   B   ; A = xc
   SUB   B   ; A = xc - y
   LD   D,A   ; DE = (xc-y,yc+x)
   CALL   PSet   ;
;PSet(xc - y, yc - x)   ;
   LD   A,E   ; A = yc + x
   SUB   C   ; A = yc
   SUB   C   ; A = yc - x
   LD   E,A   ; DE = (xc-y,yc-x)
   CALL   PSet   ;
;PSet(xc + y, yc - x)   ;
   POP   AF   ; A = xc + y      -
   LD   D,A   ; DE = (xc+y,yc-x)
   CALL   PSet   ;

;if(d < 0) err += y << 2 + 6
   BIT   7,H   ;
   JR   Z,_PosError
   EX   DE,HL   ;
   LD   H,0   ;
   LD   L,B   ;
   ADD   HL,HL   ;
   ADD   HL,HL
   ADD   HL,DE
   LD   DE,6
   ADD   HL,DE
   INC   B
   JP   _loop

_PosError:
;err += (y - x) << 2 + 10: y--
   LD   DE,10
   ADD   HL,DE
   DEC   D
   LD   A,B
   SUB   C
   ADD   A,A
   RL   D
   ADD   A,A
   RL   D
   LD   E,A
   ADD   HL,DE
   INC   B
   DEC   C
   JP   _loop

.MODULE PSET
_LCD_MEM .EQU $9340
_PixTable:   .DB   128,64,32,16,8,4,2,1
PSet:
; DE = (x,y)
   LD   A,E
   OR   A
   RET   M
   CP   64
   RET   NC
   LD   A,D
   OR   A
   RET   M
   CP   96
   RET   NC
   PUSH   DE
   PUSH   HL
   SLA   E
   SLA   E
   LD   D,0
   LD   H,D
   LD   L,E
   ADD   HL,HL
   ADD   HL,DE
   LD   E,A
   SRA   E
   SRA   E
   SRA   E
   ADD   HL,DE
   LD   DE,_LCD_MEM
   ADD   HL,DE
   AND   7
   EX   DE,HL
   LD   HL,_PixTable
   ADD   A,L
   LD   L,A
   ADC   A,H
   SUB   L
   LD   H,A
   LD   A,(DE)
   OR   (HL)
   LD   (DE),A
   POP   HL
   POP   DE
   RET
Ok, the last things I need help with:

1. Conceptual help with rendering of an n x m sprite.
2. How many halt/nop's would be needed to achieve a one-second wait?
ACagliano wrote:
Ok, the last things I need help with:

1. Conceptual help with rendering of an n x m sprite.
2. How many halt/nop's would be needed to achieve a one-second wait?


1. Use iLargeSprite. Width must be in multiples of 8 pixels, and height can be any value.
2. A nop is 4 cycles. On a 6MHz calculator, 1.5 million nops is one second. On a 15MHz calculator, 3.75 million nops is one second. Halts are not good for timed pauses, as they have variable length delay.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement