Hello

I tested your suggestion, then replaced the ADDW with INCW ... still not 
working

this time, the carracter it self is incremented
as if the syntax

        ldw     X,[_charptr] doesnt return a pointer ...


If you guys think this is not a bug, I can try forum@st and try to port 
their answers
i am aware this mailing list is not dedicated to the STM8 assembly...




        ldw     X,#string_0
        ldw     _charptr, X

main_loop:

        LDW     X, #0d50
        CALL    delay_m
        CALL    ledon

        LDW     X, #0d50
        CALL    delay_m
        CALL    ledoff

        ldw     Y,[_charptr]
        ldw     _lcdchar, Y
        call    _lcdwritechar
        ldw     Y, _charptr
        incw    Y
        ldw     _charptr, Y

        JP      main_loop




Le 26.09.2014 11:39, Bin Shi a écrit :
> the _pointer is a 16-bit variable, and stm8 is big endian. you might 
> need
> 
>  ld y, _pointer
> addw y, #1
> ld _pointer, y
> 
> to replace inc _pointer
> 
> r...@remi.lu编写:
> 
>> 
>> 
>> hello
>> 
>> with this code i get printed : "t3333333...."
>> 
>> you think the X register gets polluted by the delay fonction ?
>> 
>> Regards
>> 
>> Le 26.09.2014 04:11, Ben Shi a écrit :
>> 
>>> I am not sure how your function _lcdwritechar works, but I guess you 
>>> might need such kind of code,
>>> 
>>> .area DATA
>>> 
>>> _varOne:
>>> 
>>> .ds 1
>>> 
>>> _lcdchar:
>>> 
>>> .ds 1
>>> 
>>> _pointer:
>>> 
>>> .ds 1
>>> 
>>> .....
>>> 
>>> ldw x, #_string_0
>>> 
>>> ldw _pointer, x
>>> 
>>> main_loop:
>>> 
>>> LDW X, #0d50
>>> 
>>> CALL delay_m
>>> 
>>> CALL ledon
>>> 
>>> LDW X, #0d50
>>> 
>>> CALL delay_m
>>> 
>>> CALL ledoff
>>> 
>>> ldw x, [_pointer.w]
>>> 
>>> ldw _lcdchar, x
>>> 
>>> call _lcdwritechar
>>> 
>>> inc _pointer
>>> 
>>> JP main_loop
>>> 
>>> ....
>>> 
>>> .area CODE
>>> 
>>> _string_0:
>>> 
>>> .ascii "toto"
>>> 
>>> .db 0x00
>>> 
>>> First, the variable _pointer is initialized to point to _string_0; 
>>> second, in each iteration of the main loop, the content pointed by 
>>> _pointer is moved to _lcdchar; third, _pointer increases each time.
>>> 
>>> 在2014年09月25 23时32分,"remi"<r...@remi.lu>写道:
>>> 
>>>> Hello
>>>> 
>>>> I have spent a few years with MChip, I switched to stm8 recently.
>>>> 
>>>> One of the reasons is pointer handeling (pic16 and 18) very limited 
>>>> ...
>>>> 
>>>> and now, I am almost learning two things in the same time, STM8 and 
>>>> sdasm .
>>>> 
>>>> Can some one direct me a little on how pointers are beeing
>>>> 
>>>> used in sdasstm8 ?
>>>> 
>>>> in this snipet, i am trying to go trhu a string and print it ...
>>>> 
>>>> no luck so far, only the "t" is printed .
>>>> 
>>>> I have already went thru sdccman.pdf ... but it mostly talk about 
>>>> its C and inline assembly ,
>>>> 
>>>> and stm8 axemples elsewhere are for other assemblers ... :)
>>>> 
>>>> my goal , is to write 100% assembly code .
>>>> 
>>>> Best regards
>>>> 
>>>> .area DATA
>>>> _varOne:
>>>> .ds 1
>>>> _lcdchar:
>>>> .ds 1
>>>> 
>>>> .....
>>>> 
>>>> main_loop:
>>>> 
>>>> LDW X, #0d50
>>>> CALL delay_m
>>>> CALL ledon
>>>> 
>>>> LDW X, #0d50
>>>> CALL delay_m
>>>> CALL ledoff
>>>> 
>>>> mov _lcdchar,string_0
>>>> call _lcdwritechar
>>>> inc [string_0]
>>>> 
>>>> JP main_loop
>>>> 
>>>> ....
>>>> 
>>>> .area CODE
>>>> string_0:
>>>> .ascii "toto"
>>>> .db 0x00
>>>> 
>>>> .area INITIALIZER
>>>> .area CABS (ABS)
>>> 
>>> ------------------------------------------------------------------------------
>>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS 
>>> Reports
>>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>>>  
>>> [1]
>>> 
>>> _______________________________________________
>>> Sdcc-user mailing list
>>> Sdcc-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/sdcc-user [2]
>> 
>> 
>> 
>> Links:
>> ------
>> [1]
>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&amp;iu=/4140/ostg.clktrk
>> [2] https://lists.sourceforge.net/lists/listinfo/sdcc-user
>> 
>> ------------------------------------------------------------------------------
>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS 
>> Reports
>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Sdcc-user mailing list
>> Sdcc-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/sdcc-user
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS 
> Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to