Skip to content

Instantly share code, notes, and snippets.

@mistificator
Last active November 28, 2019 21:10
Show Gist options
  • Select an option

  • Save mistificator/dbb5e43675461114bd85e3710f664ba5 to your computer and use it in GitHub Desktop.

Select an option

Save mistificator/dbb5e43675461114bd85e3710f664ba5 to your computer and use it in GitHub Desktop.
Zx Spectrum CP/M ASM test
; 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,'$'
; 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
@mistificator
Copy link
Copy Markdown
Author

cpmtest

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