Looking at the fig-FORTH listing, I see two different methods used for taking 2 values off the stack and replacing them with a single value. For example, PLUS uses this method:
PLUS CLC
LDA 0,X
ADC 2,X
STA 2,X
LDA 1,X
ADC 3,X
STA 3,X
INX
INX
JMP NEXT
while other operations like AND, etc ...
Search found 7 matches
- Thu Jan 18, 2024 10:30 pm
- Forum: Forth
- Topic: PUTing number on tos in fig-FORTH
- Replies: 5
- Views: 2829
- Sun Jan 14, 2024 9:05 pm
- Forum: Programming
- Topic: JMP(nn) - indirect JMP question
- Replies: 14
- Views: 7741
Re: JMP(nn) - indirect JMP question
When executing a JMP (nn) the cpu goes to the address nn and nn+1, takes the two bytes there and puts them on the PC (in other words nn and nn+1 contain the address of the next instruction to be executed).
Possibly what you want to do is simply:
JMP ($1000)
or alternatively:
lda $1000
sta ...
Possibly what you want to do is simply:
JMP ($1000)
or alternatively:
lda $1000
sta ...
- Sat Jan 13, 2024 8:40 pm
- Forum: Programming
- Topic: JMP(nn) - indirect JMP question
- Replies: 14
- Views: 7741
Re: JMP(nn) - indirect JMP question
I'm going to try this later (when I finish the honey-do list my wife just gave me). I'll have to change DOCOL too, but I think SEMIS can stay the same. Don't really want to use a JSR then pop and adjust the return pointer :)
;
;$95 NEXT: LDA IP
;$97 CLC
;$98 ADC #2
;$9A BCC NNINC
;$9C INC IP+1
;$9E ...
;
;$95 NEXT: LDA IP
;$97 CLC
;$98 ADC #2
;$9A BCC NNINC
;$9C INC IP+1
;$9E ...
- Sat Jan 13, 2024 6:51 am
- Forum: Programming
- Topic: JMP(nn) - indirect JMP question
- Replies: 14
- Views: 7741
Re: JMP(nn) - indirect JMP question
I'm trying to figure out how to get rid of the need for W in a FORTH system without using JSR to get into DOCOL or making it completely subroutine threaded. Thinking about your answer, I realize double indirection is what I'm looking for - just didn't know what it's called. I also understand now why ...
- Sat Jan 13, 2024 5:35 am
- Forum: Programming
- Topic: JMP(nn) - indirect JMP question
- Replies: 14
- Views: 7741
JMP(nn) - indirect JMP question
Hoping someone will explain what I'm missing in understanding how indirect JMPs work. For example:
target =$85
.org $200
LDA #0
STA target
LDA #10
STA target+1
...
JMP (target)
...
$1000 .WORD real_destination ; say real_destination is located at $2500
...
real_destination: ...
The way I read ...
target =$85
.org $200
LDA #0
STA target
LDA #10
STA target+1
...
JMP (target)
...
$1000 .WORD real_destination ; say real_destination is located at $2500
...
real_destination: ...
The way I read ...
- Thu Dec 28, 2023 5:19 pm
- Forum: Programming
- Topic: Need help with Kowalski assembler syntax
- Replies: 3
- Views: 1576
Re: Need help with Kowalski assembler syntax
Hi Daryl,
I'm using version 1.3.4.7 and... I found out the problem was my fault. Playing around with it some more after I posted, I found that
putting .BYTE <somefunction_ before the routines gave the expected result, but putting it after didn't. Then after sleeping on it, I "noticed"
that I had ...
I'm using version 1.3.4.7 and... I found out the problem was my fault. Playing around with it some more after I posted, I found that
putting .BYTE <somefunction_ before the routines gave the expected result, but putting it after didn't. Then after sleeping on it, I "noticed"
that I had ...
- Thu Dec 28, 2023 6:50 am
- Forum: Programming
- Topic: Need help with Kowalski assembler syntax
- Replies: 3
- Views: 1576
Need help with Kowalski assembler syntax
I'm trying to have the assembler populate an 8-bit jump table and I can't figure out the correct syntax. I want it to put the low order address byte of a group of routines. This is what I'm trying:
< My routines >
routine_1 (first line of code) A0 00 ; assembles to $0420
(more lines of code) E6 00 ...
< My routines >
routine_1 (first line of code) A0 00 ; assembles to $0420
(more lines of code) E6 00 ...