I'm trying to use some code written in ASM which contains strange opcode.
It's about :
PIC16F88
;-----------------------
; Q1 * COEFF
; moltiplicatore
MOVFW Q_UNO ;MOVLW 0X02
MOVFW does not work with GCB, while compiling correctly with MICROCHIP ASM.
It seems that it is possible to replace with: MOVLW Q_UNO ;
Can you confirm that this is correct?
Last edit: Gigi 2025-01-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
MOVWL is the simplest form or Move as the value is Literal
So MOVLW 0X02 Loads the Value 0x02 (00000010) into the W register.
MOVFW 0x02 would load the value at address 0x02 into the W register.
But I am no closer to solving your problem and I can't read Italian, other than a Restaurant Menu ;>)
Last edit: Chris Roper 2025-01-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm working on it, but going step by step, I'll leave most of it written in ASM otherwise the timing doesn't allow for alternatives.
So I have to fix MOVFW which is not accepted by GCB.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hold on.... where is MOVFW in the 16F88 datasheet? It may be part of ASM but it needs to be valid. So, it should not be in CORE16.DAT
Yes, MOVFW (Move F to W) is supported on the PIC16F88. It's one of the basic data movement instructions available in the PIC16F88's instruction set.
However, it's worth noting that in the PIC16F88's documentation and most PIC assembly language contexts, this instruction is typically written as "MOVF f,W" rather than "MOVFW". They are functionally identical - both move data from a file register to the W register.
The syntax would be:
MOVF f,W ; Move contents of register f to W
This is because MOVF is a more versatile instruction that can move data either:
From register to W (MOVF f,W)
Or back to the same register (MOVF f,F) which is useful for testing a register's value
So while the operation you want (moving from F to W) is definitely supported on the PIC16F88, you'll want to use the MOVF f,W syntax in your code for this microcontroller.
Change them all.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, now I'll do some testing, I prefer the macro if it works without modifying the CORE FILE (it always scares me to touch something that has always worked well).
Surely there will still be something that causes problems and I will still need help with the .gcb file
Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is the result, from the GCB file everything seems fine, I have doubts about the variables, but I will have to try it in the real world, do you have any advice?
I would revise the memeory allocation of all the variables to the same assignment as in the original ASM. The issue that would concern is that the page addressing is non existent and the original ASM made assumptions about the addresses.
So, use Dim myVar as Byte at 0x20 - for the variables. The source of the address is the CBLOCK.
You MUST remove the RETFIE from the Interrupt routine. The Interrupt routine is exiting half way thru the GCBASIC interrupt handler. The state of the restored registers in currently incorrect.
Last edit: Anobium 2025-01-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, after various tests I saw that some registers are modified which are probably used by GCB and many parts would have to be rewritten and this is not convenient.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The ASM is actaully very simple. It is doing some maths ( badly ) makes a lot assumptions about memory and paging. I am not surprised it does not work.
Rewrite in GCBASIC to make it portable. :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to use some code written in ASM which contains strange opcode.
It's about :
PIC16F88
;-----------------------
; Q1 * COEFF
; moltiplicatore
MOVFW Q_UNO ;MOVLW 0X02
MOVFW does not work with GCB, while compiling correctly with MICROCHIP ASM.
It seems that it is possible to replace with: MOVLW Q_UNO ;
Can you confirm that this is correct?
Last edit: Gigi 2025-01-13
I would need see the a little more context. Chip? The ASM?
I am a bit rusty but I think the ASM as code reads as follows:
Read a byte from a memory location with the label Q_UNO into the W Register
Write the W register to Memory location 0x02.
So all you are doing is copying a Byte Value from one location to another.
I am hesitant as I am not 100% sure about the MOVLW mnemonic.
Is it possibly a relative address as opposed to MOVWF?
Last edit: Chris Roper 2025-01-13
It is a CTSS tone recognition algorithm with adc, a little complicated comments in Italian.
PIC16F88
Just dusted off my ASM knowledge.
MOVWL is the simplest form or Move as the value is Literal
So MOVLW 0X02 Loads the Value 0x02 (00000010) into the W register.
MOVFW 0x02 would load the value at address 0x02 into the W register.
But I am no closer to solving your problem and I can't read Italian, other than a Restaurant Menu ;>)
Last edit: Chris Roper 2025-01-13
Where is the port to GCB ? The ASM will not compile in GCBASIC but I am sure you have ported.
I'm working on it, but going step by step, I'll leave most of it written in ASM otherwise the timing doesn't allow for alternatives.
So I have to fix MOVFW which is not accepted by GCB.
So, what is the target chip?
Before I explain re MOVFW support.
Always the PIC16F88, if GCB can't digest MOVFW I have to abandon.
Searching I found the solution:
MOVFW adr = MOVF adr,W
Is it possible to create a macro or do I have to replace everything by hand?
Macro MOVFW ( in adr )
MOVF adr, W
End macro
Well I cannot resolve without some source.
I think this is doable. We have to update the chip family description.
Try this
Edit CHIPDATA\CORE14.DAT, add the following after the MOVWF f; 1; 00 0000 1fff ffff
MOVFW f; 1; 00 0000 1fff ffff
Evan
Change the CORE file. I do not think that macro works as you expect.
If you inspect the LST file from MPASM and GCASM, after the CORE change - is it the same instruction?
The CORE binary value has to match the MPASM description. I may have this incorrect.
Last edit: Anobium 2025-01-13
Hold on.... where is MOVFW in the 16F88 datasheet? It may be part of ASM but it needs to be valid. So, it should not be in CORE16.DAT
Yes, MOVFW (Move F to W) is supported on the PIC16F88. It's one of the basic data movement instructions available in the PIC16F88's instruction set.
However, it's worth noting that in the PIC16F88's documentation and most PIC assembly language contexts, this instruction is typically written as "MOVF f,W" rather than "MOVFW". They are functionally identical - both move data from a file register to the W register.
The syntax would be:
MOVF f,W ; Move contents of register f to W
This is because MOVF is a more versatile instruction that can move data either:
So while the operation you want (moving from F to W) is definitely supported on the PIC16F88, you'll want to use the MOVF f,W syntax in your code for this microcontroller.
Change them all.
Yes, now I'll do some testing, I prefer the macro if it works without modifying the CORE FILE (it always scares me to touch something that has always worked well).
Surely there will still be something that causes problems and I will still need help with the .gcb file
Thank you
The macro works perfectly, generated hex is the same trying both opcodes.
Excellent!!!
This is the result, from the GCB file everything seems fine, I have doubts about the variables, but I will have to try it in the real world, do you have any advice?
I would revise the memeory allocation of all the variables to the same assignment as in the original ASM. The issue that would concern is that the page addressing is non existent and the original ASM made assumptions about the addresses.
So, use Dim myVar as Byte at 0x20 - for the variables. The source of the address is the CBLOCK.
You MUST remove the RETFIE from the Interrupt routine. The Interrupt routine is exiting half way thru the GCBASIC interrupt handler. The state of the restored registers in currently incorrect.
Last edit: Anobium 2025-01-14
Unfortunately, after various tests I saw that some registers are modified which are probably used by GCB and many parts would have to be rewritten and this is not convenient.
The ASM is actaully very simple. It is doing some maths ( badly ) makes a lot assumptions about memory and paging. I am not surprised it does not work.
Rewrite in GCBASIC to make it portable. :-)