{"id":241,"date":"2021-01-25T11:17:00","date_gmt":"2021-01-25T10:17:00","guid":{"rendered":"https:\/\/www.dev-tronic.de\/?p=241"},"modified":"2021-08-25T08:40:02","modified_gmt":"2021-08-25T06:40:02","slug":"hexadezimalumrechnung","status":"publish","type":"post","link":"https:\/\/www.dev-tronic.de\/?p=241","title":{"rendered":"Z80 &#8211; Hexadezimalumrechnung"},"content":{"rendered":"\n<p>Umrechnung von Dezimal in Hexadezimal von 4 Bit (Nibble) bis 32 Bit (DWord). Die Routine sieht eine Ausgabe auf einem Ausgabekanal vor. Die Ausgabe ist nicht Teil der Routine<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:z80 decode:true \">;**************************************************************************\n; Ein Byte Hexadezimal auf dem Bildschirm ausgeben\n;\n; Eingabe: A = Byte\n; Ausgabe: Hexadezimale Ausgabe an Cursorposition\n;**************************************************************************\nprthex_byte:    push    af                                                 ; Save the contents of the registers\n                push    bc\n                ld      b, a\n                rrca\n                rrca\n                rrca\n                rrca\n                call    prthex_nibble                                      ; Print high nibble\n                ld      a, b\n                call    prthex_nibble                                      ; Print low nibble\n                pop     bc                                                 ; Restore original register contents\n                pop     af\n                ret\n\n\n;**************************************************************************\n; Ein Nibble Hexadezimal auf dem Bildschirm ausgeben\n;\n; Eingabe: A = Nibble (die unteren 4 Bit)\n; Ausgabe: Hexadezimale Ausgabe an Cursorposition\n;**************************************************************************\nprthex_nibble:  push    af                                                 ; Der Inhalt von A bleibt erhalten -&gt; Stack\n                and     0fh                                                ; Nur f\u00fcr den Fall....\n                add     a,'0'                                              ; Wenn es 0 ist, sind wir fertig.\n                cp      03ah                                               ; Ergebnis &gt; \"9\"?\n                jr      c, _prthex_nibb_1\n                add     a,'A' - '0' - 0ah                                  ; \"A\" - \"F\" beachten\n_prthex_nibb_1: call    printchar                                          ; Das Nibble ausgeben (Die Ausgaberoutine muss separat erstellt werden)\n                pop     af                                                 ; und Register A wiederherstellen\n                ret                                                        ; Fertig\n\n\n;**************************************************************************\n; Ein 16bit Wort Hexadezimal auf dem Bildschirm ausgeben\n;\n; Eingabe: HL = 16 Bit-Wort \n; Ausgabe: Hexadezimale Ausgabe an Cursorposition\n;**************************************************************************\nprthex_word:    push    hl                                                 ; HL auf den Stack\n                push    af                                                 ; A (und F) auf den Stack\n                ld      a, h                                               ; Highbyte nach A\n                call    prthex_byte                                        ; Byte ausgeben\n                ld      a, l                                               ; Lowbyte nach A\n                call    prthex_byte                                        ; Byte ausgeben\n                pop     af                                                 ; AF wiederherstellen\n                pop     hl                                                 ; HL wiederherstellen\n                ret                                                        ; Fertig\n\n;**************************************************************************\n; Ein 32bit Wort Hexadezimal auf dem Bildschirm ausgeben\n;\n; Eingabe: BC = 16 Bit-Wort, DE 16 Bit Wort \n; Ausgabe: Hexadezimale Ausgabe an Cursorposition\n;**************************************************************************\nprthex_dword:   push hl                                                    ; HL auf den stack\n                push bc                                                    ; BC auf den Stack\n                pop hl                                                     ; BC nach HL\n                call prthex_word                                           ; 16 Bit ausgeben\n                push de                                                    ; DE auf den Stack\n                pop hl                                                     ; DE nach HL\n                call prthex_word                                           ; 16 Bit ausgeben\n                pop hl\n                ret\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Umrechnung von Dezimal in Hexadezimal von 4 Bit (Nibble) bis 32 Bit (DWord). Die Routine sieht eine Ausgabe auf einem Ausgabekanal vor. Die Ausgabe ist nicht Teil der Routine<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[27,28],"class_list":["post-241","post","type-post","status-publish","format-standard","hentry","category-z80codeschnipsel","tag-hex","tag-umrechnung"],"_links":{"self":[{"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=241"}],"version-history":[{"count":3,"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":345,"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions\/345"}],"wp:attachment":[{"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-tronic.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}