6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 9:16 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Tue Oct 01, 2019 7:27 am 
Offline

Joined: Tue Jun 19, 2018 8:28 am
Posts: 122
I am building my own 6502 based microcomputer. I am going tu put EhBasic on its EPROM.
At this point everything works. Of course I still need add load/save subroutines and as my assembly programming skill grew, I will try to add additional features (like additional commands for RTC usage).
At this point I'd like to set fixed memory size, to do not have to set it after reset. How could it be done?

My memory map:
32kB of RAM
8kB window for four RAM memory banks.
8kB memory space for I/O
16kB of EPROM

What memory size should I set? Full 32kB? 32kB minus zero page and stack?


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 01, 2019 8:35 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1398
Location: Scotland
Atlantis wrote:
I am building my own 6502 based microcomputer. I am going tu put EhBasic on its EPROM.
At this point everything works. Of course I still need add load/save subroutines and as my assembly programming skill grew, I will try to add additional features (like additional commands for RTC usage).
At this point I'd like to set fixed memory size, to do not have to set it after reset. How could it be done?

My memory map:
32kB of RAM
8kB window for four RAM memory banks.
8kB memory space for I/O
16kB of EPROM

What memory size should I set? Full 32kB? 32kB minus zero page and stack?


ehBasic traditionally probes RAM to find the top, but if you are using a 65C02 (WDC), then it's very worthwhile looking at the variant put together by floobydust here: viewtopic.php?f=5&t=5760

There are 2 simple variables to set for Ram_base and Ram_top - so in my 65C02 system, I set Base to $0E00 and Top to $8000 to fit into a 32K RAM, with the ehbasic code assembled to start at $8000, so you can adjust to suit.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 01, 2019 5:15 pm 
Offline

Joined: Tue Jun 19, 2018 8:28 am
Posts: 122
Ok, now I see that if I simply press an enter without supplying value, it simply assume default value.
If there is a way to permanently disable this question?


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 01, 2019 5:34 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1398
Location: Scotland
Atlantis wrote:
Ok, now I see that if I simply press an enter without supplying value, it simply assume default value.
If there is a way to permanently disable this question?


You have the source ... make the edit.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 02, 2019 12:39 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
Atlantis wrote:
Ok, now I see that if I simply press an enter without supplying value, it simply assume default value.
If there is a way to permanently disable this question?


If you grab my version referenced above, there’s no prompt to worry about. Just set your base and top addresses and you’re done. Also, latest version has an improved RAM test plus Load and Save vectors with some useful code... just implement Xmodem for transfer and you’re done.

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Oct 04, 2019 6:22 am 
Offline

Joined: Tue Jun 19, 2018 8:28 am
Posts: 122
floobydust wrote:
If you grab my version referenced above, there’s no prompt to worry about. Just set your base and top addresses and you’re done. Also, latest version has an improved RAM test plus Load and Save vectors with some useful code... just implement Xmodem for transfer and you’re done.


I have to admit that I am a little bit confused... This version is a little bit different from standard 2.22, which I used in my project.
1) There is no min_mon.asm file, so where to look for low level I/O subroutines? I thought they were transferred to the main basic.asm file, but there are no ACIAout and ACIAin subroutines. Were they renamed?
2) I see it doesn't assemble with acme asembler...

Maybe you could simply point me to the fragments of code responsible for skipping memory size prompt and Xmodem load/save functions? This way I could include them into my own project...


Top
 Profile  
Reply with quote  
PostPosted: Fri Oct 04, 2019 1:49 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
Atlantis wrote:
floobydust wrote:
If you grab my version referenced above, there’s no prompt to worry about. Just set your base and top addresses and you’re done. Also, latest version has an improved RAM test plus Load and Save vectors with some useful code... just implement Xmodem for transfer and you’re done.


I have to admit that I am a little bit confused... This version is a little bit different from standard 2.22, which I used in my project.
1) There is no min_mon.asm file, so where to look for low level I/O subroutines? I thought they were transferred to the main basic.asm file, but there are no ACIAout and ACIAin subroutines. Were they renamed?
2) I see it doesn't assemble with acme asembler...

Maybe you could simply point me to the fragments of code responsible for skipping memory size prompt and Xmodem load/save functions? This way I could include them into my own project...


So, here's some detail:

1- I use the WDC Assembler/Linker package, so the source has been reformatted and much cleaned up. Note that the WDC Tools are free.

2- It's now a single source file, there is NO minimal monitor code, it relies on your SBC having a BIOS for your hardware that provides at least two basic functions:
a- Get a character
b- Send a character

3- All of the vectors are soft-loaded into Page 4 ($0400) as is the input buffer. In the source file, these vectors are declared starting at line 7523. The BIOS routines (from my SBC) are shown starting at line 7548, i.e., $FF36 is get a keystroke, $FF3C is send a character to the console.

4- Memory test, show and go starts at line 527. It's fairly simple, loads/tests for $55, $AA and $00 starting at Ram_base to Ram_top.

5- Xmodem code pieces still rely on my C02 Monitor for the core Xmodem-CRC transfer. The code in the basic source file handles specifics for EhBasic, then call the monitor routines. The Xmodem code in the basic source starts at line 7514.

6- Cold and Warm start are handled by the Monitor... which simply prompts the used for Cold or Warm, then Jumps to the Basic code. Cold start is at $B000, which is start of the code assembly. Warm start is $0000, which requires that basic was Cold started earlier, else you just jump to whatever is loaded at $0000.

My updated code has all of Klaus' fixes and numerous enhancements along with a consolidated page zero usage, plus it requires less page zero use as the Chrget/Chrgot equivalent code (LAB_IGBY) is maintained in ROM and only the 2-byte pointer is maintained in page zero.

If you can provide some details for your SBC hardware, perhaps I can provide you a simple BIOS that will work. My current C02 Pocket SBC uses an older Philips/NXP SCC2691 UART and one of my older SBCs uses a common 6551 ACIA. I have full-duplex interrupt-driven and buffered BIOS code to run either chip as a console.

I'll be posting an updated BIOS/Monitor for my current C02 Pocket SBC shortly. The BIOS (and hardware page) take less than 1KB and the Monitor just a tad less than 5KB and is quite rich in function. It also requires the WDC Tools package to assemble and link.

Hope this helps....

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


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 06, 2019 12:37 am 
Offline

Joined: Sun Feb 22, 2004 9:01 pm
Posts: 78
I maintain a parallel fork of EhBasic where almost everything that is specific to a particular target is stripped out and placed in a separate monXXX.asm file, so to target a different platform you can leave the Basic interpreter code untouched and simply write a new monXXX.asm file. I've just updated it with the latest v2.22p4 updates.

For the OP's original question, copy one of the monXXX.asm files and update it. From what you posted I'm guessing:

$0000-$7FFF 32kB of RAM, $00xx=zero page, $01xx=stack, $0200 upwards: fully free
$8000-$9FFF 8kB window for four RAM memory banks.
$A000-$BFFF 8kB memory space for I/O
$C000-$FFFF 16kB of EPROM

So:
Code:
.define    TARGET   your_target_name

BREAK    =$1B   ; Code of keypress to interrupt program
MEMBOT   =$0300 ; Bottom of memory to test for presence of RAM
MEMTOP   =$8000 ; Top of memory to test for presence of RAM
ZPSTART  =$00   ; Start of zero page workspace
ZPEND    =$8F   ; End of zero page workspace
ZPROUT   =0     ; No subroutines in zero page
WSSTART  =$0200 ; You need one page of fixed workspace
CODESTART=$C000 ; Is this where your ROM is?

Then update MON_INIT for any target-specific initialisation you need to do, and write routines for your target to do Check for keypress, Character output, program load, and program save.

If you want the system to supply the memory size instead of asking the user, use:
Code:
MEMBOT   =$0    ; Ask monitor for bottom of memory
MEMTOP   =$0    ; Ask monitor for top of memory
and have a routine in the monXXX.asm file MON_LIMITS that sets the memory size, eg:
Code:
MON_LIMITS
LDY   #$80   ; Top of memory at $8000
LDX   #$00
STX   Ememl  ; set end of mem low byte
STY   Ememh  ; set end of mem high byte
STX   Sstorl ; set bottom of string space low byte
STY   Sstorh ; set bottom of string space high byte
LDY   #$03   ; Bottom of memory at $0300
LDX   #$00
STX   Smeml  ; save start of mem low byte
STY   Smemh  ; save start of mem high byte
RTS

_________________
--
JGH - http://mdfs.net


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 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: