Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

New York... when civilization falls apart, remember, we were way ahead of you. -- David Letterman


devel / comp.sys.cbm / Re: Messing around, creating a disk editor.

SubjectAuthor
o Messing around, creating a disk editor.K-Guide

1
Re: Messing around, creating a disk editor.

<1686157386@f230.n130.z1.fidonet.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=602&group=comp.sys.cbm#602

  copy link   Newsgroups: comp.sys.cbm
Path: i2pn2.org!i2pn.org!news.niel.me!pasdenom.info!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!1.us.feeder.erje.net!feeder.erje.net!news.quux.org!news.bbs.nz!.POSTED.agency.bbs.nz!not-for-mail
From: nospam.K-Guide@f230.n130.z1.fidonet.org (K-Guide)
Newsgroups: comp.sys.cbm
Subject: Re: Messing around, creating a disk editor.
Date: Wed, 07 Jun 2023 11:03:00 +1300
Organization: Agency HUB, Dunedin - New Zealand
Message-ID: <1686157386@f230.n130.z1.fidonet.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: news.bbs.nz; posting-host="8IWYKlztXHa0+IViEdY46zrq8kpk7dC9fTbT74JiSDQ";
logging-data="17783"; mail-complaints-to="abuse@news.bbs.nz"
User-Agent: VSoup v1.2.9.47Beta [95/NT]
X-Comment-To: All
X-MailConverter: SoupGate-Win32 v1.05
 by: K-Guide - Tue, 6 Jun 2023 22:03 UTC

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 <expression> THEN <statements> [:ELSE <statements>]

They all must be contained on the same line!

Once the THEN <statements> are run OR the ELSE <statements> 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

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor