Mercurial > hg > Members > kono > nitros9-code
view lib/alib/strncpy.as @ 3054:22ddd48b4ec2
level1 krn: Fix scheduler bug that only affected 6309
The original 6809 binary was correct, but it was disassembled
and interpreted wrongly, so that reassembly went wrong on 6309.
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 25 Jan 2015 22:36:02 +0100 |
parents | 03f26e88b809 |
children |
line wrap: on
line source
********************************** * STRNCPY: copy N bytes of a null terminated string * User must ensure there is room in buffer!!! * If N>string length only N bytes will be moved * OTHER MODULES NEEDED: STRLEN, MEMMOVE * ENTRY: X=start of string to move * Y=buffer for copy of string * EXIT: D = actual number of bytes moved * all other regs preserved (except cc) nam Copy partial String ttl Assembler Library Module section .text STRNCPY: pshs d bytes wanted to move lbsr STRLEN find length of string addd #1 move NULL also cmpd ,s get smaller of passed/actual size bls skip use actual leng ldd ,s use passed leng²² skip lbsr MEMMOVE move it leas 2,s rts endsect