Article View: comp.lang.forth
Article #228Re: writing an AVR disassembler
From: dxf
Date: Mon, 16 Nov 2026 00:57
Date: Mon, 16 Nov 2026 00:57
26 lines
1727 bytes
1727 bytes
On 16/11/2026 9:55 am, Ivan Shmakov wrote: > ... > I /think/ that UNNIBBLE in particular can be made simpler, > but it's not obvious to me how. (Or do I just use some > built-in word here instead?) My 'built-in' (kernel) word is >DIGIT and was designed to be 'general purpose'. It's coded in assembler but here's a high-level version. It's case-sensitive to handle situations where lowercase would amount to an error. It returns 'char' in the event of error should one want to print it. : END postpone EXIT postpone THEN ; immediate \ >DIGIT >CHAR \ Cvt numeric char to digit u according to base. Case sensitive. \ Defined in kernel : >DIGIT ( char base -- u true | char false ) over [char] 0 - dup #10 #17 within 0= if dup #16 u> if 7 - then dup rot u< if nip true end dup then 2drop false ; \ Convert numeric digit u to ASCII character char \ Defined in kernel : >CHAR ( u -- char ) dup 9 > if 7 + then [char] 0 + ;
Technical Details
Message-ID:
<6afa54e3$1@news.ausics.net>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!news.bbs.nz!news.ausics.net!not-for-mailReferences:
<UOSz15Vn9V7SG_X-@violet.siamics.net>Show Full Headers
Complete Article Headers
Date: Mon, 16 Nov 2026 11:57:07 +1100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: writing an AVR disassembler Newsgroups: comp.lang.forth References: <UOSz15Vn9V7SG_X-@violet.siamics.net> Content-Language: en-GB From: dxf <dxforth@gmail.com> In-Reply-To: <UOSz15Vn9V7SG_X-@violet.siamics.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit NNTP-Posting-Host: news.ausics.net Message-ID: <6afa54e3$1@news.ausics.net> Organization: Ausics - https://newsgroups.ausics.net Lines: 26 X-Complaints: abuse@ausics.net Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!news.bbs.nz!news.ausics.net!not-for-mail