[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Advanced &
Lyrical Nanoha wrote:
> ATM, I am unable to find much info on using the ampersand vector...
This is a repeat of information I posted in
csa2.programmer a year ago.
I have written ampersand libraries and can answer
specific questions and post sample code.
The key to ampersand routines is CHRGET and CHRGOT.
You can find an article on writing Applesoft ampersand routines at
www.syndicomm.com/~a2.ryan/GenieLamp_A2Pro/Text/1996/aplp9601.txt
There is a disassembly of Applesoft included with
the Merlin and SC Assemblers.
The following Apple Tech Info Library (TIL) articles are useful:
57 Applesoft Internals: Program storage format
72 Applesoft Internals: Using Applesoft ROM Subroutines (1 of 2)
73 Applesoft Internals: Using Applesoft ROM Subroutines (2 of 2)
74 Applesoft Internals: Floating Point Math Package (1 of 2)
75 Applesoft Internals: Floating Point Math Package (2 of 2)
77 Applesoft Internals: String Utilities
83 Applesoft Internals: Index to Routines (1 of 2)
84 Applesoft Internals: Index to Routines (2 of 2)
92 Applesoft Internals: Page Zero Memory Map
1798 Applesoft Internals: Where to find routines
Use the routine descriptions from the TIL articles above
to understand the samples below.
SAMPLE #1: given "& x,y" do "POKE x,y" where x and y
are numbers or numeric expressions.
If you trace the POKE command at $E77B you will see this code.
0300 20 67 DD JSR $DD67 ;FRMNUM
0303 20 52 E7 JSR $E752 ;GETADR
0306 20 BE DE JSR $DEBE ;CHKCOM
0309 20 F8 E6 JSR $E6F8 ;GETBYT
030C 8A TXA
030D A0 00 LDY #$00
030F 91 50 STA ($50),Y ;LINNUM
0311 60 RTS
SAMPLE #2: given "& x,v" do "v=PEEK(x)" where x
is a number or numeric expression and v is
an integer or floating point variable.
0312 20 67 DD JSR $DD67 ;FRMNUM
0315 20 52 E7 JSR $E752 ;GETADR
0318 A0 00 LDY #$00
031A B1 50 LDA ($50),Y ;LINNUM
031C 48 PHA ;save value
031D 20 BE DE JSR $DEBE ;CHKCOM
0320 20 E3 DF JSR $DFE3 ;PTRGET
0323 A6 11 LDX $11 ;VALTYP
0325 F0 03 BEQ $032A ;=>numeric, okay
0327 4C C9 DE JMP $DEC9 ;==>SYNERR
032A A6 12 LDX $12 ;INTFLG
032C F0 0A BEQ $0338 ;=>real
032E A0 01 LDY #$01
0330 68 PLA ;restore value
0331 91 83 STA ($83),Y ;VARPNT
0333 88 DEY
0334 98 TYA
0335 91 83 STA ($83),Y ;VARPNT
0337 60 RTS
0338 68 PLA ;restore value
0339 A8 TAY
033A 20 01 E3 JSR $E301 ;SNGFLT
033D A6 83 LDX $83 ;VARPNT
033F A4 84 LDY $84 ;VARPNT+1
0341 4C 2B EB JMP $EB2B ;==>MOVMF
--
Paul R. Santa-Maria
Monroe, Michigan USA
- References:
- Advanced &
- From: Lyrical Nanoha <LyricalNanoha@dosius.net>