Another 6502 coder, eh? I use to hate the fact that there was no instruction for directly exchanging the X and Y index registers. You
had to push a, move x to a, push a, move y to a, move a to x, pop a, move a to y, and pop a for that simple operation (you did not have the same addressing modes available from both index registers). I did write my own assembler for the PET computer with 8K of RAM, which left you about 500 bytes for assembler code.
I made some small changes to the best example above. I considered doing it in Assembler, but fact is, FASM is still a bit of a mystery to me -- you have to use simple variables to interface to it from PB, and that means extra work up front. Aside from the fact that I'm not comfortable with addressing modes for the old architecture (DS, ES, SI, and DI) as opposed to the extended addressing modes currently offered for the expanded memory in modern computers. Most examples found in Assembler coding books only deal with the old 8086 architecture.
I think it would be great if PB started a new forum for language extensions, to which we could submit examples and vie to come up with the best version. These could then be bundled into libraries for use in various projects. There might be less demand for major compiler updates - after all, C and C++ are mostly comprised of library extensions.
Code: Select all
Procedure.s y_propercase(s.s)
*p=@s
b.b=32
Repeat
a.b=b
b=PeekB(*p)
If b=0
Goto exitrepeat
EndIf
c.b=b & 223
If c>= 65 And c<=90
If a=32
PokeB(*p,c)
Else
PokeB(*p,c | 32)
EndIf
EndIf
*p+1
ForEver
exitrepeat:
ProcedureReturn s
EndProcedure
has-been wanna-be (You may not agree with what I say, but it will make you think).