Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
MaxVT103


Member


Joined: 24 Aug 2003
Posts: 109

Posted: 02 Sep 2003 08:33:16 pm    Post subject:

Ok, I've decided to simplify the detection routine so if anyone could help me fix the code, I'd be greately apreciative.


Code:
;----------Hot spot detection-----------
;inputs b,c (first x and y cor)
;inputs d,e(Width of box "d";Height of box "e")
;inputs h,l("h" x cor to check, "l" y cor to check
;output  "a"(either on or off)
detect:
 ld a,b
 add a,d
 ld d,a
 ld a,c
 add a,e
 ld e,a
detect_x1:
 ld a,b
 cp h
 jp z,detect_x2
 cp h
 jp p,detect_x2
 ld a,d
 cp h
 jp z,detect_x2
 cp h
 jp m,detect_x2
 jp no_detect
detect_x2:
 ld a,c
 cp l
 jp z,detect_y
 cp l
 jp p,detect_y
 ld a,e
 cp l
 jp z,detect_y
 cp l
 jp m,detect_y
 jp no_detect
detect_y:
 ld a,1
 ret
no_detect:
 ld a,0
 ret


I hope someone can help, mainly bc the jp p,xxx and jp m,xxx confuse me while coding.

Donald
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 02 Sep 2003 09:30:02 pm    Post subject:

look in 83pa28d at the day in which it talks about jumps.

it talks about how to do conditions, and how to do AND and OR as conditions...
Back to top
MaxVT103


Member


Joined: 24 Aug 2003
Posts: 109

Posted: 03 Sep 2003 10:31:01 pm    Post subject:

Ok, I got bored after I got home from football practice and felt like working on hitz. So I started working on the routine again and finaly got it to work. So I guess I was smart enough to write it, yippie. So for all of you who read this and just want an easy way out of writing the code youself. I'm gonna paste it here for you so you can use it in your programs too. Please just give me credit for it bc it took 2 hours to get working.


Code:
;----------Hot spot detection-----------
;-----------By Donald Ritter------------
;inputs b,c (first x and y cor)
;inputs d,e(Width of box "d";Height of box "e")
;inputs h,l("h" x cor to check, "l" y cor to check
;output "a"(either on or off)

hdetect:
   ld a,b
   add a,d
   ld d,a
   ld a,c
   add a,e
   ld e,a
hdetect_x1:
   ld a,b
   cp h
   jp z,hdetect_x2
   cp h
   jp m,hdetect_x2
   jp hno_detect
hdetect_x2:
   ld a,d
   cp h
   jp z,hdetect_y1
   cp h
   jp p,hdetect_y1
   jp hno_detect
hdetect_y1:
   ld a,c
   cp l
   jp z,hdetect_y2
   cp l
   jp m,hdetect_y2
   jp hno_detect
hdetect_y2:
   ld a,e
   cp l
   jp z,hdetected
   cp l
   jp p,hdetected
   jp hno_detect
hdetected
   ld a,1
   ret
hno_detect:
   ld a,0
   ret


I do realize that many people have probobly written a routine similar to this. But heres my shot at it so hope you enjoy.

Donald
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 

Advertisement