Page 1 of 1

Value or Progress Bar

Posted: Wed Nov 22, 2023 8:07 pm
by chysn
I'm working on a MIDI editor for a synthesizer (Sequential Prophet 5/10), and one of the things I want is a non-numeric display of parameter values. I decided to do this in the form a value bar. On this particular instrument, values usually range from 0-120, with some going 0-127. Since the VIC-20's RAM needs to be pretty much committed to synthesizer data, I'm doing everything with PETSCII characters.

So I thought I'd share this code, in case someone would find it useful. It generates a value bar based on the number in the accumulator. I'll also need to parameterize screen location when I write the actual editor. This version divides the value by 2, allowing more real estate for labels. The screen might look cluttered if the bars are too big, and I'd like room to also show the numeric value.

This, of course, can also be used as a progress bar.

The formatting is BASIC for wAx, with a demo after the assembly.

Code: Select all

  100 .@-
  110 a=6144:input "install [6144]";a
  120 .,'a' ldy #0
  130 .,* lsr a
  140 .,* sec
  150 .,*@@ sbc #8
  160 .,* bcc @f
  170 .,* pha
  180 .,* lda #$a0
  190 .,* sta $1e00,y
  200 .,* iny
  210 .,* pla
  220 .,* bcs @@
  230 .,*@f eor #$ff
  240 .,* tax
  250 .,* lda @p,x
  260 .,*@@ sta $1e00,y
  270 .,* lda #$20
  280 .,* iny
  290 .,* cpy #8
  300 .,* bne @@
  310 .,* rts
  320 .,*@p; partial
  330 .,* :e7 ea f6 61
  340 .,* :75 74 65 20
  350 poke36879,8
  360 print"{clr}"
  370 for v=0 to 120
  380 .;'v'
  390 sys a
  400 next v