Monday, March 30, 2020

VIC20-ASM-009 PingPong Left to Right a Vertically Scrolling Character on Screen Until it Reaches Bottom Row


slot the VICMON  cartridge into your VIC20
start VICMON by entering: SYS 24576


we want to accomplish the following:
  1. start program at 1403 and load #$00 into the accumulator. This will be our flag to determine if we are moving right (#$00) or left (#$01). We begin moving to the right (#$00).
  2. store the value in the accumulator into the memory location $1400. We will use this memory location to store the direction flag to move right or left (#$00 or #$01 respectively).
  3. load the 0th row coordinate (#$00) into the X register
  4. load the column coordinate of the left-most screen border (#$00) into the Y register
  5. load the clear screen character ($93) into the accumulator
  6. run subroutine  ($FFD2) to output the clear screen character ($93) from the accumulator
  7. load $#00 into the accumulator to ensure all bits are turned off (this will make 6 set position instead of get)
  8. call the set cursor location (Plot) subroutine at address $FFF0
  9. load the value for letter W (#$57) into the accumulator
  10. run subroutine ($FFD2) to output the W character (#$57) from the accumulator to screen
  11. load the value from location $1400 into the accumulator
  12. compare the value in the accumulator with #$01 (to check if we should go to the left)
  13. if the comparison was true, then jump to the instructions to move the cursor to the left (point 21)
  14. otherwise, compare the value in the Y register with the right-most column coordinate (#$15)
  15. if the comparison was true, then jump to set the program to move to the left and scroll down (point 18)
  16. otherwise, increment the value in the Y register (INY)
  17. check if termination or loop condition is met (point 30)
  18. increment the row coordinate in the X register by one
  19. load #$01 into the accumulator
  20. store the value in the accumulator into the memory location $1400 to indicate we will now move from right to left
  21. compare the value in the Y register with the left-most column coordinate (#$00)
  22. if the comparison was true, then jump to reset and repeat loop (point 25)
  23. otherwise, decrement the value in the Y register (DEY)
  24. check if termination or loop condition is met (point 30)
  25. load the column coordinate of the left-most screen border (#$00) into the Y register
  26. increment the row coordinate in the X register by one
  27. load #$00 into the accumulator to indicate we want to move from left to right
  28. store the value in the accumulator into the memory location $1400
  29. check if termination or loop condition is met (point 30)
  30. compare the value in the X register to the bottom row coordinate (#$16)
  31. if the comparison is false, then loop back to clear the screen  (point 5)
  32. otherwise, terminate the program

test the program from VICMON by entering: .G 1403


the result will be a character W moving from left to right and back in a pingpong loop. Every time the character hits the left or right border of the screen, it will scroll down one row. When the character reaches the bottom of the screen, the program will terminate.

you can also save your program on a cassette


congratulations!

Saturday, September 21, 2019

VIC20-ASM-008 PingPong a Character on Screen infinitely from left to right and back


slot the VICMON cartridge into your VIC20
start VICMON by entering: SYS 24576


we want to accomplish the following:
  1. start program at 1403 and load #$00 into the accumulator. This will be our flag to determine if we are moving right (#$00) or left (#$01). We begin moving to the right (#$00).
  2. store the value in the accumulator into the memory location $1400. We will use this memory location to store the direction flag to move right or left (#$00 or #$01 respectively).
  3. load the 0th row coordinate (#$00) into the X register
  4. load the column coordinate of the left-most screen border (#$00) into the Y register
  5. load the clear screen character ($93) into the accumulator
  6. run subroutine  ($FFD2) to output the clear screen character ($93) from the accumulator
  7. load $#00 into the accumulator to ensure all bits are turned off (this will make 6 set position instead of get)
  8. call the set cursor location (Plot) subroutine at address $FFF0
  9. load the value for letter W (#$57) into the accumulator
  10. run subroutine ($FFD2) to output the W character (#$57) from the accumulator to screen
  11. load the value from location $1400 into the accumulator
  12. compare the value in the accumulator with #$01 (to check if we should go to the left)
  13. if the comparison was true, then jump to the instructions to move the cursor to the left (point 20)
  14. otherwise, compare the value in the Y register with the right-most column coordinate (#$15)
  15. if the comparison was true, then jump to set the program to move to the left (point 18)
  16. otherwise, increment the value in the Y register (INY)
  17. loop back to clear the screen (point 5)
  18. load #$01 into the accumulator
  19. store the value in the accumulator into the memory location $1400 to indicate we will now move from right to left
  20. compare the value in the Y register with the left-most column coordinate (#$00)
  21. if the comparison was true, then jump to reset and repeat loop (point 24)
  22. otherwise, decrement the value in the Y register (DEY)
  23. loop back to clear the screen (point 5)
  24. load the column coordinate of the left-most screen border (#$00) into the Y register
  25. load #$00 into the accumulator to indicate we want to move from left to right
  26. store the value in the accumulator into the memory location $1400
  27. jump to set the position on the screen and loop (point 8)
  28. terminate program. This actually won't ever happen as we will be held into an infinite loop



test the program from VICMON by entering: .G 1403

the result will be a character W moving from left to right and back in a pingpong loop.

congratulations!


As the program will run in a loop you will have to terminate it by pressing STOP + RESTORE on your VIC20 or ESC+PageUp if you are using the VIC20 VICE emulator.
This will quit the execution and return you to BASIC. To go back to VICMON and your program, just type SYS 24576 as usual.

Friday, September 20, 2019

VIC20-ASM-007 Move a Character on Screen from left to right and back to the left


slot the VICMON cartridge into your VIC20
start VICMON by entering: SYS 24576


we want to accomplish the following:
  1. start program at 1403 and load #$00 into the accumulator. This will be our flag to determine if we are moving right (#$00) or left (#$01). We begin moving to the right (#$00).
  2. store the value in the accumulator into the memory location $1400. We will use this memory location to store the direction flag to move right or left (#$00 or #$01 respectively).
  3. load the 0th row coordinate (#$00) into the X register
  4. load the column coordinate of the left-most screen border (#$00) into the Y register
  5. load the clear screen character ($93) into the accumulator
  6. run subroutine  ($FFD2) to output the clear screen character ($93) from the accumulator
  7. load $#00 into the accumulator to ensure all bits are turned off (this will make 6 set position instead of get)
  8. call the set cursor location (Plot) subroutine at address $FFF0
  9. load the value for letter W (#$57) into the accumulator
  10. run subroutine ($FFD2) to output the W character (#$57) from the accumulator to screen
  11. load the value from location $1400 into the accumulator
  12. compare the value in the accumulator with #$01 (to check if we should go to the left)
  13. if the comparison was true, then jump to the instructions to move the cursor to the left (point 20)
  14. otherwise, compare the value in the Y register with the right-most column coordinate (#$15)
  15. if the comparison was true, then jump to set the program to move to the left (point 18)
  16. otherwise, increment the value in the Y register (INY)
  17. loop back to clear the screen (point 5)
  18. load #$01 into the accumulator
  19. store the value in the accumulator into the memory location $1400 to indicate we will now move from right to left
  20. compare the value in the Y register with the left-most column coordinate (#$00)
  21. if the comparison was true, then jump to end the program (point 24)
  22. otherwise, decrement the value in the Y register (DEY)
  23. loop back to clear the screen (point 5)
  24. end program


test the program from VICMON by entering: .G 1403

the result will be a character W moving from left to right and, as it approaches the right border, from right to left.

congratulations!

VIC20-ASM-006 Move a Character on Screen (right-to-left)


slot the VICMON cartridge into your VIC20
start VICMON by entering: SYS 24576


  1. We want to accomplish the following:start program at 1400 and load 0th row coordinate (#$00) into the X register
  2. load the column coordinate of the right-most screen border (#$15) into the Y register
  3. load the clear screen character ($93) into the accumulator
  4. run subroutine  ($FFD2) to output the clear screen character ($93) from the accumulator
  5. load $#00 into the accumulator to ensure all bits are turned off (this will make 6 set position instead of get)
  6. call the set cursor location (Plot) subroutine at address $FFF0
  7. load the value for letter W (#$57) into the accumulator
  8. run subroutine ($FFD2) to output the W character (#$57) from the accumulator to screen
  9. compare the value in the Y register with the left-most column coordinate (#$00)
  10. if the comparison was true, then jump to the end of the program (point 13)
  11. otherwise decrement the value in the Y register (DEY)
  12. loop back to clear the screen (point 3)
  13. end the program

test the program from VICMON by entering: .G 1400

the result will be the W character moving from right to left.

congratulations!

Thursday, September 19, 2019

VIC20-ASM-005 Move a Character on Screen (left-to-right)


slot the VICMON cartridge into your VIC20
start VICMON by entering: SYS 24576


  1. We want to accomplish the following:start program at 1400 and load 0th row coordinate (#$00) into the X register
  2. load the column coordinate of the left-most screen border (#$00) into the Y register
  3. load the clear screen character ($93) into the accumulator
  4. run subroutine  ($FFD2) to output the clear screen character ($93) from the accumulator
  5. load $#00 into the accumulator to ensure all bits are turned off (this will make 6 set position instead of get)
  6. call the set cursor location (Plot) subroutine at address $FFF0
  7. load the value for letter W (#$57) into the accumulator
  8. run subroutine ($FFD2) to output the W character (#$57) from the accumulator to screen
  9. compare the value in the Y register with the right-most column coordinate (#$15)
  10. if the comparison was true, then jump to the end of the program (point 13)
  11. otherwise increment the value in the Y register (INY)
  12. loop back to clear the screen (point 3)
  13. end the program

test the program from VICMON by entering: .G 1400

the result will be the W characters moving from left to right.

congratulations!

Thursday, September 12, 2019

VIC20-ASM-004 Print Line of Characters on Screen


slot the VICMON cartridge into your VIC20
start VICMON by entering: SYS 24576



We want to accomplish the following:
  1. start program at 1400 and load 0th row coordinate (#$00) into the X register 
  2. load the column coordinate of the left-most screen border (#$00) into the Y register
  3. load $#00 into the accumulator to ensure all bits are turned off (this will make 4 set position instead of get)
  4. call the set cursor location (Plot) subroutine at address $FFF0
  5. load the value for letter W (#$57) into the accumulator
  6. run subroutine ($FFD2) to output the W character (#$57) from the accumulator to screen
  7. compare the value in the Y register with the right-most column coordinate (#$15)
  8. if the comparison was true, then jump to the end of the program (point 11)
  9. otherwise increment the value in the Y register
  10. loop back to load $#00 into the accumulator (point 3)
  11. end the program

test the program from VICMON by entering: .G 1400

the result will be an entire line of W characters from left to right.

congratulations!

Tuesday, September 10, 2019

VIC20-ASM-003 Print Character on Screen


slot the VICMON cartridge into your VIC20
start VICMON by entering: SYS 24576



We want to accomplish the following:
  • start program at 1400 and load the row coordinate of the lower screen border (#$16) into the X register 
  • load the column coordinate of the right-most screen border (#$15) into the Y register
  • call the set cursor location (Plot) subroutine at address $FFF0
  • load the value for letter W (#$57) into the accumulator
  • run subroutine ($FFD2) to output the W character (#$57) from the accumulator to screen
  • end the program


test the program from VICMON by entering: .G 1400

the result will be a W character in the lower-right corner of the screen. As VICMON updates, the W character will scroll upwards by 5 rows.

you can now play with other coordinates and other characters.