6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 10:05 am

All times are UTC




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: EhBasic memory usage
PostPosted: Mon Jul 16, 2018 7:47 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
BillO wrote:
Do you have a link to that version?

Try this: http://mdfs.net/Software/6502/EhBasic/

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBasic memory usage
PostPosted: Mon Jul 16, 2018 9:23 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Okay, I've basically completed an initial CMOS version of EhBasic that requires a CMOS 65C02 to execute. It's a bit smaller in size and probably a tad bit faster, but no extensive testing has been done as of yet. It's also a single source asm file and has everything included in it. All you would need to do is change the page zero base pointer, input buffer page, assembly start address and of course the four vectors for input, output, load and save.

It's based on Klaus' latest Version 2.22p3 with the additional stack floor patch and the chrget routine running from ROM to save some additional page zero space. It's also setup for WDC Tools assembler/linker and creates a S19 output file by default (using the WDC Tide front end). I still consider this a work in progress but I think it's a decent start. It's primarily configured to run on my latest C02 Pocket SBC, which runs a WDC 65C02 at 6MHz with 32KB RAM and 32KB ROM (less 160 bytes for I/O) and allows for 30KB of free RAM for EhBasic.

Attachment:
C02 Basic.zip [210.85 KiB]
Downloaded 194 times

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBasic memory usage
PostPosted: Mon Jul 16, 2018 10:08 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
floobydust wrote:
BillO wrote:
Do you have a link to that version?

Try this: http://mdfs.net/Software/6502/EhBasic/

Thanks.

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBasic memory usage
PostPosted: Tue Jul 17, 2018 9:49 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
I looked at the character get routine LAB_IGBY of EhBASIC2.23 when it is not in zeropage and found
Code:
.if ZPROUT=0
LAB_IGBY
.endif

LAB_2CEE
   INC   Bpntrl      ; increment BASIC execute pointer low byte
   BNE   LAB_2CF4   ; branch if no carry
            ; else
   INC   Bpntrh      ; increment BASIC execute pointer high byte

; page 0 initialisation table from $C2
; scan memory

LAB_2CF4
.if ZPROUT
   LDA   $FFFF      ; get byte to scan (addr set by call routine)
.else
LAB_GBYT
   LDY   #0
   LDA   (Bpntrl),Y
.endif
Not preserving Y may bite you in some places. For example a "IF 1 GOTO 200" would probably result in a syntax error but could also go to the wrong line instead.
Code:
; perform IF

LAB_IF
   JSR   LAB_EVEX   ; evaluate the expression
   JSR   LAB_GBYT   ; scan memory
   CMP   #TK_THEN   ; compare with THEN token
   BEQ   LAB_174B   ; if it was THEN go do IF

            ; wasn't IF .. THEN so must be IF .. GOTO
   CMP   #TK_GOTO   ; compare with GOTO token
   BNE   LAB_16FC   ; if it wasn't GOTO go do syntax error

   LDX   Bpntrl      ; save the basic pointer low byte
   LDY   Bpntrh      ; save the basic pointer high byte
   JSR   LAB_IGBY   ; increment and scan memory
   BCS   LAB_16FC   ; if not numeric go do syntax error

   STX   Bpntrl      ; restore the basic pointer low byte
   STY   Bpntrh      ; restore the basic pointer high byte
LAB_174B

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBasic memory usage
PostPosted: Tue Jul 17, 2018 12:15 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
That's a good catch, Klaus! I changed the ROM based routine to use a CMOS addressing mode, so no Y reg is used.
Code:
; increment and scan memory
LAB_IGBY
LAB_2CEE
      INC   Bpntrl            ; increment BASIC execute pointer low byte
      BNE   LAB_GBYT          ; branch if no carry, else
      INC   Bpntrh            ; increment BASIC execute pointer high byte

; scan memory

LAB_GBYT
      LDA   (Bpntrl)            ; get byte to scan (addr set by call routine)
      CMP   #TK_ELSE          ; compare with the token for ELSE
      BEQ   LAB_2D05          ; exit if ELSE, not numeric, carry set

      CMP   #':'              ; compare with ":"
      BCS   LAB_2D05          ; exit if >= ":", not numeric, carry set

      CMP   #' '              ; compare with " "
      BEQ   LAB_2CEE          ; if " " go do next

      SEC                     ; set carry for SBC
      SBC   #'0'              ; subtract "0"
      SEC                     ; set carry for SBC
      SBC   #$D0              ; subtract -"0"
                              ; clear carry if byte = "0"-"9"
LAB_2D05
      RTS

I've no idea how much testing has been done on the 2.23 version, so I stuck with your 2.22p3 version with changes to the page zero definitions, stack floor, etc.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: