From: ian Date: Mon, 26 Dec 2005 22:32:47 +0000 (+0000) Subject: split syncwrite into syncwrite and syncwritehex X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=d451fe8e30a72c989fcbebf127909d7d2378777d;p=trains.git split syncwrite into syncwrite and syncwritehex --- diff --git a/detpic/.cvsignore b/detpic/.cvsignore index d3c835c..5730ae9 100644 --- a/detpic/.cvsignore +++ b/detpic/.cvsignore @@ -13,6 +13,7 @@ idlocs*.asm morse+auto.inc ours+pindata.asm syncwrite.asm +syncwritehex.asm t.* t *.new diff --git a/iwjpictest/Makefile b/iwjpictest/Makefile index 8fb14ae..0132e15 100644 --- a/iwjpictest/Makefile +++ b/iwjpictest/Makefile @@ -26,7 +26,7 @@ include ../pic.make %.hex: %.o $(LIBS) $(DEFLIBS) $(LINK) -harness.hex: harness.o syncwrite.o $(LIBS) +harness.hex: harness.o syncwrite.o syncwritehex.o $(LIBS) $(LINK) clean: pic-clean diff --git a/iwjpictest/syncwrite.asm b/iwjpictest/syncwrite.asm index c921b2c..582673c 100644 --- a/iwjpictest/syncwrite.asm +++ b/iwjpictest/syncwrite.asm @@ -1,17 +1,10 @@ ;====================================================================== -; -; these routines all use serial_write_char which writes -; bytes to the serial port synchronously include /usr/share/gputils/header/p18f458.inc radix dec include ../iwjpictest/insn-aliases.inc - udata_acs -serial_hex_temp res 1 - code - ;---------------------------------------- serial_write_char ; W character undefined @@ -21,39 +14,6 @@ serial_write_char_loop mov_wf TXREG return -;---------------------------------------- -serial_write_hex -; transmits W in hex through serial port, using serial_write_char -; Before After -; W value undefined -; serial_hex_temp undefined undefined - mov_wf serial_hex_temp - rcall serial_write_hex_1digit_for_both - rcall serial_write_hex_1digit_for_both - return - -;-------------------- -serial_write_hex_1digit_for_both -; transmits top nybble of serial_hex_temp in hex -; through serial port, as above, and swaps nybbles -; Before After -; W any undefined -; serial_hex_temp BBBBaaaa aaaaBBBB (BBBB was sent) - swap_f serial_hex_temp - mov_fw serial_hex_temp -;... -;-------------------- -serial_write_hex_digit -; transmits bottom nybble of W in hex -; W ????VVVV undefined - and_lw 0x0f - sub_lw 10 - sub_lw 0 - bra_n serial_write_hex_digit_ifnot_ge10 - add_lw 'a'-('0'+10) -serial_write_hex_digit_ifnot_ge10 - add_lw '0'+10 - bra serial_write_char - +;====================================================================== include ../iwjpictest/syncwrite.inc end diff --git a/iwjpictest/syncwritehex.asm b/iwjpictest/syncwritehex.asm new file mode 100644 index 0000000..4850bbc --- /dev/null +++ b/iwjpictest/syncwritehex.asm @@ -0,0 +1,51 @@ +;====================================================================== +; +; these routines all use serial_write_char which writes +; bytes to the serial port synchronously + + radix dec + include ../iwjpictest/insn-aliases.inc + + udata_acs +serial_hex_temp res 1 + + code +;---------------------------------------------------------------------- + +;---------------------------------------- +serial_write_hex +; transmits W in hex through serial port, using serial_write_char +; Before After +; W value undefined +; serial_hex_temp undefined undefined + mov_wf serial_hex_temp + rcall serial_write_hex_1digit_for_both + rcall serial_write_hex_1digit_for_both + return + +;-------------------- +serial_write_hex_1digit_for_both +; transmits top nybble of serial_hex_temp in hex +; through serial port, as above, and swaps nybbles +; Before After +; W any undefined +; serial_hex_temp BBBBaaaa aaaaBBBB (BBBB was sent) + swap_f serial_hex_temp + mov_fw serial_hex_temp +;... +;-------------------- +serial_write_hex_digit +; transmits bottom nybble of W in hex +; W ????VVVV undefined + and_lw 0x0f + sub_lw 10 + sub_lw 0 + bra_n serial_write_hex_digit_ifnot_ge10 + add_lw 'a'-('0'+10) +serial_write_hex_digit_ifnot_ge10 + add_lw '0'+10 + bra serial_write_char + +;====================================================================== + include ../iwjpictest/syncwrite.inc + end