|
Post by jday6809 on Dec 4, 2021 23:10:33 GMT -5
Hey all, quick newb question... imagine the following code:
LDA #20 STA my_variable ; okay, so let's just load a value of #20 into "my_variable"
... later in the code ...
LDX #drawing_line_list ; now we're ready to draw a line list of whatever this thing is, but I'd like "my_variable" JSR Draw_VLc ; to have an effect on the line list... somehow
... much later in code ...
drawing_line_list:
DB 1 ; first we tell it how many x,y coordinates of data will follow (num of coordinates - 1) DB 75, 75 ; so far so good DB -75, my_variable ; obviously this won't work...
SO, obviously I can't just slap a variable into a line_list like this, but is there a way? Is there any other good drawing methods that can incorporate a variable into a list of coordinates?
Thanks in advance for your time, consideration and thoughts!
JDay6809
|
|
|
Post by D-Type on Dec 5, 2021 2:01:01 GMT -5
Copy the vector list into RAM lets you do it. Or split it into two vector lists, one in ROM, the other in RAM. Or write a custom Draw_VLc subroutine based on the available ROM disassembly.
|
|
|
Post by jday6809 on Dec 5, 2021 10:43:32 GMT -5
Copy the vector list into RAM lets you do it. Or split it into two vector lists, one in ROM, the other in RAM. Or write a custom Draw_VLc subroutine based on the available ROM disassembly. Awesome ideas! Never hit me that since I hadn't assigned it to any RAM memory address, my line list was still just hanging out in ROM. Thanks for clearing that up. I'll try your first option tonight and then edit this reply to let you know how it works out! Thanks again... I definitely plan to create my own draw_vlc later on as well, but trying to work with the built in version first. *UPDATE* Worked like a charm! What follows is a rough idea of how I changed my previous example to load the line_list into ram at the beginning and to allow a variable to influence that list. Not the smoothest way, but it worked for tonight and might help some future programmer. drawing_line_list_begin EQU $CA00 drawing_line_list_end EQU $CA04 LDA #01 STA $CA00 ; DRAW_VLc wants to know how many x,y coordinates are in this list (num of y/x coordinates -1) LDA #75 STA $CA01 ; put 75 into first y coordinate STA $CA02 ; put 75 into first x coordinate NEGA STA $CA03 ; put a -75 into the second y coordinate ;later in the main game loop.... LDA my_variable STA $CA04 ; put my_variable into the second x coordinate ;finally...time to draw our RAM list LDX #drawing_line_list_begin ; go find the beginning of that line list in RAM JSR Draw_VLc ; BIG THANKS TO D-TYPE for pointing me in the right direction!
|
|
|
Post by gauze on Dec 6, 2021 11:22:11 GMT -5
Based on how you have presented this issue, I assume the list is mostly static so you could set up a variable area in ram and then copy from rom like so:
my_shape_ram ds 4 ; number of bytes
my_shape_rom 75,75,-75,0 ; whatever your data is
ldx #my_shape_rom ldy #my_shape_ram ldb #3 ; number of coords minus 1 loop: lda ,x+ sta ,y+ decb bne loop
;then just set the coords in the set you want to change later.
sta my_shape_ram+3 ; or whatever
|
|
|
Post by D-Type on Dec 6, 2021 12:58:40 GMT -5
Or you could use the built-in BIOS function:
Move_Mem_a_1: LDB A,U ;Copy the byte STB A,X Move_Mem_a: DECA ;Decrement the count BPL Move_Mem_a_1 ;Go back until finished LF686: RTS
|
|
|
Post by jday6809 on Dec 8, 2021 9:11:40 GMT -5
Based on how you have presented this issue, I assume the list is mostly static so you could set up a variable area in ram and then copy from rom like so: my_shape_ram ds 4 ; number of bytes my_shape_rom 75,75,-75,0 ; whatever your data is ldx #my_shape_rom ldy #my_shape_ram ldb #3 ; number of coords minus 1 loop: lda ,x+ sta ,y+ decb bne loop ;then just set the coords in the set you want to change later. sta my_shape_ram+3 ; or whatever You are correct! The list was mostly static, so this solution of using partial ram area saves me a lot of typing! Thanks, Gauze!
|
|
|
Post by D-Type on Dec 8, 2021 10:10:36 GMT -5
Hey, you're the skiing game guy, no?
|
|
|
Post by jday6809 on Dec 8, 2021 13:37:19 GMT -5
Hey, you're the skiing game guy, no? You got me! Yep, I'm using the guidance that both you and Gauze provided to help me 'fake' hidden lines on my mountain...however now I'm completely re-working how everything works to incorporate additional insights from the Vectrex Fans Unite FB group. What a great community! I'm a software developer by profession C# and Javascript-y languages, so lower level language like assembly ... and especially Assembly for Vectrex has been a bit of a learning curve. You'll probably see me again on here soon, but I'm trying to self-learn through available documentation when I get the time.
|
|