Character codes: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) No edit summary |
|||
Line 63: | Line 63: | ||
a |
a |
||
</pre> |
</pre> |
||
=={{header|68000 Assembly}}== |
|||
The printing routine only understands ASCII characters as codes anyway, so the "given a code produce its character" part is trivial. |
|||
<lang 68000devpac> JSR ResetCoords ;RESET TYPING CURSOR |
|||
MOVE.B #'A',D1 |
|||
MOVE.W #25,D2 |
|||
MOVE.B #0,(softCarriageReturn) ;new line takes the cursor to left edge of screen. |
|||
jsr PrintAllTheCodes |
|||
jsr ResetCoords |
|||
MOVE.B #8,(Cursor_X) |
|||
MOVE.B #'a',D1 |
|||
MOVE.W #25,D2 |
|||
MOVE.B #8,(softCarriageReturn) |
|||
;set the writing cursor to column 3 of the screen |
|||
;so we don't erase the old output. |
|||
jsr PrintAllTheCodes |
|||
forever: |
|||
bra forever |
|||
PrintAllTheCodes: |
|||
MOVE.B D1,D0 |
|||
jsr PrintChar ;print the character as-is |
|||
MOVE.B #" ",D0 |
|||
jsr PrintChar |
|||
MOVE.B #"=",D0 |
|||
jsr PrintChar |
|||
MOVE.B #" ",D0 |
|||
jsr PrintChar |
|||
MOVE.B D1,D0 ;get ready to print the code |
|||
JSR UnpackNibbles8 |
|||
SWAP D0 |
|||
ADD.B #$30,D0 |
|||
JSR PrintChar |
|||
SWAP D0 |
|||
CMP.B #10,D0 |
|||
BCS noCorrectHex |
|||
ADD.B #$07,D0 |
|||
noCorrectHex: |
|||
ADD.B #$30,D0 |
|||
JSR PrintChar |
|||
MOVE.B (softCarriageReturn),D0 |
|||
JSR doNewLine2 ;new line, with D0 as the carraige return point. |
|||
ADDQ.B #1,D1 |
|||
DBRA D2,PrintAllTheCodes |
|||
rts</lang> |
|||
Output can be seen [https://ibb.co/ngtDXpq here.] |
|||
=={{header|AArch64 Assembly}}== |
=={{header|AArch64 Assembly}}== |