Skip to content

Instantly share code, notes, and snippets.

@dadecoza
Created October 24, 2023 19:52
Show Gist options
  • Save dadecoza/b76166356a94ad82c1b9356b8773a1e9 to your computer and use it in GitHub Desktop.
Save dadecoza/b76166356a94ad82c1b9356b8773a1e9 to your computer and use it in GitHub Desktop.
hellorld.lst
0000 1 ORG 0x1800
1800 dd 21 50 18 2 START LD IX, 0x1850 ; Display register text string starts at 0x183C
1804 3e 11 3 LD A, 0x11 ; Length of text string
1806 32 20 18 4 LD (0x1820), A ; Stick that into scratch memory at 0x1820
1809 cd 24 06 5 CALL 0x0624 ; Display what IX points to
180c cd 21 18 6 CALL 0x1821 ; CALL the pause loop
180f 3a 20 18 7 LD A, (SCRATCH) ; Pull string position pointer in from memory
1812 3d 8 DEC A ; Decrease text string pointer
1813 32 20 18 9 LD (0x1820), A ; Save it in memory
1816 ca 00 18 10 JP Z, START ; If Text string pointer is zero redo from start
1819 dd 2b 11 DEC IX ; If not, increase counter (dec to scroll other way)
181b c3 09 18 12 JP 0x1809 ; Move to next character
181e 00 13 NOP
181f 00 14 NOP
1820 00 15 SCRATCH DEFB 0 ; Text string position pointer
1821 3e 15 16 LD A, 0x15 ; Speed of scroll ................................... LOOP C
1823 47 17 LD B, A ; Repeat the delay loop A times (multiplier)
1824 3e 20 18 LD A, 0x20 ; Repeat the delay A times.
1826 4f 19 LD C, A ; Drop that into both counters- will loop B x C times.
1827 cd 32 18 20 CALL 0x1832 ; Nested loop code
182a 0d 21 DEC C ; Loop the loop down one
182b c2 2a 18 22 JP NZ, 0x182A ; Repeat until zero
182e cd 24 06 23 CALL 0x0624 ; Display again because loop code kills screen
1831 c9 24 RET ; Return
1832 e3 25 ex (sp),hl ; Stack Exchange HL-HL' ............................. LOOP B
1833 e3 26 ex (sp),hl ; Stack Exchange HL-HL'
1834 05 27 DEC B ; Loop down one
1835 cd 24 06 28 CALL 0x0624 ; Display because XTHL kills screen
1838 c2 32 18 29 JP NZ, 0x1832 ; Loop until finished
183b c9 30 RET ; Return
183c 00 31 TEXT DEFB 0x00 ; Space
183d 00 32 DEFB 0x00 ; Space
183e 00 33 DEFB 0x00 ; Space
183f 00 34 DEFB 0x00 ; Space
1840 00 35 DEFB 0x00 ; Space
1841 00 36 DEFB 0x00 ; Space
1842 50 37 DEFB 0x50 ; !
1843 b3 38 DEFB 0xB3 ; D
1844 85 39 DEFB 0x85 ; L
1845 03 40 DEFB 0x03 ; R
1846 bd 41 DEFB 0xBD ; O
1847 85 42 DEFB 0x85 ; L
1848 85 43 DEFB 0x85 ; L
1849 8f 44 DEFB 0x8F ; E
184a 37 45 DEFB 0x37 ; H
184b 00 46 DEFB 0x00 ; Space
184c 00 47 DEFB 0x00 ; Space
184d 00 48 DEFB 0x00 ; Space
184e 00 49 DEFB 0x00 ; Space
184f 00 50 DEFB 0x00 ; Space
1850 00 51 DEFB 0x00 ; Space
1851 52 END
81 bytes code generated and 3 labels defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment