Author Topic: display problem fixed  (Read 774 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 261
  • Karma: 25
  • Hard players don't go home.
    • View Profile
display problem fixed
« on: November 05, 2017 »
It's been a while, but I had to show this one.

The end result of this might not be of use to most people,
but the programming might. (resistor paralleling values)
My problem was displaying more inputs than I needed,
but only using two or more of those inputs.
All in a simple program. D-pad to navigate.

Code: [Select]
restore resistors
read sets
dim Rset$(sets)
dim Rnos(sets)
dim R(sets)
for a=1 to sets
read Rset$(a)
read Rnos(a)
next a

restore values
read resistor
dim Rv(resistor)
for a=1 to resistor
read Rv(a)
next a

open window 640,512
setdispbuf vm
setdrawbuf vm
clear window

if and(c,128)<>0 left=1
if left=1 L=L+1
if L>2 L=2
if L=2 left=0
if and(c,128)=0 L=0

if and(c,32)<>0 right=1
if right=1 R=R+1
if R>2 R=2
if R=2 right=0
if and(c,32)=0 R=0

if left=1 sel=sel-1
if right=1 sel=sel+1
if sel<1 sel=1
if sel>8 sel=8

if and(c,16)<>0 up=1
if up=1 U=U+1
if U>2 U=2
if U=2 up=0
if and(c,16)=0 U=0

if and(c,64)<>0 down=1
if down=1 D=D+1
if D>2 D=2
if D=2 down=0
if and(c,64)=0 D=0

for a=1 to sets
if sel=a then
setrgb 1,0,256,0
setrgb 1,256,256,256
text 50*a+50,150,Rset$(a)
next a

for a=1 to sel
if sel=a and up=1 R(a)=R(a)+1
if sel=a and down=1 R(a)=R(a)-1
if R(a)<1 R(a)=1
if R(a)>5 R(a)=5

for b=1 to resistor
if R(a)=b Rnos(a)=Rv(b)
next b

setrgb 1,256,256,256
text 50*a+50,165,str$(Rnos(a))
next a

for a=1 to sel
next a
text 500,165,str$(1/answer)

until (1=0)

label resistors
data 8
data "R1",0
data "R2",0
data "R3",0
data "R4",0
data "R5",0
data "R6",0
data "R7",0
data "R8",0

label values
data 5
data 2.2,3.3,8,15,39
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: display problem fixed
« Reply #1 on: May 04, 2018 »
Cool, Nice work

Challenge Trophies Won: