6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Sep 18, 2024 11:27 pm

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Wed Sep 18, 2013 12:22 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
After moving the IO page of my CHOCHI boards to page 2 (to gain more contiguous RAM), I broke FIG-FORTH.

I fixed the IO, and Forth starts up, prints "fig-FORTH 1.0"<cr> as usual. After that, hitting keys just echoes and crashes (hitting enter scrolls pretty far before locking up).

I suspect that page 2 is used for some buffer somewhere, and will start searching now. Although I hope someone who knows will set me straight before I waste too much time...Thanks

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 1:40 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Dunno if this'll help, but I dragged out a version of FIG Forth that I was running last year on the Kowalski simulator. At the time I had to tweak it to get it to assemble & run, although I don't recall all the reasons. Anyway, the following excerpt seems pertinent. Note I wasn't relocating Forth, merely trying to get it to run at $0200 & up. The first and last line of this excerpt have been tweaked.

Changing the ORG statement should let you relocate, to $0300 for example. Does this make sense, or am I not grasping the problem? Are you able to tell us where the header for LIT is located? Better yet, at what address does the label ENTER appear?

Code:
          .ORG $0200 ;tweak. Was:          *=*+2
;
                         ; User cold entry point
ENTER     NOP            ; Vector to COLD entry
          JMP COLD+2     ;
REENTR    NOP            ; User Warm entry point
          JMP WARM       ; Vector to WARM entry
          .WORD $0004    ; 6502 in radix-36
          .WORD $5ED2    ;
          .WORD NTOP     ; Name address of MON
          .WORD $7F      ; Backspace Character
          .WORD UAREA    ; Initial User Area
          .WORD TOS      ; Initial Top of Stack
          .WORD $1FF     ; Initial Top of Return Stack
          .WORD TIBX     ; Initial terminal input buffer
;
;
          .WORD 31       ; Initial name field width
          .WORD 0        ; 0=nod disk, 1=disk
          .WORD TOP      ; Initial fence address
          .WORD TOP      ; Initial top of dictionary
          .WORD VL0      ; Initial Vocabulary link ptr.
;
;    The following offset adjusts all code fields to avoid an
;    address ending $XXFF. This must be checked and altered on
;    any alteration , for the indirect jump at W-1 to operate !
;
         *=*+2 ;tweak  was: .ORIGIN *+2 whereas my Fig listing says *=*+2

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Wed Sep 18, 2013 1:50 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 1:49 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
My copy starts at $400
Code:
TIBX            =     $0100             ;terminal input buffer of 84 bytes.
ORIG            =     $0400             ;origin of FORTH's Dictionary.

It assembles fine, and the listing looks right. But it crashes after the initial prompt on keyboard input. I am at a bit of a loss, will have to look some more.

Oh, as for LIT:
Code:
0448 : 834c49d4         L22             db    $83,"LI",$D4      ;<--- name fie
                        ;                          <----- link field
044c : 0000                             dw    00                ;last link mar
044e : 5004             LIT             dw    *+2               ;<----- code a
0450 : b1af                             lda   (IP),y            ;<----- start

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 2:07 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Strange! So you're saying this works
Code:
ORIG            =     $0200             ;origin of FORTH's Dictionary.

and this doesn't? No other changes?
Code:
ORIG            =     $0400             ;origin of FORTH's Dictionary.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 2:53 am 
Offline

Joined: Sun Jul 28, 2013 12:59 am
Posts: 235
enso wrote:
My copy starts at $400
Code:
TIBX            =     $0100             ;terminal input buffer of 84 bytes.
ORIG            =     $0400             ;origin of FORTH's Dictionary.

It assembles fine, and the listing looks right. But it crashes after the initial prompt on keyboard input. I am at a bit of a loss, will have to look some more.


The first thing that comes to mind for me is that your TIB overlaps your stack space, and thus you should double-check your stack pointer... Or just relocate the TIB to $300, so as to avoid both your stack space and your I/O page.


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 3:43 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
It's actually a little different: $400 was always the bottom of the system. Previously my IO page was at $C000, and it worked. Now my IO page is at $200 (it should be OK there as nothing else sits there), and it doesn't work. The fact that it spits gobs of stuff to the serial port indicates that something is stepping on page 2.

TIB was always at $100, and the comments indicate that it uses the bottom 84 bytes, leaving plenty of room for the stack, so it shouldn't matter.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 3:49 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Quote:
Now my IO page is at $200
Any chance the IO page is larger than it ought to be? (Might it extend past $0400 I mean.)

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 3:58 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8508
Location: Southern California
My cheap debugging strategy is at http://wilsonminesco.com/6502primer/debug.html, in "Part II, Software." I would just start putting in a beep in different places to see if it gets there before crashing. It it takes a minute or two for each try (re-assembling and putting the new image in your memory), that still gets you 15 tries in 15-30 minutes. 15 tries should be more than enough. It's how I got my '816 Forth and loads of other things going.

_________________
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: Wed Sep 18, 2013 5:33 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
The IO page is only 16 bytes long currently.

I'll do some more debugging tomorrow. I usually do thing similar to Garth's approach. I have an LED if the IO port fails.

It only takes a few seconds to reassemble and load code.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 4:05 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
I think the problem is with my address decoding (damaged while moving the IO address). Will work on the memory test.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 18, 2013 9:35 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
It was my issue after all. Back to working order. Thanks for all answers.

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 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: