6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 16, 2024 2:57 pm

All times are UTC




Post new topic Reply to topic  [ 67 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
PostPosted: Fri Jul 12, 2013 6:51 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8541
Location: Southern California
Quote:
BTW, what is the memory footprint of your minimal Forth setup?

It's in quite a few files so that someone who doesn't want the extensions for math or prioritized interrupts & alarms or time & date functions or assembler for example could leave them out simply by commenting out the relevant INCL lines (one for each file you want to leave out). I never tried a minimum version to see. The whole thing is about 24K IIRC, so maybe the minium would be about half of that. It is rather complete though, with oodles of functions I never saw in free versions. Wally Daniels (a forum member we have not heard from in a long time) used it in his work in the Pratt & Whitney turbine-engine plant in Nova Scotia, using a 65265 '816-based µC. I should ask him how much ROM space he used. I did the '816 Forth in a rather dead time of my work in the 1990's and I know it has been a disservice to the community to not finish cleaning it up to publish, but now that I have a website it's on my list of things to do. I also want to make the few changes needed for a RAM version, and then do the equivalent for my 65c02 Forth but that will take even more time, for a few reasons.

Quote:
Forth is a heck of a lot more useful than any monitor...

Yes, and actually I seldom have any reason to run the assembler on the PC anymore. When I do, I can send the hex file over the RS-232 line to the workbench computer. Otherwise I normally send source code over the line to the workbench computer which then compiles, assembles, or interprets it on the fly, as appropriate, which gives the option to try just a line or a routine at a time with instant turnaround instead of having to re-assemble the whole application every time you make a small change.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 12, 2013 11:44 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
Happy to report a success - I added a binary load command to Daryl's monitor and loaded my first program!

Many thanks for all the help to everyone, especially Daryl.
Code:
Load_cmd        jsr   ACIA1_Input       ;receive low destination
                sta   Startaddr
                jsr   ACIA1_Input       ;receive high destination
                sta   Startaddr_H
                jsr   ACIA1_Input       ;receive low count
                sta   Addrptr           
                jsr   ACIA1_Input       ;receive high count
                clc
                adc   #1                ;dec loop requires +1
                sta   Addrptr_H     
                ldx   #0
Load_cmd1       jsr   ACIA1_Input       ;grab a byte
                sta   (Startaddr,x)     ;put it where it belongs
                inc   Startaddr         ; low++
                bne   Load_cmd2         ;
                inc   Startaddr_H       ; high++
Load_cmd2       dec   Addrptr           ;dec low count
                bne   Load_cmd1         ;
                dec   Addrptr_H         ;dec hi count
                bne   Load_cmd1         ;and more bytes
                rts

My 6502 skills are rusty, but I think it's correct.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 13, 2013 1:27 am 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 411
Location: Minnesota
Quote:
My 6502 skills are rusty, but I think it's correct.


I think you might have a problem with any count of the form 'xx00'. If I understand the code correctly, counts with a low byte of zero will try to read an extra 256 bytes.

Here's another crack at it:

Code:
Load_cmd        jsr   ACIA1_Input       ;receive low destination
                sta   Startaddr
                jsr   ACIA1_Input       ;receive high destination
                sta   Startaddr_H
                jsr   ACIA1_Input       ;receive low count
                sta   Addrptr           
                jsr   ACIA1_Input       ;receive high count
                sta   Addrptr_H
                ldx   #0
                beq   Load_cmd3

Load_cmd1       dec   Addrptr_H
Load_cmd2       dec   Addrptr
                jsr   ACIA1_Input       ;grab a byte
                sta   (Startaddr,x)     ;put it where it belongs
                inc   Startaddr         ; low++
                bne   Load_cmd3         ;
                inc   Startaddr_H       ; high++
Load_cmd3       lda   Addrptr
                bne   Load_cmd2
                lda   Addrptr_H
                bne   Load_cmd1
                rts


I cannot believe how many times I had to test $0000, $0001, and $0100 before I got this to come out right (I think!).


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 13, 2013 2:00 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
I was having a hard time with it, and am not too surprised I missed a case. Since the carry flag is not set by the 'dec' instruction, counting down is surprisingly tricky. 'inc' works out ok - when low byte is 0 we want to increment the high byte...

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 25, 2017 1:23 pm 
Offline

Joined: Fri Jul 21, 2017 8:16 pm
Posts: 59
As I want to have a monitor program in my 65C02 SBC I wonder if this thread is still valid.
I would like to habe a simple monitor program like the WOZ Monitor which allows me to send Hex values to address in RAm and start a program.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 25, 2017 7:47 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8541
Location: Southern California
nei02 wrote:
I wonder if this thread is still valid.

All topics are valid indefinitely. Projects here may go for many years in their improvements and refinements, if not the original build itself. Some people think that just because it's old, they have to start a new one about the same thing. It's better to keep it all in one place. Also, the most appropriate people, those who posted in the same topic before, will get email notifications that you replied, if you keep it all in the same place.

Moderator

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 26, 2017 7:51 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
teamtempest wrote:
Here's another crack at it:


We have a couple of registers available, why not use them? And we can complement the count to shave some cycles (untested):

Code:
Load_cmd        jsr   ACIA1_Input       ;receive low destination
                tay
                jsr   ACIA1_Input       ;receive high destination
                sta   Startaddr_H
                jsr   ACIA1_Input       ;receive low count
                eor   #-1
                tax           
                jsr   ACIA1_Input       ;receive high count
                eor   #-1               ;complement count to
                sta   Addrptr_H         ;  improve throughput
                lda   #0
                sta   Startaddr
                beq   Load_cmd3

Load_cmd2       jsr   ACIA1_Input       ;grab a byte
                sta   (Startaddr),y     ;put it where it belongs
                iny                     ; low++
                bne   Load_cmd3         ;
                inc   Startaddr_H       ; high++
Load_cmd3       inx
                bne   Load_cmd2
                inc   Addrptr_H
                bne   Load_cmd2
              ; sty   Startaddr         ; only if needed elsewhere
                rts


Mike B.


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

All times are UTC


Who is online

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