ToyguyVT Posted January 20, 2017 Share Posted January 20, 2017 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: 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: OK, that has the starting point reset but why the heck is that line diagonal? I'm stumped... Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Mayhem Posted January 20, 2017 Share Posted January 20, 2017 I must admit, I've played lots of Vectrex games, but I've never programmed one! Could it be that x and y are offsets when drawing? So for the second draw command, what happens if you set y to 0 for it after the move? Quote Link to comment Share on other sites More sharing options...
Malban Posted January 20, 2017 Share Posted January 20, 2017 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 Quote Link to comment Share on other sites More sharing options...
ToyguyVT Posted January 20, 2017 Author Share Posted January 20, 2017 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 :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.