6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Jul 06, 2024 5:14 pm

All times are UTC




Post new topic Reply to topic  [ 94 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: Help using cc65
PostPosted: Tue Mar 07, 2017 9:06 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10838
Location: England
(Just to recap, the machine you've built is the Loom homebrew from http://www.loomcom.com/projects/6502/ and it has a corresponding emulator called symon at https://github.com/sethm/symon/ which comes with samples at https://github.com/sethm/symon/tree/master/samples)


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Tue Mar 07, 2017 9:16 pm 
Offline

Joined: Sun Mar 05, 2017 4:31 pm
Posts: 36
Yes, that's the one... I feel stupid for not looking into the symon simulator files more now.. I saw it was made to run on a mac, so i immediately turned away.
I was looking for how to make a monitor and a port of ehBASIC, but all this time, it was just right there.
So now comes the task of assembling it, and getting it on my system though. I would like to use ca65 for this, as the code is made to be used with this assembler.
How should i proceed ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 6:02 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8249
Location: Midwestern USA
sepseel wrote:
ERROR E037: Unrecognized instruction/directive/macro name. ROW 8

ROW 8: .feature labels_without_colons

The Kowalski assembler is agnostic about labels terminated with a colon. As Ed suggested, comment out that pseudo-op, as it has no relevance.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 6:41 am 
Offline

Joined: Fri Apr 15, 2016 1:03 am
Posts: 136
To build Symon EhBasic ( https://github.com/sethm/symon/tree/mas ... es/ehbasic ) for your hardware:

Here is a short summary of the info there.

Copy the files from the site:
Makefile = control file for the "Make" build utility - lists the commands to make EhBasic
Readme.txt = useful information
basic.asm = EhBasic code (included by min_mon.asm)
min_mon.asm = console character I/O, a simple Cold/Warm startup program, & interrupt routines.
symon.config = information about where to place things for LD65

Doing by hand the commands that "make" would do. (Fix the cc65 command paths to fit your system)
..\cc65\bin\ca65 --listing ehbasic.lst -o ehbasic.o min_mon.asm
..\cc65\bin\ld65 -C symon.config -vm -m ehbasic.map -o ehbasic.rom ehbasic.o

ehbasic.rom now contains 16KBytes to put into your EEPROM at $c000 thru $ffff
I think you said that you have an 8KByte EEPROM currently; ehbasic.rom won't fit, you'll need a >=16KByte one, or wire up 2 8KByte ones.

I assume that your ACIA address matches the one mentioned in min_mon.asm .

Hopefully most of min_mon.asm makes sense to you. Starting at RES_vec, it sets up the machine, then starts printing strings to the console on the ACIA, then gets a character from the console on the ACIA. If something goes wrong, your next step will probably be single-stepping your machine through this to see where it goes wrong.


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 6:19 pm 
Offline

Joined: Sun Mar 05, 2017 4:31 pm
Posts: 36
I read through the code of min_mon and I feel like I'm starting to understand it, I even added my own line to the sign on string.

Since the rom image containing the min_mon and ehBASIC is too big for my current ROM chip, I would like to try to just upload the min_mon. What command would I use to assemble it using ca65 ?
Btw, I'm using the windows executable files, found on this page: http://cc65.github.io/cc65/


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 7:38 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10838
Location: England
I had a bit of a hack to make a basic-free version of min_mon - I haven't tried to run this, but it did assemble cleanly!

This is in the form of a context diff - you can use the 'patch' utility to apply it, or just figure it out:
Code:
*** min_mon.asm.orig   2017-03-08 19:20:15.000000000 +0000
--- min_mon.asm   2017-03-08 19:34:56.000000000 +0000
***************
*** 6,12 ****
  ; will do nothing, you'll still have to do a reset to run the code.
 
     .feature labels_without_colons
!    .include "basic.asm"
 
  ; put the IRQ and MNI code in RAM so that it can be changed
 
--- 6,29 ----
  ; will do nothing, you'll still have to do a reset to run the code.
 
     .feature labels_without_colons
! ;   .include "basic.asm"   
! ; some things which basic.asm would have given us
! ; as dummy values - see also some stub code at the end of this file
!    NmiBase=$fd
!    IrqBase=$fd
!    LAB_WARM=$fd
!    LAB_COLD=$fd
!
!    ccflag      = $0200   ; BASIC CTRL-C flag, 00 = enabled, 01 = dis
!    ccbyte      = ccflag+1 ; BASIC CTRL-C byte
!    ccnull      = ccbyte+1 ; BASIC CTRL-C byte timeout
!
!    VEC_CC      = ccnull+1 ; ctrl c check vector
!
!    VEC_IN      = VEC_CC+2 ; input vector
!    VEC_OUT      = VEC_IN+2 ; output vector
!    VEC_LD      = VEC_OUT+2 ; load vector
!    VEC_SV      = VEC_LD+2  ; save vector
 
  ; put the IRQ and MNI code in RAM so that it can be changed
 
***************
*** 154,159 ****
--- 171,181 ----
     .byte   $0D,$0A,"Enhanced 6502 BASIC 2.22 (c) Lee Davison"
     .byte   $0D,$0A,"[C]old/[W]arm ?",$00
 
+ ; some things which basic.asm would have given us
+ V_INPT
+    JMP   (VEC_IN)        ; non halting scan input device
+ V_OUTP
+    JMP   (VEC_OUT)   ; send byte to output device
 
  ; system vectors
 


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 7:49 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10838
Location: England
As for building, I noodled the config file and this appeared to work:

Code:
$ cat symon.config
MEMORY {
RAM1: start = $0000, size = $8000 - $0300;
ROM1: start = $C000, size = $3F00, fill = yes;
MONITOR: start = $FF00, size = $FA, fill = yes;
ROMV: start = $FFFA, size = $6, file = %O, fill = yes;
}

SEGMENTS {
CODE:     load = ROM1, type = ro;
DATA:     load = ROM1, type = ro;
MONITOR:  load = MONITOR, type = ro;
VECTORS:  load = ROMV, type = ro;
}


$ ca65 -l min_mon.asm
$ cl65 min_mon.o -C symon.config --target none --start-addr 0xFF00 -o min_mon.bin


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 9:26 pm 
Offline

Joined: Sun Mar 05, 2017 4:31 pm
Posts: 36
Thank you for taking the time to modify the code !!!

Using the bash shell on windows I used the make command to build cc65.
Should I put both ca65 and cl65 from the newly created bin folder in the same directory as min_mon.asm and symon.config to run the commands you put at the end of the new config file ?
Because when I do this I get an error back saying:

ca65: command not found.

What am I doing wrong here ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 9:28 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10838
Location: England
Check back in the thread...
viewtopic.php?p=51119#p51119


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 9:38 pm 
Offline

Joined: Sun Mar 05, 2017 4:31 pm
Posts: 36
Oh, I see.
Now it says: No input files.
While when I list all the files I can clearly see it.
Where should min_mon.asm and symon.config be ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Wed Mar 08, 2017 10:03 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10838
Location: England
you might need to fiddle about to get the files you've manipulated in windows to be in the right place for the bash shell to see them - I have no experience!


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Thu Mar 09, 2017 1:52 pm 
Offline

Joined: Sun Mar 05, 2017 4:31 pm
Posts: 36
I figured it out, well not really, I just just the windows executable files and dragged the min_mon.asm file over it, and it worked. After this I could just use the second command without problems !


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Thu Mar 09, 2017 2:25 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10838
Location: England
Excellent!


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Thu Mar 09, 2017 3:04 pm 
Offline

Joined: Sun Mar 05, 2017 4:31 pm
Posts: 36
My next question would be, where do I put this on my ROM chip, at the beginning, or the end ? Because when I look at other preassembled images I find the ROM at the bottom.


Top
 Profile  
Reply with quote  
 Post subject: Re: Help using cc65
PostPosted: Thu Mar 09, 2017 4:40 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10838
Location: England
There are two things you have to arrange:
- that the 6 bytes of vector info are seen by the 6502 at the top of memory (FFFA to FFFF)
- that the vectors (at least, the reset vector) points to the reset routine in your ROM

You might arrange these by how you write the code, or how you configure the linker, or how you do the programming - you just have to be sure they all line up.

In your case, I think the ROM is an 8k device mapped at C000 [which is a 16k area]. So, if you have an 8k image, there's only one thing you can do. If you have a 2k image, and you need to get the last 6 bytes to the top of memory, there's again only one way to do it.

[See downthread for more helpful explanation]

Edit: oops, 8k device, not 16k.
Edit edit: double oops, 8k device, possibly, in a 16k slot.


Last edited by BigEd on Thu Mar 09, 2017 6:31 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 94 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC


Who is online

Users browsing this forum: 4Dimensional and 0 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: