MSGID: 1:130/230@fidonet 6480b84a
PID: C-NET AMIGA BBS 5.34b
On Tue 6-Jun-2023 4:55p, Kp Kp@3:770/3.0 wrote:
KK> I need some scrutinizing on my crappy coding expertise. Haven't made a
KK> program in years.. Could be junk or have no idea what I am doing.
KK> Gibberish? Lol.
KK> 10 PRINT "***** C64 DISK EDITOR *****"
KK> 20 PRINT
KK> 30 INPUT "Enter the name of the disk file: "; FILENAME$
KK> 40 PRINT
First and foremost, I am not an expert in C64/128 programming, I am just
drawing from the cob-web infested parts of my brain here... So here are my
thoughts.
The C64 and 128 have dual character sets (UPPER/Gfx vs (Upper/Lower) and based
on the above it appears your in Upper/lower. When in this mode commands like
PRINT, INPUT, OPEN, AND Varables all need to be in lowercase.
Also filename$ is too long. Varables on C64 & 128 can be up to two characters
+ a designator. They must start with a letter then you can have a letter,
number, or designator. Haveing the $ at the end is fine as it tells the
computer its a string. Use % for integers if you want to pick up a cycle or
two. There are also designatores for single or double percision floating
varables too.
KK> 130 IF CHOICE = 1 THEN
KK> 140 INPUT "Enter the sector number to display: "; SECTOR
KK> 150 PRINT
KK> 160 SYS 64738
KK> 170 PRINT
KK> 180 GOTO 50
KK> 190 ELSEIF CHOICE = 2 THEN
KK> 200 INPUT "Enter the sector number to edit: "; SECTOR
The C64 nor C128 support this type of statement structure. The Syntex for IF
statements are:
IF THEN [:ELSE ]
They all must be contained on the same line!
Once the THEN are run OR the ELSE are run the
program will drop to the following line of code. This is why C64 & C128 has
alot of spegitty code in their basic files, but with the use of GOSUB and GOTO
carefully you can limit that to a point. If you make your program where its
more of a Hub and Spoke design, it will be easier to follow then all kinds
GOTO statement to jump over blockes of code. Something like this psudocode
Main
Print Banner
Get Filename and store in fn$
M1: GOSUB Display Menu (put user input into m)
ONGOSUB m C1, C2, C3, etc...
GOTO A:
C1: Statements for Menu #1
return
01: Any routinmes for C1
02: etc...
C2: Statements for Menu #2
03: Any routines for C2
04: etc...
This is much easier to follow. Like everything there is a balance here, so if
you can handle it with just 3-5 lines of code in a block then no need for a
routine. When it gets beyond that is when I start thinking about making a
routine out of it.
Also your line numbers can be from 0 - 65535 so give each routine a wide
number range. Like MAIN = 100-500, Display Menu = 600-1000, etc... This way
when you need to change things in the rotines your not suck. Once its
finished use a renumber utility to restructure them with lower numbers and
give youself a 100 line gap between sections. Just how I like to do things.
Also I would move the OPEN statement in line 50 into the routines that need
it. This way its only opened and closed when needed. I know its a bit more
code, but make for easier to follow code.
This along with the other posters comments you should have a good start. I
would suggest you snag a copy of the C128 System Guide or the C64 Systems
Guide they do a great job of laying out the syntex and rules plus the back is
setup more as a referance for all the commands, so its easy to look stuff up.
It should get you up to speed, or dare I say down to C64/128 Basic.
Hope this helps....
[+] K-Guide
--- CNet/5
* Origin: Future World II - fw2.cnetbbs.net:6800 (1:130/230)
SEEN-BY: 1/123 15/0 18/200 90/1 105/81 106/201 987 123/131 124/5014
SEEN-BY: 124/5016 129/305 130/230 330 153/7715 218/700 226/30 227/114
SEEN-BY: 229/110 112 113 206 275 307 317 400 426 428 470 664 700 266/512
SEEN-BY: 282/1038 291/111 317/3 320/219 322/757 342/200 387/25 26
SEEN-BY: 396/45 460/58 712/848
PATH: 130/230 396/45 229/426
|