Page 0 available locations

A forum for users of EhBASIC (Enhanced BASIC), a portable BASIC interpreter for 6502 microcomputers written by Lee Davison.
Post Reply
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Page 0 available locations

Post by BillO »

HI all,

Does anyone have a correct and complete list of available page 0 locations for EhBasic 2.22?
Bill
Klaus2m5
Posts: 442
Joined: 28 Jul 2012
Location: Wiesbaden, Germany

Re: Page 0 available locations

Post by Klaus2m5 »

Code: Select all

00045    ; zero page use ..
00046    
00047      0000             LAB_WARM 		= $00		; BASIC warm start entry point
00048      0001             Wrmjpl 		= LAB_WARM+1; BASIC warm start vector jump low byte
00049      0002             Wrmjph 		= LAB_WARM+2; BASIC warm start vector jump high byte
00050    
00051      000A             Usrjmp		= $0A		; USR function JMP address
00052      000B             Usrjpl		= Usrjmp+1	; USR function JMP vector low byte
00053      000C             Usrjph		= Usrjmp+2	; USR function JMP vector high byte
00054      000D             Nullct		= $0D		; nulls output after each line
00055      000E             TPos			= $0E		; BASIC terminal position byte
00056      000F             TWidth		= $0F		; BASIC terminal width byte
00057      0010             Iclim			= $10		; input column limit
00058      0011             Itempl		= $11		; temporary integer low byte
00059      0012             Itemph		= Itempl+1	; temporary integer high byte
00060    
00061      0011             nums_1		= Itempl	; number to bin/hex string convert MSB
00062      0012             nums_2		= nums_1+1	; number to bin/hex string convert
00063      0013             nums_3		= nums_1+2	; number to bin/hex string convert LSB
00064    
00065      005B             Srchc			= $5B		; search character
00066      005B             Temp3			= Srchc	; temp byte used in number routines
00067      005C             Scnquo		= $5C		; scan-between-quotes flag
00068      005C             Asrch			= Scnquo	; alt search character
00069    
00070      005B             XOAw_l		= Srchc	; eXclusive OR, OR and AND word low byte
00071      005C             XOAw_h		= Scnquo	; eXclusive OR, OR and AND word high byte
00072    
00073      005D             Ibptr			= $5D		; input buffer pointer
00074      005D             Dimcnt		= Ibptr	; # of dimensions
00075      005D             Tindx			= Ibptr	; token index
00076    
00077      005E             Defdim		= $5E		; default DIM flag
00078      005F             Dtypef		= $5F		; data type flag, $FF=string, $00=numeric
00079      0060             Oquote		= $60		; open quote flag (b7) (Flag: DATA scan; LIST quote; memory)
00080      0060             Gclctd		= $60		; garbage collected flag
00081      0061             Sufnxf		= $61		; subscript/FNX flag, 1xxx xxx = FN(0xxx xxx)
00082      0062             Imode			= $62		; input mode flag, $00=INPUT, $80=READ
00083    
00084      0063             Cflag			= $63		; comparison evaluation flag
00085    
00086      0064             TabSiz		= $64		; TAB step size (was input flag)
00087    
00088      0065             next_s		= $65		; next descriptor stack address
00089    
00090    					; these two bytes form a word pointer to the item
00091    					; currently on top of the descriptor stack
00092      0066             last_sl		= $66		; last descriptor stack address low byte
00093      0067             last_sh		= $67		; last descriptor stack address high byte (always $00)
00094    
00095      0068             des_sk		= $68		; descriptor stack start address (temp strings)
00096    
00097    ;			= $70		; End of descriptor stack
00098    
00099      0071             ut1_pl		= $71		; utility pointer 1 low byte
00100      0072             ut1_ph		= ut1_pl+1	; utility pointer 1 high byte
00101      0073             ut2_pl		= $73		; utility pointer 2 low byte
00102      0074             ut2_ph		= ut2_pl+1	; utility pointer 2 high byte
00103    
00104      0071             Temp_2		= ut1_pl	; temp byte for block move	
00105    
00106      0075             FACt_1		= $75		; FAC temp mantissa1
00107      0076             FACt_2		= FACt_1+1	; FAC temp mantissa2
00108      0077             FACt_3		= FACt_2+1	; FAC temp mantissa3
00109    
00110      0076             dims_l		= FACt_2	; array dimension size low byte
00111      0077             dims_h		= FACt_3	; array dimension size high byte
00112    
00113      0078             TempB			= $78		; temp page 0 byte
00114    
00115      0079             Smeml			= $79		; start of mem low byte		(Start-of-Basic)
00116      007A             Smemh			= Smeml+1	; start of mem high byte	(Start-of-Basic)
00117      007B             Svarl			= $7B		; start of vars low byte	(Start-of-Variables)
00118      007C             Svarh			= Svarl+1	; start of vars high byte	(Start-of-Variables)
00119      007D             Sarryl		= $7D		; var mem end low byte		(Start-of-Arrays)
00120      007E             Sarryh		= Sarryl+1	; var mem end high byte		(Start-of-Arrays)
00121      007F             Earryl		= $7F		; array mem end low byte	(End-of-Arrays)
00122      0080             Earryh		= Earryl+1	; array mem end high byte	(End-of-Arrays)
00123      0081             Sstorl		= $81		; string storage low byte	(String storage (moving down))
00124      0082             Sstorh		= Sstorl+1	; string storage high byte	(String storage (moving down))
00125      0083             Sutill		= $83		; string utility ptr low byte
00126      0084             Sutilh		= Sutill+1	; string utility ptr high byte
00127      0085             Ememl			= $85		; end of mem low byte		(Limit-of-memory)
00128      0086             Ememh			= Ememl+1	; end of mem high byte		(Limit-of-memory)
00129      0087             Clinel		= $87		; current line low byte		(Basic line number)
00130      0088             Clineh		= Clinel+1	; current line high byte	(Basic line number)
00131      0089             Blinel		= $89		; break line low byte		(Previous Basic line number)
00132      008A             Blineh		= Blinel+1	; break line high byte		(Previous Basic line number)
00133    
00134      008B             Cpntrl		= $8B		; continue pointer low byte
00135      008C             Cpntrh		= Cpntrl+1	; continue pointer high byte
00136    
00137      008D             Dlinel		= $8D		; current DATA line low byte
00138      008E             Dlineh		= Dlinel+1	; current DATA line high byte
00139    
00140      008F             Dptrl			= $8F		; DATA pointer low byte
00141      0090             Dptrh			= Dptrl+1	; DATA pointer high byte
00142    
00143      0091             Rdptrl		= $91		; read pointer low byte
00144      0092             Rdptrh		= Rdptrl+1	; read pointer high byte
00145    
00146      0093             Varnm1		= $93		; current var name 1st byte
00147      0094             Varnm2		= Varnm1+1	; current var name 2nd byte
00148    
00149      0095             Cvaral		= $95		; current var address low byte
00150      0096             Cvarah		= Cvaral+1	; current var address high byte
00151    
00152      0097             Frnxtl		= $97		; var pointer for FOR/NEXT low byte
00153      0098             Frnxth		= Frnxtl+1	; var pointer for FOR/NEXT high byte
00154    
00155      0097             Tidx1			= Frnxtl	; temp line index
00156    
00157      0097             Lvarpl		= Frnxtl	; let var pointer low byte
00158      0098             Lvarph		= Frnxth	; let var pointer high byte
00159    
00160      0099             prstk			= $99		; precedence stacked flag
00161    
00162      009B             comp_f		= $9B		; compare function flag, bits 0,1 and 2 used
00163    					; bit 2 set if >
00164    					; bit 1 set if =
00165    					; bit 0 set if <
00166    
00167      009C             func_l		= $9C		; function pointer low byte
00168      009D             func_h		= func_l+1	; function pointer high byte
00169    
00170      009C             garb_l		= func_l	; garbage collection working pointer low byte
00171      009D             garb_h		= func_h	; garbage collection working pointer high byte
00172    
00173      009E             des_2l		= $9E		; string descriptor_2 pointer low byte
00174      009F             des_2h		= des_2l+1	; string descriptor_2 pointer high byte
00175    
00176      00A0             g_step		= $A0		; garbage collect step size
00177    
00178      00A1             Fnxjmp		= $A1		; jump vector for functions
00179      00A2             Fnxjpl		= Fnxjmp+1	; functions jump vector low byte
00180      00A3             Fnxjph		= Fnxjmp+2	; functions jump vector high byte
00181    
00182      00A2             g_indx		= Fnxjpl	; garbage collect temp index
00183    
00184      00A3             FAC2_r		= $A3		; FAC2 rounding byte
00185    
00186      00A4             Adatal		= $A4		; array data pointer low byte
00187      00A5             Adatah		= Adatal+1	; array data pointer high  byte
00188    
00189      00A4             Nbendl		= Adatal	; new block end pointer low byte
00190      00A5             Nbendh		= Adatah	; new block end pointer high  byte
00191    
00192      00A6             Obendl		= $A6		; old block end pointer low byte
00193      00A7             Obendh		= Obendl+1	; old block end pointer high  byte
00194    
00195      00A8             numexp		= $A8		; string to float number exponent count
00196      00A9             expcnt		= $A9		; string to float exponent count
00197    
00198      00A8             numbit		= numexp	; bit count for array element calculations
00199    
00200      00AA             numdpf		= $AA		; string to float decimal point flag
00201      00AB             expneg		= $AB		; string to float eval exponent -ve flag
00202    
00203      00AA             Astrtl		= numdpf	; array start pointer low byte
00204      00AB             Astrth		= expneg	; array start pointer high  byte
00205    
00206      00AA             Histrl		= numdpf	; highest string low byte
00207      00AB             Histrh		= expneg	; highest string high  byte
00208    
00209      00AA             Baslnl		= numdpf	; BASIC search line pointer low byte
00210      00AB             Baslnh		= expneg	; BASIC search line pointer high  byte
00211    
00212      00AA             Fvar_l		= numdpf	; find/found variable pointer low byte
00213      00AB             Fvar_h		= expneg	; find/found variable pointer high  byte
00214    
00215      00AA             Ostrtl		= numdpf	; old block start pointer low byte
00216      00AB             Ostrth		= expneg	; old block start pointer high  byte
00217    
00218      00AA             Vrschl		= numdpf	; variable search pointer low byte
00219      00AB             Vrschh		= expneg	; variable search pointer high  byte
00220    
00221      00AC             FAC1_e		= $AC		; FAC1 exponent
00222      00AD             FAC1_1		= FAC1_e+1	; FAC1 mantissa1
00223      00AE             FAC1_2		= FAC1_e+2	; FAC1 mantissa2
00224      00AF             FAC1_3		= FAC1_e+3	; FAC1 mantissa3
00225      00B0             FAC1_s		= FAC1_e+4	; FAC1 sign (b7)
00226    
00227      00AC             str_ln		= FAC1_e	; string length
00228      00AD             str_pl		= FAC1_1	; string pointer low byte
00229      00AE             str_ph		= FAC1_2	; string pointer high byte
00230    
00231      00AE             des_pl		= FAC1_2	; string descriptor pointer low byte
00232      00AF             des_ph		= FAC1_3	; string descriptor pointer high byte
00233    
00234      00AF             mids_l		= FAC1_3	; MID$ string temp length byte
00235    
00236      00B1             negnum		= $B1		; string to float eval -ve flag
00237      00B1             numcon		= $B1		; series evaluation constant count
00238    
00239      00B2             FAC1_o		= $B2		; FAC1 overflow byte
00240    
00241      00B3             FAC2_e		= $B3		; FAC2 exponent
00242      00B4             FAC2_1		= FAC2_e+1	; FAC2 mantissa1
00243      00B5             FAC2_2		= FAC2_e+2	; FAC2 mantissa2
00244      00B6             FAC2_3		= FAC2_e+3	; FAC2 mantissa3
00245      00B7             FAC2_s		= FAC2_e+4	; FAC2 sign (b7)
00246    
00247      00B8             FAC_sc		= $B8		; FAC sign comparison, Acc#1 vs #2
00248      00B9             FAC1_r		= $B9		; FAC1 rounding byte
00249    
00250      00B8             ssptr_l		= FAC_sc	; string start pointer low byte
00251      00B9             ssptr_h		= FAC1_r	; string start pointer high byte
00252    
00253      00B8             sdescr		= FAC_sc	; string descriptor pointer
00254    
00255      00BA             csidx			= $BA		; line crunch save index
00256      00BA             Asptl			= csidx	; array size/pointer low byte
00257      00BB             Aspth			= $BB		; array size/pointer high byte
00258    
00259      00BA             Btmpl			= Asptl	; BASIC pointer temp low byte
00260      00BB             Btmph			= Aspth	; BASIC pointer temp low byte
00261    
00262      00BA             Cptrl			= Asptl	; BASIC pointer temp low byte
00263      00BB             Cptrh			= Aspth	; BASIC pointer temp low byte
00264    
00265      00BA             Sendl			= Asptl	; BASIC pointer temp low byte
00266      00BB             Sendh			= Aspth	; BASIC pointer temp low byte
00267    
00268      00BC             LAB_IGBY		= $BC		; get next BASIC byte subroutine
00269    
00270      00C2             LAB_GBYT		= $C2		; get current BASIC byte subroutine
00271      00C3             Bpntrl		= $C3		; BASIC execute (get byte) pointer low byte
00272      00C4             Bpntrh		= Bpntrl+1	; BASIC execute (get byte) pointer high byte
00273    
00274    ;			= $D7		; end of get BASIC char subroutine
00275    
00276      00D8             Rbyte4		= $D8		; extra PRNG byte
00277      00D9             Rbyte1		= Rbyte4+1	; most significant PRNG byte
00278      00DA             Rbyte2		= Rbyte4+2	; middle PRNG byte
00279      00DB             Rbyte3		= Rbyte4+3	; least significant PRNG byte
00280    
00281      00DC             NmiBase		= $DC		; NMI handler enabled/setup/triggered flags
00282    					; bit	function
00283    					; ===	========
00284    					; 7	interrupt setup
00285    					; 6	interrupt enabled
00286    					; 5	interrupt happened
00287    ;			= $DD		; NMI handler addr low byte
00288    ;			= $DE		; NMI handler addr high byte
00289      00DF             IrqBase		= $DF		; IRQ handler enabled/setup/triggered flags
00290    ;			= $E0		; IRQ handler addr low byte
00291    ;			= $E1		; IRQ handler addr high byte
00292    
00293      00E2             irq_a_reg		= $E2		; save A during IRQ
00294    ;			= $E3		; unused
00295    ;			= $E4		; unused
00296    ;			= $E5		; unused
00297    ;			= $E6		; unused
00298    ;			= $E7		; unused
00299    ;			= $E8		; unused
00300    ;			= $E9		; unused
00301    ;			= $EA		; unused
00302    ;			= $EB		; unused
00303    ;			= $EC		; unused
00304    ;			= $ED		; unused
00305    ;			= $EE		; unused
00306    
00307      00EF             Decss			= $EF		; number to decimal string start
00308      00F0             Decssp1		= Decss+1	; number to decimal string start
00309    
00310    ;			= $FF		; decimal string end
Actually $E2 was added in my version, so it will also be unused in yours. Another large free memory area seems to be from $14 - $5A.
6502 sources on GitHub: https://github.com/Klaus2m5
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Page 0 available locations

Post by BillO »

Thanks Klaus.

Isn't some code loaded in to page 0 somewhere?

If not, then that's more free than I expected - good stuff!
Bill
Klaus2m5
Posts: 442
Joined: 28 Jul 2012
Location: Wiesbaden, Germany

Re: Page 0 available locations

Post by Klaus2m5 »

Yes, code is loaded at $BC-$D7, the get BASIC char subroutine. I think the big gap $14-$5A was originally reserved for the input buffer. But that was moved away from page zero in EhBASIC.
6502 sources on GitHub: https://github.com/Klaus2m5
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Page 0 available locations

Post by BillO »

Thanks!
Bill
Post Reply