Last active
November 28, 2019 21:10
-
-
Save mistificator/dbb5e43675461114bd85e3710f664ba5 to your computer and use it in GitHub Desktop.
Zx Spectrum CP/M ASM test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; CP/M example | |
| .org $100 | |
| ld hl, Message | |
| call Print | |
| call $0000 ; CP/M warm boot | |
| Print: | |
| ld a,(hl) | |
| cp '$' | |
| ret z | |
| push hl | |
| ld c, $02 ; CP/M BIOS function 0x02 - CONOUT | |
| ld e, a | |
| call $0005 ; call CP/M BIOS entry point at 0x0005 | |
| pop hl | |
| inc hl | |
| jp Print | |
| Message: ; test ESCAPE-codes as described in https://www.worldofspectrum.org/Plus3CPMManual/appendix3.html | |
| .db $1B,'E' ; clear screen | |
| .db $1B,'b',80 ; set light green color | |
| .db $1B,'Y',5+$20,10+$20 ;move cursor to (x,y)=(10, 5) | |
| .db "Hello, world! This is mighty CP/M test.",$0d,$0a,'$' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; switch ROM banks from CP/M test | |
| .org $100 | |
| di | |
| ld a, 16 ; switch ROM horizontal (D4) | |
| ; ld (SYSVAR_7FFD_STATE), a | |
| ld bc, $7FFD | |
| out (c), a | |
| ld a, 4 ; switch ROM vertical (D2) | |
| ; ld (SYSVAR_1FFD_STATE), a | |
| ld bc, $1FFD | |
| out (c), a | |
| ei | |
| rst $00 ; reboot |
Author
mistificator
commented
Nov 28, 2019

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment