Groups | Search | Server Info | Login | Register
Groups > comp.sys.apple2.programmer > #40
| From | A2CPM <a2@wilserv.com> |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Re: Proposed command line argument extraction for Kyan Pascal |
| Date | 2011-06-14 04:38 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <1ff62e63-ad13-4ad9-8493-cd6308980b8e@j9g2000vbs.googlegroups.com> (permalink) |
| References | <e5ec3f2f-154b-4d49-999b-d064f2c8acb7@n10g2000vby.googlegroups.com> <nospam-306A99.11035712062011@news.aioe.org> <c1649584-e4d7-4048-8841-876fdca98dbf@a10g2000vbz.googlegroups.com> |
(* begin Pascal source text *)
program tCL;
type pString = record
len: char;
s: array[1..15] of char
end;
pStrPtr = ^pString;
var max, i, j: integer;
answer: pStrPtr;
function ParamCount: integer;
begin
ParamCount := 0;
#a
LDA CLPCNT
LDY #5
STA (_SP),Y
#
end;
function ParamStr(i: integer): pStrPtr;
begin
ParamStr := nil;
#a
;
;
;
TXA
PHA
;
; Get high order byte of parm number
;
LDY #8
LDA (_SP),Y
;
; Branch if invalid
;
BNZ PSEXIT
;
; Get low order byte of parm number
;
DEY
LDA (_SP),Y
;
; Branch if invalid
;
CMP CLPCNT
BGE PSEXIT
;
; Multiply by two
;
ASL A
TAX
;
; Copy address to caller's variable
;
LDA CLPADR,X
LDY #5
STA (_SP),Y
LDA CLPADR+1,X
INY
STA (_SP),Y
;
;
;
PSEXIT PLA
TAX
#
end;
begin { Main }
for i := 0 to ParamCount - 1
do begin
answer := ParamStr(i);
max := ord(answer^.len);
write('Parameter number ', i, ' is "');
for j := 1 to max
do write(answer^.s[j]);
writeln('"')
end
end.
(* end Pascal source text *)
The above source file can be compiled with any existing Kyan Pascal
compiler but needs the new "STDLIB.S" to run correctly.
A big THANK YOU to John Matthews for upgrading my knowledge of
pointers.
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Proposed command line argument extraction for Kyan Pascal A2CPM <a2@wilserv.com> - 2011-06-12 02:40 -0700
Re: Proposed command line argument extraction for Kyan Pascal "John B. Matthews" <nospam@nospam.invalid> - 2011-06-12 11:03 -0400
Re: Proposed command line argument extraction for Kyan Pascal A2CPM <a2@wilserv.com> - 2011-06-13 08:47 -0700
Re: Proposed command line argument extraction for Kyan Pascal A2CPM <a2@wilserv.com> - 2011-06-14 04:38 -0700
Re: Proposed command line argument extraction for Kyan Pascal "Anton Treuenfels" <teamtempest@yahoo.com> - 2011-06-14 16:22 -0500
Re: Proposed command line argument extraction for Kyan Pascal "John B. Matthews" <nospam@nospam.invalid> - 2011-06-14 23:53 -0400
csiph-web