Jump to content
IGNORED

Really simple development question


ToyguyVT

Recommended Posts

I'm just starting to play around with this new Vectrex and was fiddling around with VIDE and one of the programming tutorials. It has you just draw a simple line, which worked fine. The suggestion was to play around with that and try different things so I attempted to draw two lines :-)

 

This was the first try (leaving out the equates and initialization block, etc:

draw_line:
        jsr   waitrecal                 ;Reset the CRT
        lda   #00                       ;Get y
        ldb   #00                       ;Get x
        jsr   move_pen7f_to_d           ;go to (x,y)
        lda   #$7f                      ;Get the Intensity
        jsr   intensity_to_A            ;Set intensity
        lda   #00                       ;Get y
        ldb   #127                      ;Get x
        jsr   draw_to_d                 ;draw a line to (x,y)
        lda   #00                       ;Get y
        ldb   #00                       ;Get x
        jsr   move_pen7f_to_d           ;go to (x,y)
        lda   #30                       ;Get y
        ldb   #00                       ;Get x
        jsr   move_pen7f_to_d           ;go to (x,y)
        lda   #30                       ;Get y
        ldb   #127                      ;Get x
        jsr   draw_to_d                 ;draw a line to (x,y)
        bra   draw_line

This results in this:

 

Try1.png

 

So OK, I guess drawing inherently resets 0 to the previous endpoint. So I try this next:

draw_line:
        jsr   waitrecal                 ;Reset the CRT
        lda   #00                       ;Get y
        ldb   #00                       ;Get x
        jsr   move_pen7f_to_d           ;go to (x,y)
        lda   #$7f                      ;Get the Intensity
        jsr   intensity_to_A            ;Set intensity
        lda   #00                       ;Get y
        ldb   #127                      ;Get x
        jsr   draw_to_d                 ;draw a line to (x,y)
        jsr   waitrecal
        lda   #30                       ;Get y
        ldb   #00                       ;Get x
        jsr   move_pen7f_to_d           ;go to (x,y)
        lda   #30                       ;Get y
        ldb   #127                      ;Get x
        jsr   draw_to_d                 ;draw a line to (x,y)
        bra   draw_line

I've inserted another cal to waitrecal before doing the second line. I now get this:

 

Try2.png

 

OK, that has the starting point reset but why the heck is that line diagonal? I'm stumped...

 

Thanks in advance!

 

Link to comment
Share on other sites

Hi,

some short notes:

a) You should do the WaitRecal only once (at the beginning usually) in your update round, since it waits till the rest of your 30000 cycles have passed and than goes on.

b) to reset the beam position (other than WaitRecal) you can use a different BIOS Function "Reset0Ref"

c) untill you know better, after such a Reset you should do a move (what you already do - good!)

d) all positioning is done from the last "location" the vector beam resides this is called relative positioning.

e) within that relative positioning you do NOT tell the routines which coordinates you want to go to but rather tell in which direction (and distance) the next "point" (or endpoint of a line) lies

f) so, going from 0,0: 30 "pixel" up and 127 "pixel" right draws a "diagonal" from point 0,0 to 30,127 (but still notice, this is relative movement - it just looks absolut since you started off at 0,0)
if you do exactly the same move "30,127" directly after the first, you will have the "same" diagonal again, which in effect doubles the line and from the view of point 0,0 is a "60, 254" line

 

Malban

Link to comment
Share on other sites

Thanks gentlemen! Knowing that everything is relative now makes sense. I was able to get the effect I wanted with this:

draw_line:
        jsr   waitrecal                 ;Reset the CRT
        lda   #00                       ;Get y
        ldb   #00                       ;Get x
        jsr   move_pen7f_to_d           ;go to (x,y)
        lda   #$7f                      ;Get the Intensity
        jsr   intensity_to_A            ;Set intensity
        lda   #00                       ;Get y
        ldb   #127                      ;Get x
        jsr   draw_to_d                 ;draw a line to (x,y)
        lda   #30                       ;Get y
        ldb   #-127                       ;Get x
        jsr   move_pen7f_to_d           ;go to (x,y)
        lda   #0                       ;Get y
        ldb   #127                      ;Get x
        jsr   draw_to_d                 ;draw a line to (x,y)
        bra   draw_lin

I dropped the extra call to waitrecal and moved the X location back 127 units. Maybe not the most efficient thing, but the end result works :-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...