From 937e360bf02b62765da997e349083424f1224b7a Mon Sep 17 00:00:00 2001 From: Jali Date: Thu, 2 Apr 2020 23:44:05 +0200 Subject: [PATCH] Added example code --- README.md | 36 ++++++++++++++++++++++++++++++++++++ src/example/char_out.asm | 8 ++++++++ src/example/char_out.md | 29 +++++++++++++++++++++++++++++ src/example/str_out.asm | 10 ++++++++++ src/example/str_out.md | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 116 insertions(+) create mode 100644 src/example/char_out.asm create mode 100644 src/example/char_out.md create mode 100644 src/example/str_out.asm create mode 100644 src/example/str_out.md diff --git a/README.md b/README.md index e69de29..05e7988 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,36 @@ +# E220Term + +> Version: 1.0.20092.1 \ +> Created by: Jali \ +> Last modified by: Jali + +## About + +The PC-E220 was one of the last, and by far the most powerful of the +Sharp Pocket-Computer series. + +These where small computers, you could actually carry around with you, and +use on the go. While most of them where glorified programmable pocket calculators, +the PC-E220 came with 32KiB of RAM and a CMOS-SC7852 CPU, that was code compatible with +the Zilog Z80A at 3.58 MHz. That made the CPU faster than an Amstrad CPC or other Z80 based +machines of the time. + +While the 144x32 dot-matrix display is not very well equipped for graphics, because +it is divided into 5x7 cells, it can print a wide range of characters, and displays +24 characters in 4 rows. By the standards of a pocket computer, that was a lot. + +It comes, however, with a fully equipped serial interface, that can be used to connect to +other systems. + +This project attempts to implement a small dumb terminal, to connect to a console of a Linux +system, just for the experience of writing some useful code for his tiny machine. + +## Coding + +The E220 has a built-in assembler, which is the target of this code. +The goal is, to write code, that can be transferred onto the E220 and assembled +directly on the device. Of course any Z80 assembler should be able to assemble the code. +Keep in mind though, that the code makes use of the built in ROM function, for example +for outputting characters on the screen, and therefore will only work on the E220! + +The src/examples section contains experimental code to use these sub routines. diff --git a/src/example/char_out.asm b/src/example/char_out.asm new file mode 100644 index 0000000..20050af --- /dev/null +++ b/src/example/char_out.asm @@ -0,0 +1,8 @@ +10;Outputs an "A" in the second column of the last row +20 ORG 100H ;Tell the assembler to start at addr. 0x100 +30START: LD A,41H ;Load the letter "A" to register A +40 LD DE,301H ;Sets the row to 3 and the column to 1 +50 CALL 8468H ;Calls the ```char_out``` function +60 RET ;Return +70 END ;Marks the end of the code for the assembler + diff --git a/src/example/char_out.md b/src/example/char_out.md new file mode 100644 index 0000000..b78e9ea --- /dev/null +++ b/src/example/char_out.md @@ -0,0 +1,29 @@ +# ```char_out``` + +> Version: 1.0.20092.1 \ +> Created by: Jali \ +> Last modified by: Jali + +## About + +The ```char_out``` function is one of the built-in functions from the ROM. +It takes a character, and writes it onto the screen, at a specific location. + +## Parameters + +```char_out``` is called through address 0x8468. It takes three parameters: +- Register A holds the ASCII code of the character to print +- Register DE holds the position on the screen. D is a value between 0 and 3, representing + the row, while E has a value between 0-23, representing the column to print in. + +## Example + +```ASM +10;Outputs an "A" in the second column of the last row +20 ORG 100H ;Tell the assembler to start at addr. 0x100 +30START: LD A,41H ;Load the letter "A" to register A +40 LD DE,301H ;Sets the row to 3 and the column to 1 +50 CALL 8468H ;Calls the ```char_out``` function +60 RET ;Return +70 END ;Marks the end of the code for the assembler +``` diff --git a/src/example/str_out.asm b/src/example/str_out.asm new file mode 100644 index 0000000..f7bcc2b --- /dev/null +++ b/src/example/str_out.asm @@ -0,0 +1,10 @@ +10;output a string into the top left of the screen +20 ORG 0100H ;Start at addr 0x100 +30START: LD HL,DATA ;Load the start address of the string +40 LD B,0DH ;The length of the string (max 255 chars) +50 LD DE,0H ;Start in the top left corner (D=0-3 -> row; E=0-23 column) +60 CALL 84CDH ;Call the str_out function in ROM +70 RET ;Return from call +80DATA: DB 'HELLO, WORLD!' +90 END ;End marker for the assembler + diff --git a/src/example/str_out.md b/src/example/str_out.md new file mode 100644 index 0000000..52e2630 --- /dev/null +++ b/src/example/str_out.md @@ -0,0 +1,33 @@ +# ```str_out``` + +> Version: 1.0.20092.1 \ +> Created by: Jali \ +> Last modified by: Jali + +## About + +The ```str_out``` function is one of the built-in functions from the ROM. +It takes a string of characters, and writes them onto the screen, at a specific location. + +## Parameters + +```str_out``` is called through address 0x84CD. It takes four parameters: +- Register HL holds the address of the string in memory +- Register B holds the length of the string. This restricts the maximum length to 255. +- Register DE holds the position on the screen. D is a value between 0 and 3, representing + the row, while E has a value between 0-23, representing the column to print in. + +## Example + +```ASM +10;output a string into the top left of the screen +20 ORG 0100H ;Start at addr 0x100 +30START: LD HL,DATA ;Load the start address of the string +40 LD B,0DH ;The length of the string (max 255 chars) +50 LD DE,0H ;Start in the top left corner (D=0-3 -> row; E=0-23 column) +60 CALL 84CDH ;Call the str_out function in ROM +70 RET ;Return from call +80DATA: DB 'HELLO, WORLD!' +90 END ;End marker for the assembler +``` +