The Artima Developer Community
Sponsored Link

Python Buzz Forum
Hello World for CP/M (Z80 Edition)

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Aaron Brady

Posts: 576
Nickname: insommeuk
Registered: Aug, 2003

Aaron Brady is lead developer for Crestsource
Hello World for CP/M (Z80 Edition) Posted: Jan 18, 2009 9:49 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Aaron Brady.
Original Post: Hello World for CP/M (Z80 Edition)
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
Latest Python Buzz Posts
Latest Python Buzz Posts by Aaron Brady
Latest Posts From insom.me.uk

Advertisement

As the current obsession is to build a Z80 microcomputer, myself and Ed decided it might be a good idea to be able to actually write some Z80 programs.

Using the assembly language experience we had in other languages, other people's simple .mac files and basically Googling any gaps in our information (memory maps, register lists, valid opcodes) we got "Hello World" in under an hour.

	.Z80

BOOT    EQU 0000H ; Where BDOS' map begins.
BDOS    EQU BOOT+05H ; Do a SysCall.
PRINTST EQU 9 ; Print.

	ASEG
	ORG 0100H

	LD  HL,0 ; Set up 512b of stack, actually don't think we need this.
	ADD HL,SP
	LD  (STACK),HL
	LD  HL,CEND
	PUSH DE
	LD DE,512
	ADD HL,DE
	POP DE
	LD  SP,HL

	PUSH DE ; Parameters seem to go in this register.
	LD DE,TEXT1
	PUSH AF
	PUSH BC
	PUSH HL
	LD C,PRINTST ; C holds the SysCall we want.
	CALL BDOS
	POP HL
	POP BC
	POP AF
	POP DE

	JP BOOT ; Return to the OS.

TEXT1:	DB 'Hello, world$'
STACK:	DS 2 ; Somewhere to store the original stack. Probably unneeded.
CEND	EQU $

	END	

Considering the scale of the systems I manage, and Ed develops, on a daily basis, there is something unbelievably cool about using technology that's older than you are to build things.

Read: Hello World for CP/M (Z80 Edition)

Topic: Twitter Weekly Updates for 2009-01-16 Previous Topic   Next Topic Topic: WSGI songlist application: the repoze.bfg take

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use