Update: my @A) enhancement is certainly doable, but is more expensive than Klaus' suggestion to use @ as a special memory access variable and another variable like < for the access pointer (which can be used as a normal variable if the @ feature is avoided). I'm going to back-track a bit and implement Klaus' proposal instead, then work on neutering the space character. I am cautiously optimistic that both of these enhancements (and & | ^) will still fit inside 1KB.
Source coming soon, I hope!
Mike B.
P.S. I have also moved all of the I/O subroutines to the end, to prevent any out-of-range branch hassles for those of you who need some extra code space to deal with systems having no built-in monitor I/O support (my interpreter does a lot of internal code sharing with unstructured branch instructions, to save space).
P.P.S. I have to test it out on AppleWin, but it looks like the VTL02B Apple 2 version will come in under 1KB, with 48 bytes to spare, allowing enough space to tweak the terminal I/O subroutines and port it to most 6502 systems.
Code:
[ ... ]
;------------------------------------------------------
; 2015: Revision B, with several space optimizations
; (suggested by dclxvi) and enhancements (suggested
; by mkl0815 and Klaus2m5).
;
; New features in Revision B:
; * Bit-wise operators & | ^ (and, or, xor)
; Example: A=$|128) Get a char and set hi-bit
;
; * Absolute addressed 8-bit memory load and store
; via the @ <) facility:
; Example: <=P) Point to the I/O port at P
; @=@&254^128) Clear low-bit & flip hi-bit
;
; * The space character is no longer a valid user
; variable nor a "valid" binary operator. It is
; now only significant in strings and program
; listings, where it may be used to improve human
; readability, at a slight cost in execution
; speed and memory consumption.
; Example:
; * (VTL-2)
; 1000 A=1) Init loop index
; 1010 ?=A) Print index
; 1020 ?="") Newline
; 1030 A=A+1) Update index
; 1040 #=A<10*1010) Loop until done
; * (VTL02B)
; 1000 A = 1 ) Init loop index
; 1010 ? = A ) Print index
; 1020 ? = "" ) Newline
; 1030 A = A + 1 ) Update index
; 1040 # = A < 10 * 1010 ) Loop until done
;------------------------------------------------------
[ ... ]
P.P.S. Er ... 45 bytes to spare, and I still have a significant bug to squash. Has anyone here used AppleWin's debug feature? How steep is the learning curve? I debugged the first one through detailed run-time observation and a few carefully-selected break-points, but I might try something different this time ...