txtelite with input loop

This commit is contained in:
Irmen de Jong 2020-10-10 01:46:19 +02:00
parent 0bbb2240f2
commit 56d530ff04

View File

@ -1,5 +1,7 @@
%import textio %import textio
%import conv %import conv
%option no_sysinit
%zeropage basicsafe
; Prog8 adaptation of the Text-Elite galaxy system trading simulation engine. ; Prog8 adaptation of the Text-Elite galaxy system trading simulation engine.
; Original C-version obtained from: http://www.elitehomepage.org/text/index.htm ; Original C-version obtained from: http://www.elitehomepage.org/text/index.htm
@ -30,18 +32,19 @@ main {
repeat { repeat {
str input = "????????" str input = "????????"
txt.print("\nEnter system number 0-255: ") txt.print("\nEnter system number 0-255 q=quit: ")
void txt.input_chars(input) void txt.input_chars(input)
ubyte system = lsb(conv.str2uword(input)) if input[0]=='q'
break
ubyte systemNr = lsb(conv.str2uword(input))
galaxy.init(1) galaxy.init(1)
repeat system+1 { galaxy.generate_next_planet() ; always at least planet 0 (separate to avoid repeat ubyte overflow)
repeat systemNr {
galaxy.generate_next_planet() galaxy.generate_next_planet()
} }
planet.display(false) planet.display(false)
} }
txt.print("\nEnter to exit: ")
void c64.CHRIN()
} }
asmsub testX() { asmsub testX() {