Character codes: Difference between revisions
Content deleted Content added
Puppydrum64 (talk | contribs) No edit summary |
Puppydrum64 (talk | contribs) m →{{header|68000 Assembly}}: Added explanation of "UnpackNibbles8" and "PrintChar" |
||
Line 65: | Line 65: | ||
=={{header|68000 Assembly}}== |
=={{header|68000 Assembly}}== |
||
The printing routine only understands ASCII characters as codes anyway, so the "given a code produce its character" part is trivial. |
The printing routine only understands ASCII characters as codes anyway, so the "given a code produce its character" part is trivial. |
||
PrintChar routine is omitted for brevity. It converts the two Cursor variables to a FIX layer address and outputs the character using the NEOGEO's FIX layer. Characters are stored in ROM and arranged in ASCII order. |
|||
<lang 68000devpac> JSR ResetCoords ;RESET TYPING CURSOR |
<lang 68000devpac> JSR ResetCoords ;RESET TYPING CURSOR |
||
Line 120: | Line 121: | ||
ADDQ.B #1,D1 |
ADDQ.B #1,D1 |
||
DBRA D2,PrintAllTheCodes |
DBRA D2,PrintAllTheCodes |
||
rts |
|||
UnpackNibbles8: |
|||
; INPUT: D0 = THE VALUE YOU WISH TO UNPACK. |
|||
; HIGH NIBBLE IN HIGH WORD OF D0, LOW NIBBLE IN LOW WORD. SWAP D0 TO GET THE OTHER HALF. |
|||
pushWord D1 |
|||
CLR.W D1 |
|||
MOVE.B D0,D1 |
|||
CLR.L D0 |
|||
MOVE.B D1,D0 ;now D0 = D1 = $000000II, where I = input |
|||
AND.B #$F0,D0 ;chop off bottom nibble |
|||
LSR.B #4,D0 ;downshift top nibble into bottom nibble of the word |
|||
SWAP D0 ;store in high word |
|||
AND.B #$0F,D1 ;chop off bottom nibble |
|||
MOVE.B D1,D0 ;store in low word |
|||
popWord D1 |
|||
rts</lang> |
rts</lang> |
||
Output can be seen [https://ibb.co/ngtDXpq here.] |
Output can be seen [https://ibb.co/ngtDXpq here.] |