2014-09-26 07:37 AM
Hello
With the code below, i get returned an incremented caracter it self , the pointer is not,is it normal ? meaning my code is wrong . i mean i get U not O ...Or should I file a bug at sdcc comunity? ldw X,&sharpstring_0 ldw _charptr, Xmain_loop: LDW X, &sharp0d50 CALL delay_m CALL ledon LDW X, &sharp0d50 CALL delay_m CALL ledoff ldw Y,[_charptr] ; <---- not returning what is at that address ldw _lcdchar, Y call _lcdwritechar ldw Y, _charptr incw Y ldw _charptr, Y JP main_loop.area CODE
string_0: .ascii ''toto'' .db 0x00 #stm8-sdcc-linux-sdasm-sdasstm82014-09-29 11:22 AM
:)
my function works this way; try write H CHKBZF mov PD_ODR, #0b01000011 STRBLCD CHKBZF mov PD_ODR, #0b10000011 STRBLCD;try write X mov _lcdchar, #'X' ; <----- loads an immediate '' capital x '' call _lcdwritechar ; <----- works: i get X on the lcd mov _varOne, #'a' ld a,#_string_0 ld _charptr, aso my fonction works with immediate valuesthats why i try to pop up literals from a string.Regards2014-09-30 01:50 AM
I think something like this would work:
.area DATA
_lcdchar: .ds 1_charptr: .ds 2 .area HOMEldw x,#string_0 ; init pointer
ldw _charptr, xmain_loop: ldw x, _charptr ; load pointer ld a, (x) ; load char tnz a ; test if zero jreq 1$ ld _lcdchar, a call _lcdwritechar ldw x, _charptr ; increment pointer incw x ldw _charptr, x jra main_loop1$: retstring_0:
.ascii ''toto\0''2014-09-30 02:11 AM