Added example code
This commit is contained in:
36
README.md
36
README.md
@@ -0,0 +1,36 @@
|
|||||||
|
# E220Term
|
||||||
|
|
||||||
|
> Version: 1.0.20092.1 \
|
||||||
|
> Created by: Jali <jali@orca-central.de> \
|
||||||
|
> Last modified by: Jali <jali@orca-central.de>
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|||||||
8
src/example/char_out.asm
Normal file
8
src/example/char_out.asm
Normal file
@@ -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
|
||||||
|
|
||||||
29
src/example/char_out.md
Normal file
29
src/example/char_out.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# ```char_out```
|
||||||
|
|
||||||
|
> Version: 1.0.20092.1 \
|
||||||
|
> Created by: Jali <jali@orca-central.de> \
|
||||||
|
> Last modified by: Jali <jali@orca-central.de>
|
||||||
|
|
||||||
|
## 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
|
||||||
|
```
|
||||||
10
src/example/str_out.asm
Normal file
10
src/example/str_out.asm
Normal file
@@ -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
|
||||||
|
|
||||||
33
src/example/str_out.md
Normal file
33
src/example/str_out.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# ```str_out```
|
||||||
|
|
||||||
|
> Version: 1.0.20092.1 \
|
||||||
|
> Created by: Jali <jali@orca-central.de> \
|
||||||
|
> Last modified by: Jali <jali@orca-central.de>
|
||||||
|
|
||||||
|
## 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
|
||||||
|
```
|
||||||
|
|
||||||
Reference in New Issue
Block a user