mBasic, mC and mPascal needs procedures and functions that accept passages with Registers, bit's and or constant for initialization of devices. Or not?
Speaks serious mikroEletronica team. Help the programmer to have easiness in the development.
I believe that this platforms Basic, Pascal and C is for RISC and not for others.
regards.
More power for languages.
Re: More power for languages.
Please give us an example of what you want to do. I am not sure that I understand.
See belowMAN wrote:Hi ZRistic;
I refer to the largest use of direct than indirect address.
If it is possible.
Code: Select all
Sub Procedure pTeste(Dim Byref pPORT as Byte, Dim P0, P1 as Byte)
setBit(pPORT,P0)
SetBit(pPORT,P1)
'++++++++++++++++++++++++++++++++++++++++++++++++
'Here is the code produced for the routine above
'Writing in mBasic Lang.
'This routine work perfectly, but it is big
'for some applications that use low clock frequency.
'and my idea would be to turn it more short.
'++++++++++++++++++++++++++++++++++++++++++++++++
'; ADDRESS OPCODE ASM
'; ----------------------------------------------
'$0000 $2835 GOTO _main
'$0004 $ _pteste:
';teste.pbas,354 :: Sub Procedure pTeste(Dim Byref pPORT as Byte, Dim P0, P1 as Byte)
';teste.pbas,357 :: setBit(pPORT,P0)
'$0004 $3001 MOVLW 1
'$0005 $1303 BCF STATUS, RP1
'$0006 $1283 BCF STATUS, RP0
'$0007 $00F2 MOVWF STACK_2
'$0008 $0821 MOVF FARG_pTeste+1, 0
'$0009 $00F0 MOVWF STACK_0
'$000A $0872 MOVF STACK_2, 0
'$000B $00F1 MOVWF STACK_1
'$000C $0870 MOVF STACK_0, 0
'$000D $ L_pTeste_0:
'$000D $1903 BTFSC STATUS, Z
'$000E $2813 GOTO L_pTeste_1
'$000F $0DF1 RLF STACK_1, 1
'$0010 $1071 BCF STACK_1, 0
'$0011 $3FFF ADDLW 255
'$0012 $280D GOTO L_pTeste_0
'$0013 $ L_pTeste_1:
'$0013 $0820 MOVF FARG_pTeste, 0
'$0014 $0084 MOVWF FSR
'$0015 $0800 MOVF INDF, 0
'$0016 $00F0 MOVWF STACK_0
'$0017 $0871 MOVF STACK_1, 0
'$0018 $04F0 IORWF STACK_0, 1
'$0019 $0820 MOVF FARG_pTeste, 0
'$001A $0084 MOVWF FSR
'$001B $0870 MOVF STACK_0, 0
'$001C $0080 MOVWF INDF
';teste.pbas,358 :: SetBit(pPORT,P1)
'$001D $3001 MOVLW 1
'$001E $00F2 MOVWF STACK_2
'$001F $0822 MOVF FARG_pTeste+2, 0
'$0020 $00F0 MOVWF STACK_0
'$0021 $0872 MOVF STACK_2, 0
'$0022 $00F1 MOVWF STACK_1
'$0023 $0870 MOVF STACK_0, 0
'$0024 $ L_pTeste_2:
'$0024 $1903 BTFSC STATUS, Z
'$0025 $282A GOTO L_pTeste_3
'$0026 $0DF1 RLF STACK_1, 1
'$0027 $1071 BCF STACK_1, 0
'$0028 $3FFF ADDLW 255
'$0029 $2824 GOTO L_pTeste_2
'$002A $ L_pTeste_3:
'$002A $0820 MOVF FARG_pTeste, 0
'$002B $0084 MOVWF FSR
'$002C $0800 MOVF INDF, 0
'$002D $00F0 MOVWF STACK_0
'$002E $0871 MOVF STACK_1, 0
'$002F $04F0 IORWF STACK_0, 1
'$0030 $0820 MOVF FARG_pTeste, 0
'$0031 $0084 MOVWF FSR
'$0032 $0870 MOVF STACK_0, 0
'$0033 $0080 MOVWF INDF
'$0034 $ teste_L_0:
'$0034 $0008 RETURN
End Sub
'+++++++++++++++++++++++++++++++++++++++++++++++++++
' Here is the prototype idea for two new add type's
' The idea consists in the fact of add two types
' that differentiate the SFR's of RAM registers and
' create a type Bit for some particular applications.
'
' In this case the Dim Keyword is not write in
' procedure or function because the identifier's
' have a new type and the compiler now
' treat this different and forces the compiler
' write the code orientated to directly address.
' If any identifier is not declared as type REG(SFR) or
' Bit the compiler won't accept it because has to be
' previously declared as Global Type.
'
' I think if this be taken serious, the platform
' it will be much more powerful.
'Const EN1 = 12
'Dim STACK_n as Byte
'Dim pPORT as REG or SFR 'valid only for SFR's, the compiler know all SFR's.
'if a register different of SFR's is passed the
'compiler Warning message "Expected 'Dim'.
'Dim P0, P1 as Bit 'Bit is the bit number(0-7..) and not bit value(0-1)
'if the value of bit is larger than range
'the compiler will Warning.
'+++++++++++++++++++++++++++++++++++++++++++
' The routine below is the same as above
' and the code produced would be the right side
' but in this case more tree commands was
' add to the routine.
' A fort point of this new implement would
' be more flexibility to write a program for
' initialization device's. If we think in
' combined way, this would still go far ahead.
'+++++++++++++++++++++++++++++++++++++++++++
'Sub Procedure pTeste(pPORT, P0, P1)
'Dim any as Byte 'Local
'
''Any = 20 'Final code will be
' 'BCF STATUS,RP1
' 'BCF STATUS,RP0
''SetBit(pPORT,P0) 'BSF PORTB,0
''SetBit(pPORT,P1) 'BSF PORTB,7
''ClearBit(pPORT,P0) 'BCF PORTB,0
''TestBit(pPORTB,P0) 'BTFSC PORTB,0
''pPORT = pPORT + Any 'MOVF Any ,W
' 'IORWF PORTB
'
'+++++++++++++++++++++++++++++++++++++++++++
' The assembly module could be written simpler.
'+++++++++++++++++++++++++++++++++++++++++++
''Asm 'Code result
'' Movlw _EN1 'MOVLW 12
'' Movwf _pPORT 'MOVWF PORTB
'' Movf _pPORT,W 'MOVF PORTB,W
'' Movwf _STACK_n 'MOVWF _STACK_n
''And asm
'
'End Sub
main:
TRISB = 0
pTeste(PORTB,0,7)
nop
end.
Hi Zristic;
MakroIT is a good job, I didn't think of macro language.
I would like to know if the idea above be able or not to be implemented in the compiler. however it doesn't need to be that radical. Thus, we would not be just arrested in a routine or other.
And like you can see, the user of the platform always finds a difficulty or other and it tries like this to outline the situation.
Regards.
MakroIT is a good job, I didn't think of macro language.
I would like to know if the idea above be able or not to be implemented in the compiler. however it doesn't need to be that radical. Thus, we would not be just arrested in a routine or other.
And like you can see, the user of the platform always finds a difficulty or other and it tries like this to outline the situation.
Regards.