pointer problem (sdcc assembler)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-09-26 7:37 AM
Posted on September 26, 2014 at 16:37
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-sdasstm8
This discussion is locked. Please start a new topic to ask your question.
12 REPLIES 12
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-09-29 11:22 AM
Posted on September 29, 2014 at 20:22
:)
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.RegardsOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-09-30 1:50 AM
Posted on September 30, 2014 at 10:50
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''Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-09-30 2:11 AM
Posted on September 30, 2014 at 11:11thank you ! it works :)regards

- « Previous
-
- 1
- 2
- Next »